-
Notifications
You must be signed in to change notification settings - Fork 85
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
xarray.Dataset.reproject
doesn't modify the crs attribute
#488
Comments
Check: See: https://corteva.github.io/rioxarray/stable/getting_started/crs_management.html |
|
It looks like the rioxarray/rioxarray/raster_array.py Lines 64 to 65 in 2888deb
rioxarray/rioxarray/raster_array.py Line 428 in 2888deb
However, it keeps all attributes on the Dataset object: rioxarray/rioxarray/raster_dataset.py Line 107 in 2888deb
|
What were your thoughts on what to add & where to put it? |
I presume there is a high risk of breaking existing code if the behaviors described above are changed to have the
In my opinion implementing any combination of three points above would reduce the potential for confusion from new users as myself. There is also the question of rasterio modifying the CRS causing |
Actually, I think this change would be a welcome one to remove the potentially conflicting attributes on the Dataset. Only the attributes on the DataArray has been considered so far as it was what was returned by If you feel up to it, a PR would be welcome to update this functionality. |
I'll give it a go |
One potential solution could be to remove rioxarray/rioxarray/rioxarray.py Line 385 in 2888deb
|
I was thinking on just making sure that |
I am glad you clarified that. Reasons why writing the
For users who don't use |
I made a tiny pull request. Instead of modifying |
* BUG: use rasterio CRS or rioxarray CRS in open_rasterio Co-authored-by: snowman2 <alansnow21@gmail.com>
Code Sample, a copy-pastable example if possible
The code above prints
Problem description
I would expect that the dataset being output after the reprojection has a modified CRS. Since this is not happening the reality of the data and the metadata are out of sync causing problems downstream. This behaviour is also observed on
merge_datasets
which will generate a dataset with nominally the CRS of the first dataset that it received, regardless of thecrs
parameter.That being said, the output looks as it has been correctly reprojected.
Expected Output
A reprojected dataset with a CRS modified to be that of the destiny CRS.
Environment Information
rioxarray (0.10.2) deps:
rasterio: 1.2.10
xarray: 2022.3.0
GDAL: 3.3.2
Other python deps:
scipy: 1.7.1
pyproj: 3.2.1
System:
python: 3.9.7 (default, Sep 15 2021, 08:09:16) [GCC 10.3.0]
executable: /home/guillem/.pyenv/versions/3.9.7/envs/GISEnv/bin/python3.9
machine: Linux-5.11.0-7633-generic-x86_64-with-glibc2.33
Installation method
The text was updated successfully, but these errors were encountered: