jbusecke / xMIP

Analysis ready CMIP6 data in python the easy way with pangeo tools.
https://cmip6-preprocessing.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
193 stars 41 forks source link

Add "nvertices" to renaming dict #357

Closed jbusecke closed 3 weeks ago

jbusecke commented 3 weeks ago
jbusecke commented 3 weeks ago

I am getting a new warnning for this:

from xmip.preprocessing import combined_preprocessing

url = "https://storage.googleapis.com/cmip6/cmip6-pgf-ingestion-test/catalog/catalog.json" 
col = intake.open_esm_datastore(url)
cat_ice = col.search(source_id=source_ids, experiment_id='piControl', table_id='SImon', grid_label='gn', variable_id=['sithick', 'siconc'])
ddict_ice = cat_ice.to_dataset_dict(aggregate=False, preprocess=combined_preprocessing)

gives:

[/srv/conda/envs/notebook/lib/python3.11/site-packages/xmip/preprocessing.py:79](https://leap.2i2c.cloud/srv/conda/envs/notebook/lib/python3.11/site-packages/xmip/preprocessing.py#line=78): UserWarning: rename 'nj' to 'y' does not create an index anymore. Try using swap_dims instead or use set_index after rename to create an indexed coordinate.
  da = da.rename({di: target}).set_xindex(target)
[/srv/conda/envs/notebook/lib/python3.11/site-packages/xmip/preprocessing.py:79](https://leap.2i2c.cloud/srv/conda/envs/notebook/lib/python3.11/site-packages/xmip/preprocessing.py#line=78): UserWarning: rename 'ni' to 'x' does not create an index anymore. Try using swap_dims instead or use set_index after rename to create an indexed coordinate.
  da = da.rename({di: target}).set_xindex(target)
[/srv/conda/envs/notebook/lib/python3.11/site-packages/xmip/preprocessing.py:79](https://leap.2i2c.cloud/srv/conda/envs/notebook/lib/python3.11/site-packages/xmip/preprocessing.py#line=78): UserWarning: rename 'nj' to 'y' does not create an index anymore. Try using swap_dims instead or use set_index after rename to create an indexed coordinate.
  da = da.rename({di: target}).set_xindex(target)
[/srv/conda/envs/notebook/lib/python3.11/site-packages/xmip/preprocessing.py:79](https://leap.2i2c.cloud/srv/conda/envs/notebook/lib/python3.11/site-packages/xmip/preprocessing.py#line=78): UserWarning: rename 'ni' to 'x' does not create an index anymore. Try using swap_dims instead or use set_index after rename to create an indexed coordinate.
  da = da.rename({di: target}).set_xindex(target)

I think this is not bad but might be nice to get rid of this warning by properly using swap dims?