Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cast units to str before applying any other preprocessor #498

Merged
merged 4 commits into from
Jan 31, 2024

Conversation

keewis
Copy link
Contributor

@keewis keewis commented Jan 31, 2024

The idea is to accept integer units of 1 for dimensionless, which is explicitly allowed by the CF conventions (we could, however, pass through objects that are not integers unmodified).

Note that pint itself doesn't really like the idea of integer units, so this will only work with ureg.parse_units(1): ureg.Quantity(1, 1) will raise before any preprocessor is called.

Copy link

codecov bot commented Jan 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a9cebee) 85.78% compared to head (3ee6b89) 85.79%.

❗ Current head 3ee6b89 differs from pull request most recent head 997ea4b. Consider uploading reports for the commit 997ea4b to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #498   +/-   ##
=======================================
  Coverage   85.78%   85.79%           
=======================================
  Files          13       13           
  Lines        2364     2365    +1     
  Branches      183      183           
=======================================
+ Hits         2028     2029    +1     
  Misses        303      303           
  Partials       33       33           
Flag Coverage Δ
mypy 38.55% <100.00%> (+0.02%) ⬆️
unittests 93.99% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dcherian dcherian enabled auto-merge (squash) January 31, 2024 16:54
@dcherian dcherian merged commit 25f5635 into xarray-contrib:main Jan 31, 2024
10 checks passed
@keewis keewis deleted the integer-1-unit branch January 31, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants