digitalearthpacific / dep-coastlines

GNU General Public License v3.0
3 stars 1 forks source link

Possible shift issue #25

Open jessjaco opened 1 year ago

jessjaco commented 1 year ago

I noticed that odc.stac.load and stackstac.stack seem to have coords which differ by 15 meters (on a 30-m resolution). I found the xy_coords parameter to stackstac.stack which needs further investigation. Basically you can either load x y coordinates as top left or center of each pixel.

jessjaco commented 7 months ago

After exhaustive testing, it appears using odc.stac.load with anchor=odc.geo.geobox.AnchorEnum.CENTER or anchor=odc.geo.geobox.AnchorEnum.FLOATING is the only thing that preserves the grid on write using odc.geo.xr.write_cog or rio.to_raster. rioxarray.open_rasterio also works. It appears that stackstac does not load the data correctly, using xy_coords="top_center" or xy_coords="center". The latter is the closest, but appears to shift data by a full cell.

We also need to check out clipping

jessjaco commented 6 months ago

Here's a complication. If the anchor option is not set to center as described above things appear to always be resampled, even if the resolution and projection etc. are the same. So basically other coastline datasets were never using the raw data, as far as I can tell, it was always smoothed.