-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Example documentation in open_rasterio #5005
Comments
Thanks @gabriel-abrahao good catch! the docs are definitely outdated here and need to be changed. This has been brought up before here #3185 (comment) You can either do what you suggested or simply xarray/xarray/tests/test_backends.py Line 4468 in 12b4480
A PR to update the documentation would be welcome. It'd be just a one-line fix here: xarray/xarray/backends/rasterio_.py Line 179 in d2582c2
cc @snowman2 the docstring for open_rasterio has the same issue currently in rioxarray https://github.com/corteva/rioxarray/blob/63ce87f92835897d46aaa270f5ec07aca4e72cda/rioxarray/_io.py#L653 |
Thanks for mentioning that. For rioxarray, the fix is: transform = da.rio.transform() |
This is my first time submitting an issue, so sorry if doing this wrong.
In the documentation for open_rasterio there's an example on how to generate 2D coordinates from a GeoTiff file using it:
xarray/xarray/backends/rasterio_.py
Lines 177 to 181 in 37522e9
However, this method does not really work because the
da.attrs['transform']
attribute is not coded in the GDAL standard, but asaffine.Affine
expects directly (maybe it wasn't so in a previous version. So, at least for me (v0.16.2), getting the affine transformation right is done by simply replacing that line with the simpler:transform = Affine(*da.attrs['transform'])
Again, sorry if this is not how this should be done, I just took a while to figure this out for my application and thought other people might benefit from it. If I can do something to fix it (if it's really broken) please let me know.
The text was updated successfully, but these errors were encountered: