-
Notifications
You must be signed in to change notification settings - Fork 10
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
Understanding concerns with CF encoding of CRS #20
Comments
What are you surprised by? Most of what's in there is as would be expected per: This page provides a fairly complete set of mappings: "spatial_ref" does not appear in the CF convention but has been around in the community for a while. Someone implemented it quite a few years ago and it's been adopted in a number of places. "_ARRAY_DIMENSIONS" is presumably being added by xarray? |
That's not my point. I'm just trying to understand why there is a concern (discussed many times during the meeting) with this CF way of encoding CRS while GDAL/Xarray seems to generate it without problem when converting a GeoTiff to Zarr. Why do we want to change this ? |
The rub is the need to implement a cross walk between the CRS-WKT / EPSG representation of CRS and the grid_mapping representation of CRS. The CF-NetCDF requires that you include parameters using the attribute specification from cf that duplicate what most geospatial software supports via PROJ. I think the premise here is that we would be saying that |
Jumping in on this issue after this spec repository was pointed out to me. I'm the creator of the very very new geoxarray package which basically tries to take all the non-GDAL specific CRS and dimension/coordinate information functionality from rioxarray but without the GDAL/rasterio dependency. It is also meant to be more generic than rioxarray. Anyway, I wanted to chime in with some information from my understanding having working on a similar issue in geoxarray. First, my understanding is that There is also the case of projections that aren't supported by CF. In those cases Pyproj (and therefore rioxarray and geoxarray) will only produce the |
Great info. Thanks @djhoese -- UW Madison representing here, I love it! (I'm an '09 Civil Engineering grad) |
I want to take this good news of a new expert partipating to summarize the question for novices like me. Please correct me if I'm wrong. CF conventions (v1.10) allow to define the CRS implicitly as the geographic coordinate system based on a spherical Earth (so not WGS 84 ellipsoid) when declaring the This
Note: My conclusion From my understanding, CF advocates for using its standard properties to express any type of representation (WKT, PROJ.4, etc.). Since we want to base GeoZarr on CF, I would lean towards making the |
Another useful information reported by Roger Lott (OGC CRS SWG co-chair):
|
This solves a decent part of the original concern around the original issue (christophenoel#3) just to mention it here. I just want to make sure I'm understanding a few things:
The reason I bring this up specifically is we've been outputting Zarr from our geospatial system for the last few years and all of the CRS information is specified as EPSG Code, WKT, or ProjJSON. Unless there's a way to always (and reliably!) map from CRS-WKT to CF, supporting GeoZarr would be a nonstarter for us, but we'd VERY much like to adopt GeoZarr. Any thoughts on this? |
Speaking from a user POV and not on the "standards"/specification design side of this: I would plan/hope to use the pyproj library in all of my Python code to do conversions between PROJ.4/WKT2/EPSG/CF. Not sure that is considered "straightforward" though. I would hope that the issue in your point 1 above could be resolved in the future by suggesting to CF to adopt crs_wkt as an alternative to the CF grid mapping attributes (either the attributes or the crs_wkt or both with priority going to crs_wkt). I don't know how open they would be to that but the fact that not every projection is supported currently would make putting the responsibility on WKT more enticing. Similarly, add the functionality to GDAL to read crs_wkt in addition to the already supported spatial_ref. |
That's really the root of the rub here (correct me if I'm wrong): I can represent any CF grid mapping as WKT but not vice versa. |
@christophenoel -- I don't think that this is quite accurate.
This closed issue cf-convention/cf-conventions#410 indicates that there "is no default shape for the Earth in CF (spherical or otherwise)." |
I would be in full support of mandating grid mapping and allowing use of only a |
And to underscore @christophenoel's note above, RECOMMENDING that everyone also provide crs_wkt to ensure maximum interoperability. |
Does it has any impact (on a user point of view) of is it only a question of definition "geographic coordinate system based on a Earth" ? |
The impact from a user's point of view is that when given no |
Thank you very much for trying to explain. I think that my gaps in the geospatial field could lead to an endless discussion... For me, if we provide latitude/longitude in degrees, I expect to be able to navigate on Earth based on the real shape of our Earth. So it works for a single point, however, I assume that you're suggesting that the gridded data is projected in any case, so we should know the exact projection (e.g. WGS84) to be able to interpret the data correctly. |
I could be misunderstanding what you're saying or asking, but there is no "real shape of our Earth" when it comes to this stuff. You must have some definition/model of the Earth (a coordinate system) or else you have no guarantee that degrees (lon/lat) in your data are the same as the degrees (lon/lat) of someone else's data (different radius of the Earth, different "center" point of the coordinate system, etc). Software could always make an assumption or have some default Earth for a geographic (degrees) coordinate system, but if we're talking about accuracy then there is no guarantee unless it is explicitly defined. In my opinion nothing should be implied for new data file formats and everything should be explicit. |
Exactly @djhoese. @christophenoel -- every (lat/lon or projected) coordinate that references the earth must either declare (explicit) or assume (implicit) an earth spheroid model upon which the latitude / longitude coordinate system is defined. The GPS system is based around the WGS84 geodetic datum. Note that it is common practice in some fields (weather and climate in particular) to use different earth models interchangeably. i.e. use weather stations with elliptical lat/lon as if they use a spherical earth assumption. This practice has |
Okay, understood. There's no notion of degrees without a model. Intuitively, when I think of degrees, it's implicitly WGS84, which assumes an ellipsoid. So, to get back to a your statement, I get that CF doesn't guarantee that WGS84 is presupposed. |
Just wanted to circle back on this topic - what's the timeline look like for discussing/implementing some of these changes around CRS? Is there a general consensus about supporting crs_wkt in GeoZarr? |
@dwilson1988 : When the SWG is approved by the OGC, a specification document (following OGC standards) will be created with the necessary structure, allowing anyone interested to collaborate on topics of their choice. However, nothing prevents someone from starting work on the tickets or in the repository |
I haven't followed what GeoZarr has decided regarding CRS encoding, but FYI GDAL 3.9 per OSGeo/gdal#9108 will be able to infer CRS in a Zarr dataset using a CF-1 grid_mapping variable (basically raw conversion of netCDF CF-1 to Zarr) |
This is good news, and I assume that the library supports all the extensions such as: The meetings were interrupted for several months to create the OGC SWG, and they will resume this week. |
As it has been reported multiple times that the CF encoding of CRS (Coordinate Reference System) may pose issues, I propose starting a dedicated thread to gain a better understanding of these concerns.
Furthermore, I recently converted TerraSAR GeoTiff to Zarr, using rioxarray in conjunction with gdal and xarray, which resulted in the following CF grid mapping. I am somewhat surprised by the way GDAL encoded the CRS, which could be a result of the combination of gdal with xarray.
EDIT NOTE: A key topic of this discussion concerns the need to make grid_mapping mandatory in order to exclude the possibility of having an implicit (undefined) CRS. Furthermore, grid_mapping includes several formats, and it would be wise to recommend one of them (WKT, Proj4j, ...).
The text was updated successfully, but these errors were encountered: