xmitgcm version on pip raises error
Closed this issue · 1 comments
Hey there, it seems like the current version of xmitgcm on pip has some trouble but the most recent version on github works just fine. The command and error message is:
ds = xmitgcm.open_mdsdataset(data_dir,grid_dir,delta_t=3600,ref_date='1992-01-01')
ValueError Traceback (most recent call last)
in
----> 1 ds = ecco.load_ecco_vars_from_mds(mds_var_dir=data_dir,mds_grid_dir=grid_dir)~/anaconda3/envs/py37_all/lib/python3.7/site-packages/ecco_v4_py/read_bin_llc.py in load_ecco_vars_from_mds(mds_var_dir, mds_grid_dir, mds_files, vars_to_load, tiles_to_load, model_time_steps_to_load, output_freq_code, meta_variable_specific, meta_common, mds_datatype, llc_method, less_output)
168 grid_vars_to_coords=True,
169 llc_method = llc_method,
--> 170 ignore_unknown_vars=True)
171
172 else:~/anaconda3/envs/py37_all/lib/python3.7/site-packages/xmitgcm/mds_store.py in open_mdsdataset(data_dir, grid_dir, iters, prefix, read_grid, delta_t, ref_date, calendar, geometry, grid_vars_to_coords, swap_dims, endian, chunks, ignore_unknown_vars, default_dtype, nx, ny, nz, llc_method, extra_metadata)
249 ds.time.data = (xr.coding.times
250 .decode_cf_datetime(ds.time.data, units=units,
--> 251 calendar=calendar))
252 # this doesn't seem to have any effect, so we remove it
253 #ds.time.encoding = encoding~/anaconda3/envs/py37_all/lib/python3.7/site-packages/xarray/core/common.py in setattr(self, name, value)
260 """
261 try:
--> 262 object.setattr(self, name, value)
263 except AttributeError as e:
264 # Don't accidentally shadow custom AttributeErrors, e.g.~/anaconda3/envs/py37_all/lib/python3.7/site-packages/xarray/core/dataarray.py in data(self, value)
551 @data.setter
552 def data(self, value: Any) -> None:
--> 553 self.variable.data = value
554
555 @Property~/anaconda3/envs/py37_all/lib/python3.7/site-packages/xarray/core/variable.py in data(self, data)
2106 def data(self, data):
2107 raise ValueError(
-> 2108 f"Cannot assign to the .data attribute of dimension coordinate a.k.a IndexVariable {self.name!r}. "
2109 f"Please use DataArray.assign_coords, Dataset.assign_coords or Dataset.assign as appropriate."
2110 )ValueError: Cannot assign to the .data attribute of dimension coordinate a.k.a IndexVariable 'time'. Please use DataArray.assign_coords, Dataset.assign_coords or Dataset.assign as appropriate.
The error is in some lines of code that have since been replaced with xr.decode_cf
, and works just fine with the most recent version on github, so perhaps the pip version just needs to be updated. Let me know if I can help with that in any way.