-
Notifications
You must be signed in to change notification settings - Fork 83
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
Treatment of AREA_OR_POINT
#805
Comments
https://gdal.org/en/latest/user/raster_data_model.html
|
Thanks for the quick answer @snowman2 ! I interpret your answer as saying: coordinates should stay the same in the in-memory xarray dataset both cases. The only difference is how they are then intepreted. It's up to the user to make the right choice. Am I interpreting it correctly? To me, this makes the docstring for open_rasterio quite confusing, specifically:
I read that as: in-memory representation's coordinates always represent the center of the pixel. That seems to me in direct contradiction with the above, where in the More relevant links for future visitors:
|
That refers to coordinate values stored in the But I agree "shifted" is probably not the best word to use to describe it. |
Thank you @Kirill888 for the answer. We've seen that, for both
You also mention
Then what does change? I'm failing to see any difference between files with |
The difference is in what transform is stored in the geotiff tags inside the file. By the time rasterio library sees the transform it has been normalised by gdal to be equivalent to “area mode”. It’s really just a quirk of geotiff spec. |
I see. And it's something that even If that's the case, then I think that the line
is likely to lead people astray rather then help. It has done that for me and a handful of other people I've asked and the area/point distinction seems to even have managed to confuse the author of the GDAL code. If this transformation is truly an implementation detail that GDAL takes care of then I'd say rioxarray does not need to refer to it. I can see value in saying something like
This clarifies the meaning of the coordinates without sending them into a rabbit hole that ultimately doesn't help them. What do you think @snowman2? Happy to open a PR. |
Yes, a PR with clarification is welcome. |
see corteva#805 for discussion
* docs(_io.py): clearer docstring see #805 for discussion * docs(_io.py): add back "automatically" * style(_io.py): trim whitespace
Code Sample & Problem description
I have two sample file that only differ on their
AREA_OR_POINT
specification (sample_tifs.zip)when I read them, I would expect the coordinates of one of those to be shifted, as mentioned in the docstring for open_rasterio (link):
However, I don't observe this behaviour
How were the files created: I have taken a sample of SRTM data and have altered the metadata property using
gdal_edit
❯ cp pixel-is-point-sub.tif pixel-is-area-sub.tif ❯ gdal_edit -mo "AREA_OR_POINT=Area" pixel-is-area-sub.tif
Am I doing something wrong here, or have I misunderstood the
AREA_OR_POINT
property?Expected Output
I expected the coordinates to be shifted for one of the options and thus differ between them.
Perhaps that expectation is wrong and the coordinates are simply always shited to the same location with rioxarray. But then it would suggest to me that for
PixelIsPoint
(Raster Space docs), the coordinates, as read by rioxarray, are actually half a pixel away from where the point was sampled, which would be surprising to me.I may have also potentially created the files in the wrong way.
Environment Information
Installation method
Conda
Conda environment information (if you installed with conda):
Environment (
conda list
):keywords for easy search in the future:
Raster Space
,GTRasterTypeGeoKey
,PIXEL_OR_AREA
,PixelIsArea
,PixelIsPoint
,pixelCenter
The text was updated successfully, but these errors were encountered: