cosima-cookbook
cosima-cookbook copied to clipboard
`querying.getvar` doesn't accept `chunks='auto'` kwarg
When I run :
cc.querying.getvar(
'1deg_jra55_iaf_omip2_cycle6',
variable='sea_level',
session=session,
frequency='1 monthly',
start_time='2000-01', end_time='2001-12',
chunks='auto'
)
I get this error:
File /g/data/hh5/public/apps/miniconda3/envs/analysis3-23.07/lib/python3.10/site-packages/cosima_cookbook/querying.py:385, in getvar(expt, variable, session, ncfile, start_time, end_time, n, frequency, attrs, attrs_unique, return_dataset, **kwargs)
383 chunks = xr_kwargs.get("chunks", None)
384 if chunks is not None:
--> 385 missing_chunk_dims = set(chunks.keys()) - set(da.dims)
386 if len(missing_chunk_dims) > 0:
387 logging.warning(
388 f"chunking along dimensions {missing_chunk_dims} is not possible. Available dimensions for chunking are {set(da.dims)}"
389 )
AttributeError: 'str' object has no attribute 'keys'
However, chunks='auto'
should be a valid key word argument to be passed to xr.open_mfdataset()
.
Per https://github.com/COSIMA/cosima-recipes/pull/305, it may be better to remove all chunking done by the cookbook, and use the xarray defaults (which are good now)