-
Notifications
You must be signed in to change notification settings - Fork 59
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
Consider factoring our the pint cf units module into its own package #1788
Comments
Hi Filipe, thanks for raising this issue! I know that we've talked about moving much of this code to other more generalized and upstream packages ( Maintenance of the boilerplate is easy as we have our own cookiecutter template that we version with I'll let my colleagues weigh in on this here before we decide whether to move forward on this idea. FYI @Ouranosinc/xclim-core |
BTW,in case you are curious, this is my application that would use it: https://github.com/ioos/compliance-checker/pull/1094/files For now I'm copying over parts of cf-xarray, xclim, and some code from them that comes from metpy. I already added few units but I do plan to parse the udunits2 xml file and add them all. Working on the COARDS dates first b/c that is the main blocker for us. |
Hi ! I think we would be quite happy to have xclim's unit handling move somewhere else upstream. Are there specific parts you'd want to have accessible outside xclim ? We have a (heavy?) machinery around the flux<->rate<->amount conversion that uses CF names, is that of interest too ? Sadly however, I don't think I have myself much time available to do so... |
Hey @ocefpaf, we've had some time to talk this over, and we're relatively comfortable splitting these functions out into a new package. I guess what we'd want to know are the following:
Beyond that, there are a few functions that we rely on that are very closely tied to xarray and CF conventions, making us wonder how this package will differ from the aims of cf-xarray. Conveniently, a change like this would really help with another goal we have in mind: https://github.com/Ouranosinc/xsdba |
No strong preference. I'm fine with whatever you believe is better.
+1
I'm terrible with names... udunitspy is taken on PyPI (also gravitates around udunits), so is cf_units. Maybe
Never used it but I can manage. Note that, while I'd love to get this done ASAP. I don't have the cycles for it right now. If my day-job contract is renewed I will probably tackle this. |
To be honest, I don't know but it is likely. At this point we need a cf_units alternative that does not have a C library, like udunits, under the hood. My primary goal is to add as many udunits units as possible to get our software going. |
But are you looking for a array-agnostic solution i.e. that works for xarray as well as iris or pure numpy ? Because, I would rather be in favor of moving things to |
Ideally cf-xarray would use this package as well. I'm not sure how low level we can be but maybe this package would be just a set of new units (cf/udunits) registered in pint. The array functionality can be another package and depend on it. That would help keep the dependencies low for projects that would use this just to check units, or want to implement their own internal machinery. With that said, as long as it is pure Python, most projects can handle xarray as a dependency, it is not a big price to pay. Having a single package that does both new units + xarray support would be acceptable. |
Update. The amazing Phil Elson started https://github.com/pelson/pyudunits2 |
Generic Issue
I started writing a cf_units alternative, to avoid the udunits2 dependency, and found out that 99.99% of what I need is already here in xclim. Would the devs here consider factoring this part out into its own package? I know at least half a dozen other packages that would use it as a dependency.
IMO, it more packages use it, more improvements can be done to support all of udunits2 and repleace cf_units. What do you think?
PS: If that is a big ask would the devs here be OK with me vendoring this part in another codebase?
Code of Conduct
The text was updated successfully, but these errors were encountered: