xarray-sentinel icon indicating copy to clipboard operation
xarray-sentinel copied to clipboard

Make line-pixel coordinates consistent

Open corrado9999 opened this issue 3 years ago • 2 comments

rioxarray returns fractional line-pixel coordinates (0.5, 1.5, ...), probably under the assumption that values are referred to the centre of the pixel. On the other hand, the calibration dataset (and others) directly uses the line-pixel coordinates reported in the XML, which are referred to integer positions.

Sentinel TIFFs actually report the PixelIsArea flag, thus, according to the standard, the "first" coordinate refers to the UL corner of the UL pixel. Thus, this could be an issue of rioxarray, that does not correctly apply such piece of information (incriminated code here).

However, I believe we should all agree in advance that we want such behaviour. In particular, I do not know the CF conventions interpret coordinates and, as such, how e.g. the extent of the image would be interpreted.

corrado9999 avatar May 25 '21 22:05 corrado9999

My fault, I found this issue some time ago and I worked around it, but when I updated my working copy I forgot to update my test code. However I think two things still holds:

  1. rioxarray is not correctly handling tiff information, I am opening an issue there
  2. is there some way to propagate such information into the CF conventions, or shall we manage this in some special way?

corrado9999 avatar May 26 '21 06:05 corrado9999

Note that the CF Conventions 1.9 state:

If bounds are not provided, an application might reasonably assume the gridpoints to be at the centers of the cells, but we do not require that in this standard.

We need to double check that this is the case for all our variables.

alexamici avatar Jan 05 '22 07:01 alexamici