JiaweiZhuang / xESMF

Universal Regridder for Geospatial Data
http://xesmf.readthedocs.io/
MIT License
269 stars 49 forks source link

After conda update, problem with cf_xarray: "Receive multiple variables for key 'longitude': ['i', 'lon']" #113

Closed eocene closed 3 years ago

eocene commented 3 years ago

Hi all,

I'm using raw model output that looks like this:

Screenshot 2021-01-22 at 11 18 04

And I'm getting this error message returned:

Screenshot 2021-01-22 at 11 19 23

Everything working fine before I ran conda update.

Does anyone have an idea how to move forward? (instead of just reverting everything to old versions)

Thank you!

dcherian commented 3 years ago

can you show ds.i.attrs and ds.lon.attrs

eocene commented 3 years ago

Sure!

Screenshot 2021-01-22 at 14 59 25
malmans2 commented 3 years ago

The latest versions of xesmf have been developed here: https://github.com/pangeo-data/xESMF You are probably using xesmf 0.5.0 or 0.5.1, and I think you are experiencing this issue: https://github.com/pangeo-data/xESMF/pull/64

You have a few options:

Alternatively, you have to create the regridder using a dataset with only one latitude/longitude coordinate, where the coordinates are defined by the standard_name attribute. For example, if you drop lon and lat in your dataset, xesmf will use the coordinates named i and j.

Looks like you already have installed cf_xarray, so for a recap of the cf attributes associated with your dataset:

import cf_xarray
ds.cf.describe()
eocene commented 3 years ago

Thanks yes, I had fixed it reverting back. Will wait for push to conda before doing update.

Cheers!