Closed alexgleith closed 4 months ago
You are calculating coordinates from an affine transform, then calculating the affine transform back from the coordinates. Why would you expect this round trip conversion to be exact?
Why would you expect this round trip conversion to be exact?
It is exact, and in previous versions, it applied to the dataarrays as well as the dataset. I'm saying that it's no longer working on the individual dataarrays.
To be more complete, the inferred coordinates from the NetCDF are messy (i.e., numbers like 0.010009765625
). Providing a specific transform and computing coordinates leads to them being exact, and my intent is to write a COG with this exact affine transform defining the coordinates. This did work prior to 0.4.5
and I think it's changed in that release... haven't looked at the code though to find out where it might be.
Ah OK, yes, NetCDF's raster representation is a poor match for xarray, odc-geo, GeoTiff, Zarr, and generally the rest of the ecosystem.
@alexgleith does this work when coords are assigned per variable? are the coords on patched data variables as you expect? what's the meaning of reindex and why it's needed?
Oh, it's my mistake actually... not naming the x/y dims right 🤦
Updating coordiantes works at the dataset level, but isn't reflected in the arrays.
Reproduce with the below code using
odc-geo==0.4.5