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

Error when plotting in "Univariate linear regression PSM" example #24

Open
tanaya-g opened this issue Nov 7, 2024 · 0 comments
Open

Comments

@tanaya-g
Copy link

tanaya-g commented Nov 7, 2024

When running the example code for the "univariate linear regression", I'm encountering an error that prevents me from generating the plot. I've exported my environment, and am happy to share more details.
exported environment: cfr_env.yaml.zip
The specific error I'm seeing is:

AttributeError Traceback (most recent call last)
Cell In[13], line 1
----> 1 fig, ax = obs_tas_new.plot(levels=np.linspace(-40, 40, 11))

File ~/anaconda3/envs/cfr-env/lib/python3.11/site-packages/cfr/climate.py:568, in ClimateField.plot(self, **kwargs)
565 _kwargs.update(kwargs)
567 if len(fd_plot.da.dims) == 3:
--> 568 vals = fd_plot.da.values[0]
569 elif len(fd_plot.da.dims) == 2:
570 vals = fd_plot.da.values

File ~/anaconda3/envs/cfr-env/lib/python3.11/site-packages/xarray/core/common.py:302, in AttrAccessMixin.getattr(self, name)
300 with suppress(KeyError):
301 return source[name]
--> 302 raise AttributeError(
303 f"{type(self).name!r} object has no attribute {name!r}"
304 )

AttributeError: 'DataArray' object has no attribute 'values'

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