You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Currently it is possible to get a dataset identified only by name with a more concise DataID with name and for example resolution. This is also relevant for DataID in Scene testing and dataset deletion (see code examples below).
A __setitem__ operation with a more specific DataID does not overwrite the dataset with a less specific DataID which is good but the DataID added to the dependency_tree is wrong.
To Reproduce
fromsatpy.tests.utilsimportmake_dataidscene=Scene()
scene['1'] =ds1=xr.DataArray(np.arange(5))
dataid=make_dataid(name='1', resolution=2000)
print(dataidinscene) # => True should be Falsescene[dataid] # => returns ds1 but should return KeyErrordelscene[dataid]
print(scene) # => should not be emptyscene['1'] =ds1=xr.DataArray(np.arange(5))
print(scene._dependency_tree)
scene[dataid] =ds2=xr.DataArray(np.arange(5, 10))
print(scene._dependency_tree)
Expected behavior
See code example.
Environment Info:
OS: Linux
Satpy Version: main branch
PyResample Version: 1.26.0
Additional context
As far as I can see this behaviour is due to the get_key method in DatasetDict (
Describe the bug
Currently it is possible to get a dataset identified only by name with a more concise
DataID
with name and for example resolution. This is also relevant forDataID
in Scene testing and dataset deletion (see code examples below).A
__setitem__
operation with a more specificDataID
does not overwrite the dataset with a less specificDataID
which is good but theDataID
added to the dependency_tree is wrong.To Reproduce
Expected behavior
See code example.
Environment Info:
Additional context
As far as I can see this behaviour is due to the
get_key
method inDatasetDict
(satpy/satpy/dataset/data_dict.py
Line 142 in cfe4fa9
The text was updated successfully, but these errors were encountered: