-
Notifications
You must be signed in to change notification settings - Fork 178
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
CRS: CF grid_mapping attribute to encoding #1084
Comments
Note: This requires Python 3.7+ and xarray 0.17+ |
@snowman2 these are all pretty long threads. Can I ask you to summarize what would you like to propose? I'm open to a suggestion to
I'm not too keen to drop coords-based |
The only change is to store rds.encoding["grid_mapping"] = "spatial_ref" |
This PR is how rioxarray handled it: corteva/rioxarray#284 |
I agree with you 💯 |
Is this about data var attributes only or x,y coords too? |
datacube-core/datacube/api/core.py Lines 465 to 473 in 80d466a
datacube-core/datacube/utils/geometry/_base.py Lines 1458 to 1462 in 80d466a
|
Should just be for the data vars. |
Remembered this today with something else I was working on. Is this a change you would like to see? |
@snowman2 I forgot about this one. Ideally I would like to see this code taken out into a separate library under opendatacube org, as you were suggesting previously, it would make it easier to iterate on. Looks like this work might be done under https://github.com/opendatacube/odc-tools/projects/2, as there is interest in decoupling data loading code from collection management. Moving geometry handling code out into a standalone library would be a first step toward that goal. I'm yet to write an "Enhancement Proposal" for that task though. I'm thinking of doing some serious git history surgery on datacube repo to get geometry code and tests into a separate lib while keeping original authorship and history. Followed up by changing datacube to depend on that lib instead of internal implementation. I believe this a more promising approach, that still delivers tangible benefits, than currently stalled datacube 2.0 effort. cc: @gadomski |
Sounds great 👍. |
For background @Kirill888 we used git-filter-repo when we broke out the stactools subpackages (stac-utils/stactools#111), and it worked well for us. Relevant line here: https://gist.github.com/gadomski/a0ab8d18f56ff34454d2ed890d234534#file-extract_stactools_subpackage-sh-L21. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Ping to leave open. |
@snowman2 I pinned this so it won't expire. I'm starting the work of extracting
So it will take a while before |
I believe that this is addressed by #1424 |
Related to:
.geobox
property #837decode_coords
corteva/rioxarray#282Apparently it is not CF-compliant to store the CRS
grid_mapping
as a coordinate. However, it is desirable to keep it in the xarraycoords
as it persists better. The workaround is to store thegrid_mapping
in the encoding instead of attrs andto_netcdf
will take care of the rest when writing to a netCDF file.The text was updated successfully, but these errors were encountered: