-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dem gridded_data shifted coordinates #1682
Conversation
Here the PR for salem fmaussion/salem#234 |
oggm/tests/test_prepro.py
Outdated
assert np.allclose(gridded_topo.data, gtiff_ds.data) | ||
|
||
# compare coordinates of topo.tif with dem.tif | ||
demtiff_ds = salem.open_xr_dataset(gdir.get_filepath('dem')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we try to avoid using salem here, but use rioxarray instead? It might be possible to use rioxarray to open but still use salem's accessor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can use rioxarray to open the tiff files and compare the coordinates, I will change this. But I can not use salem's accessor because their is no variable .pyproj_srs
added to the dataset when opening with rioxarray.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK yes I hoped that the coords would be enough, but indeed the proj info is missing - no worries, that's enough as is for now.
Ok, now the tiff-files are opened with rioxarray and this PR is now independent of the bug in salem and can be merged if all tests pass. |
It seems that for the minimal test |
Sorry for the mess @pat-schmitt - just ignore and keep it simple, as long as it worked locally we should be good to go |
Yes, it also worked with the other containers, so it is ready to merge. However, we should add |
Yes sorry I was not clear: adding rioxarray to minimal defies the purpose of the minimal environment (which is to have no GIS library in it). To this test should rather be moved to tests_prepro, or altered/commented for simplicity. |
I used now |
Thanks @pat-schmitt ! And sorry for the confusion |
This fixes a coordinate shift between
dem.tif
and thegridded_data.nc
.However, there seems to be a bug in salem when opening a .tif-file using
ds = salem.open_xr_dataset(tiff_path)
and callingds.salem.grid
afterwards. I will open a PR for salem and link it here.Due to this bug, one test is currently not working and I commented it out. After salem is fixed the test can be uncommented again (and maybe adapted due to floating point problems...).
Closes #1679
whats-new.rst