-
Notifications
You must be signed in to change notification settings - Fork 41
More unit definitions from xclim #284
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, although it feels a bit strange that the symbol of degrees_north
should be degrees_north
, I'd have assumed something like °N
or °
(same for degrees_east
). I can't find anything on that in the CF conventions (not that I looked very hard), so maybe that's intentional? Why this is important is because something like
u = ureg.Unit("degrees_north ** 2")
f"{u:~cf}"
would return "degrees_north2"
, which is weird (unless I'm missing something?)
Actually, this is not really the fault of this PR: right now it returns "degrees_N2"
which is not that much better.
Edit: now that I'm thinking about it, "°N2"
or "°2"
also look strange, so maybe we don't have much of a choice?
Edit2: I just realized that this is actually a continuation of #284 (comment), I must have missed that.
I've realized that there are at least 2 distinct use-cases:
|
* main: Add earthcube link (xarray-contrib#292) Fix np scaler warning in `_drop_missing_variables()` (xarray-contrib#291) explicitly use the short formatter in the docs (xarray-contrib#288) Set xincrease/yincrease in more cases. (xarray-contrib#287) Use mamba on RTD (xarray-contrib#286)
The funny exponent syntax is from UDUNITS I see pint has a "pretty" formatting mode. Is there a way we can define the "pretty" string? u = units.Unit("degrees_east")
f"{u:~P}"
EDIT: I see even pint doesn't do the pretty
EDIT2: Should we define a |
I needed the "degC = celsius" aliases so I copied that and more from xclim.
cc @jthielen
xref #225