Skip to content
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

[Bug]: cf_xarray<0.7.3 + xarray>=2022.6.0 breaks with AttributeError: module 'xarray.core' has no attribute 'resample' #467

Open
tomvothecoder opened this issue Sep 14, 2023 · 0 comments

Comments

@tomvothecoder
Copy link
Contributor

tomvothecoder commented Sep 14, 2023

I totally forgot to open up this issue last September, but I wanted to keep it on record in this repo.

In this xCDAT issue , a user found thatcf_xarray=0.7.0 breaks if xarray>=2022.6.0 is installed due to the import of module xr.core.resample.Resample. Maybe this module was moved to another location in the xarray codebase in that version?

Solution

  • Direct user solution: upgrade/install cf_xarray >=0.7.3 (this is what we found to work)
  • Developer solution: maybe a patch to constrain xarray>=2022.6.0 in the conda-forge feedstock?

Minimum example

Create and activate the environment (conda or mamba)

mamba create -n cf-xarray-bug cf_xarray=0.7.0 xarray=2022.6.0
mamba activate cf-xarray-bug
python
import cf_xarray

Log Output

>>> import cf_xarray
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/global/homes/v/vo13/mambaforge/envs/cf-xarray-bug/lib/python3.11/site-packages/cf_xarray/__init__.py", line 1, in <module>
    from .accessor import CFAccessor  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/homes/v/vo13/mambaforge/envs/cf-xarray-bug/lib/python3.11/site-packages/cf_xarray/accessor.py", line 41, in <module>
    xr.core.resample.Resample,
    ^^^^^^^^^^^^^^^^
AttributeError: module 'xarray.core' has no attribute 'resample'
@tomvothecoder tomvothecoder changed the title [Bug]: cf_xarray=0.7.0 breaks with AttributeError: module 'xarray.core' has no attribute 'resample' [Bug]: cf_xarray=0.7.0 + xarray>=2022.6.0 breaks with AttributeError: module 'xarray.core' has no attribute 'resample' Sep 14, 2023
@tomvothecoder tomvothecoder changed the title [Bug]: cf_xarray=0.7.0 + xarray>=2022.6.0 breaks with AttributeError: module 'xarray.core' has no attribute 'resample' [Bug]: cf_xarray<0.7.4 + xarray>=2022.6.0 breaks with AttributeError: module 'xarray.core' has no attribute 'resample' Sep 14, 2023
@tomvothecoder tomvothecoder changed the title [Bug]: cf_xarray<0.7.4 + xarray>=2022.6.0 breaks with AttributeError: module 'xarray.core' has no attribute 'resample' [Bug]: cf_xarray<0.7.3 + xarray>=2022.6.0 breaks with AttributeError: module 'xarray.core' has no attribute 'resample' Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant