Skip to content

Allow SCRIP reader to respect units w/r/t radians#1433

Draft
zarzycki wants to merge 1 commit into
mainfrom
fix-scrip-radians-units
Draft

Allow SCRIP reader to respect units w/r/t radians#1433
zarzycki wants to merge 1 commit into
mainfrom
fix-scrip-radians-units

Conversation

@zarzycki

Copy link
Copy Markdown

Overview

  • Currently, the SCRIP reader does not respect units attached to relevant lat/lon vars. That is, it assumes degrees. For 90% of grids, this is probably the case. MPAS, by default, writes SCRIP files internally in radians, which are easily convertible using NCO or other external scripts, but it breaks uxarray currently (well, uxarray runs fine since |radians| < |degrees| but then projects fields in a very small location near 0, 0).
  • This just adds a simple check to see if "radians" (or "radians-adjacent") units are attached to the grid_XX_lat/lon vars on the SCRIP nc file and, if so, converts upon loading.

PR Checklist

General

  • An issue is linked created and linked
  • Add appropriate labels
  • Filled out Overview and Expected Usage (if applicable) sections

Testing

  • Adequate tests are created if there is new functionality
  • Tests cover all possible logical paths in your function
  • Tests are not too basic (such as simply calling a function and nothing else)

Documentation

  • Docstrings have been added to all new functions
  • [N/A] Docstrings have updated with any function changes
  • Internal functions have a preceding underscore (_) and have been added to docs/internal_api/index.rst
  • [N/A] User functions have been added to docs/user_api/index.rst

@zarzycki zarzycki marked this pull request as draft December 30, 2025 17:25
@Sevans711

Copy link
Copy Markdown
Collaborator

Hi @zarzycki, thank you for drafting this PR! It has been a while, so I wanted to check, can you confirm whether this still needs to be fixed, in the latest version of uxarray?

If yes, it would be extremely helpful if you might be able to provide a tiny example (~1 MB or less would be ideal) where the issue occurs.

Then, the remaining steps would be:

  1. make an issue report (https://github.com/UXARRAY/uxarray/issues) for this issue.
  2. add the tiny example file, somewhere in uxarray/test/meshfiles/scrip.
  3. make a test (in uxarray/test/io/test_scrip.py) to check units are handled properly after your fix.
  4. merge main into this branch (via the "Update branch" button) and make sure all tests pass.
  5. someone else reviews the changes and merges the fix into main.

To make things as easy as possible, if you can confirm this is still an issue and can provide a tiny example file here, I'd be happy to take over any/all of steps 1 through 4 if you want, and then hopefully we could get this fix included in the next uxarray release!

@Sevans711 Sevans711 added the bug Something isn't working label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants