Open aulemahal opened 2 years ago
This is waiting on upstream changes in xarray.
PR to make some methods removed from xclim public in xarray is here : https://github.com/pydata/xarray/pull/9105.
Updated top post, all tasks are done except this public method thing.
Since xarray 0.20.0, some of xclim's calendar functionality has been implemented in xarray directly. Similarly,
cf_xarray
0.7.0 now replicates (with minor differences and improvements) the units string processing machinery of xclim. Which means we could phase them out of xclim using these upstream methods instead.Functions concerned:
[x]
xc.core.calendar.convert_calendar
->xr.Dataset.convert_calendar
,xr.DataArray.convert_calendar
,xr.coding.calendar_ops.convert_calendar
The main difference is that numpy's calendar dtype is the default for "standard" and cftime's one is use whenuse_cftime=True
is requested.[x]
xc.core.calendar.interp_calendar
->xr.Dataset.interp_calendar
,xr.DataArray.interp_calendar
,xr.coding.calendar_ops.interp_calendar
[x]
xc.core.calendar.date_range
->xr.date_range
[x]
xc.core.calendar.date_range_like
->xr.date_range_like
[x]
xc.core.units.units
(the pint registry) ->cf_xarray.units.units
They don't implement our special "hydro" context, and I don't think they ever will.~
xc.core.units.str2pint
->cf_xarray.units.units.Unit
Some (most? all?) of the string parsing we do by hand as moved to pint's preprocessor, through cf_xarray's registry.~ UPDATE: We still implement the possibility of passing a magnitude-less unit string OR a full quantity. Also, ourunits2pint
supports for input types and has as some typo catching.~
xc.core.units.pint2cfunits
->f"{u:~cf}"
~ Again, some of things we did by hand were moved to pint's formatters. UPDATE : In order to support more versions of pint (and numpy) then the latest one,pint2cfunits
will remain, even though it is now quite thin.So what is our plan for the deprecation?
I suggest we first simply make use of the upstream methods within our own API and remove them once and for all in xclim 1.0. May be adding a warning now, or at least on the last 0.x version. And we document this in the notebooks and docstrings.