-
Notifications
You must be signed in to change notification settings - Fork 41
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
custom unit formatter #278
Conversation
Nice! If your last point was about "sublicensing" xclim, I don't think it's really needed. I mean, as a core dev of xclim, I am totally ok with cf-xarray simply copying the code. To be certain we can ask @huard, who I think wrote this function ( |
that was directed at @dcherian: I only have experience with vendoring code (which is including the code without asking for permission) so I wasn't sure what to do in this case. A simple comment stating that "this was moved here from xclim", or modifying the notice about |
Not sure what the right answer is. Practically, I think modifying the notice at the top to specifically mention this function should be OK? We can also add a. comment above this function to make it extra clear. It does seem like we need to include the text of the BSD-3-clause license somewhere |
not sure if that's the best way, but I think if the |
xclim and cf_xarray are both apache-2 and apache-2 allows redistributing as long. as the new. license is compatible with apache-2 The super safe thing would be to create a new |
or we reorganize the current one to not have the notice at the top, but divide it into sections containing code from the same source. For now, this is easy: there's no dependency between the unit parsing and the unit formatting code. |
OK sounds good to me. |
This only has a effect if the module is imported with a star import, which is a bad thing, anyways.
not sure what the issue with RTD is, but in any case this should be ready for another round of reviews. Edit: still not sure about the license, let's see what @huard and @aulemahal think |
LGTM. Is pint likely to support passing modifiers soon? Should we instead register |
that depends on whether or not I can send in a PR... I think that should not be too much effort, but I won't really know until I work on it |
Thanks @keewis. This is a great contribution |
For the record, I'm happy to see this go into cf-xarray. |
The combination of
pint
's new-ish custom formatter feature andxclim
's unit formatting function (see Ouranosinc/xclim#780). Only the short formatter for now becausepint
does not pass the unit modifier to the formatter (i.e. to support both short and long version, we need a change topint
first).metpy
, but that's not true anymore.cc @aulemahal