ClimateImpactLab/pyCIAM

Index Error in create-diaz-pyCIAM-inputs.ipynb

treypallace opened this issue · 1 comments

# correct greenland
out["vsl"] = out.vsl.where(
    ~ds_in.subsets.sel(subset="greenland", drop=True),
    (
        ds_in.vsl_ypc_mult
        * ds_in.ypc.sel(country="USA", drop=True)
        * (
            out.ypc.isel(seg=ds_in.subsets.sel(subset="greenland", drop=True))
            / ds_in.ypc.sel(country="USA", drop=True)
        )
        ** ds_in.vsl_inc_elast
    ).reindex(seg=out.seg),
)

This particular line out.ypc.isel(seg=ds_in.subsets.sel(subset="greenland", drop=True)) results in:

IndexError: dimension coordinate 'seg' conflicts between indexed and indexing objects:
array(['Albania489', 'Albania489', 'Albania489', ..., 'Albania489',
'Albania489', 'Albania489'], dtype='
array(['Albania489', 'Albania490', 'Albania491', ..., 'Yemen9422', 'Yemen9423',
'Yugoslavia488'], dtype='

I am looking for suggestions on how to resolve this. I was able to successfully download the required data using the data-acquisition.ipynb and also ran collapse-sliiders-to-seg.ipynb with no issues.

Hi, @treypallace. Nice catch - it looks like somehow the upload of the raw Diaz inputs zarr was corrupted such that the subsets variable was int8 rather than bool dtype. I think this was causing your above issue. I've posted a new version of the Zenodo deposit with a fixed version of this file and updated the data-acquisition file to point to this new version. Hopefully, that resolves your issue. If so, could you close this issue? If not, let me know.