ds.spatial.get_weights used to work nicely, but does not work anymore #455
-
ds = xc.open_dataset('/p/css03/esgf_publish/CMIP6/ScenarioMIP/IPSL/IPSL-CM6A-LR/ssp585/r2i1p1f1/Amon/tas/gr/v20191121/tas_Amon_IPSL-CM6A-LR_ssp585_r2i1p1f1_gr_201501-210012.nc',add_bounds=True,decode_times=True,center_times=True) ---> 7 weights4 = ds.spatial.get_weights(axis=['Y', 'X'], lat_bounds=[-90,90],lon_bounds=[0,360]) #*m0x File ~/my_envs/xcdatsimple/lib/python3.10/site-packages/xcdat/spatial.py:274, in SpatialAccessor.get_weights(self, axis, lat_bounds, lon_bounds, data_var) File ~/my_envs/xcdatsimple/lib/python3.10/site-packages/xcdat/bounds.py:218, in BoundsAccessor.get_bounds(self, axis, var_key) KeyError: "No bounds data variables were found for the 'Y' axis. Make sure the dataset has bound data vars and their names match the 'bounds' attributes found on their related time coordinate variables. Alternatively, you can add bounds with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 13 replies
-
This code works for me in xcdat 0.5.0. Is this the version you're on ( Also – do you know that you can pass the bounds in spatial averager and have it compute the weights on its own?
|
Beta Was this translation helpful? Give feedback.
Thanks @bonfils2! We can continue this discussion in #458 as needed.