Code errors on Xarray pages
brian-rose opened this issue · 6 comments
The latest builds have code errors in several places in our Xarray tutorials, e.g.
https://foundations.projectpythia.org/core/xarray/computation-masking.html#groupby-split-apply-combine
and
https://foundations.projectpythia.org/core/xarray/computation-masking.html#compute-anomaly
and
https://foundations.projectpythia.org/core/xarray/enso-xarray.html#visualize-the-computed-nino-3-4-index
Several of these throw an error
TypeError: float() argument must be a string or a number, not 'cftime._cftime.DatetimeNoLeap'
I don't know when this started. These types of Python code errors don't get flagged by our CI tests. Is it due to version changes in Xarray or one of its dependencies?
I'm taking the liberty of labeling this as "high priority" because we should not have ugly errors in our featured tutorials!
The nightly build for the CMIP6 Cookbook is also failing with the same error.
I did some Xarray version testing. It looks like this behavior begins with the most recent (2022.11.0) xarray release. The immediate predecessor (2022.10.0) works without error.
I can put together a PR with an environment.yml
that specifies xarray<2022.11.0 as a quick fix, although it would be worth digging deeper to see if this is a bug in Xarray or if the lines that are throwing the error need to be rewritten.
suspect it stems from pydata/xarray#7052
And it looks like the error goes away if we add
import nc_time_axis
Looks like this problem will go away with the next release of Xarray, as it's been fixed with pydata/xarray#7276