-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Hi All,
I am currently testing opening a SPol Radar data from https://data.eol.ucar.edu/dataset/342655. The file can be open fine when using the xarray cfradial1 engine or PyART but encounter the following error when doing xd.io.open_cfradial1_datatree(file)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/test_xradar/.venv/lib/python3.11/site-packages/xarray/core/dataset.py", line 5606, in unstack
result = result._unstack_once(d, stacked_indexes[d], fill_value, sparse)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/test_xradar/.venv/lib/python3.11/site-packages/xarray/core/dataset.py", line 5426, in _unstack_once
new_indexes, clean_index = index.unstack()
^^^^^^^^^^^^^^^
File "/test_xradar/.venv/lib/python3.11/site-packages/xarray/core/indexes.py", line 1131, in unstack
raise ValueError(
ValueError: Cannot unstack MultiIndex containing duplicates. Make sure entries are unique, e.g., by calling ``.drop_duplicates('n_points')``, before unstacking.The traceback error point to the following line of unstacking
xradar/xradar/io/backends/cfradial1.py
Lines 177 to 183 in 727434c
| rslice = slice(0, current_ray_n_gates[0].values.astype(int)) | |
| ds = ds.isel(range=rslice) | |
| ds = ds.isel(n_points=nslice) | |
| ds_vars = ds[data_vars] | |
| ds_vars = merge([ds_vars, ds[[dim0, "range"]]], compat="no_conflicts") | |
| ds_vars = ds_vars.stack(n_points=[dim0, "range"]) | |
| ds_vars = ds_vars.unstack("n_points") |
And like the error mentioned the stacked dim elevation in the previous line does have duplicate values shown below
which resulted in the error of unable to unstack. Is the dimension here rarely or should not have duplicate values? Thank you all!
Metadata
Metadata
Assignees
Labels
No labels