Skip to content
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

Support CRS datum information #4619

Closed
vsherratt opened this issue Mar 3, 2022 · 6 comments · Fixed by #4704
Closed

Support CRS datum information #4619

vsherratt opened this issue Mar 3, 2022 · 6 comments · Fixed by #4704

Comments

@vsherratt
Copy link
Contributor

vsherratt commented Mar 3, 2022

✨ Feature Request

Support for the datum attribute of a coordinate reference system.

Motivation

Higher resolution modelling is now revealing slight discrepancies when transforming between different coordinate systems. Through various discussions, including on met office yammer, the key underlying issue appears to be that iris.coord_system.CoordSystem has no concept of a "datum", so are therefore missing information about positions on the surface of the earth relative to an ellipsoid (see this document for details).

It seems that the easiest way to support this, from where iris currently stands is to:

  • Add a datum attribute to iris.coord_system.CoordSystem subclasses.

  • Modify these methods to pass the datum to cartopy.

    Most code that does any kind of coordinate transformation with iris (including plotting and regridding) goes via at least one of these methods, either explicitly or implicitly, so fixing it here is crucial. Cartopy can handle datum shifts (it uses PROJ via pyproj, which does support this), but it is (almost) never told about the datum by iris.

  • Allow loading this from a file. The CF conventions do specify how to represent a datum in a netCDF file. Though I suspect that many files in practice do not have this information, so it should also be easy for the user to set one manually, and ideally this should be made clear in the documentation somewhere.

  • Ensure the new datum information is saved to a (netCDF) file, to minimise the chance of related issues arising in the future.

@nhsavage
Copy link
Contributor

nhsavage commented Mar 3, 2022

I have an example notebook which should help demonstrate the issue and hopefully also help test a fix (there are a few caveats that need to explain, so I will bring it to surgery later)

@bjlittle
Copy link
Member

bjlittle commented Mar 3, 2022

When #4617 lands, then we'll have votable issues 🚀

So up-voting this issue really does matter 😄

And will really help us prioritise and focus on issues that the community really wants us to solved.

@bjwheltor
Copy link

CF support for a datum is mentioned in the description above, but it does not explicitly mention that the CF Convention optional grid mapping attribute called crs_wkt, which may be used to specify multiple coordinate system properties in so-called well-known text format (usually abbreviated to CRS WKT or OGC WKT) - see 5.6.1. Use of the CRS Well-known Text Format. Might this not be useful to include support in Iris for this? Although it is rather unwieldy, it does allow comprehensive description of the CRS.

Having come late to this, apologies if I'm missed the subtleties of this request.

@nhsavage
Copy link
Contributor

Might this not be useful to include support in Iris for this? Although it is rather unwieldy, it does allow comprehensive description of the CRS.
I think that is a really good thing to aim for. However, I believe that the long term aim is to use PyProj directly in Iris to store CRS info. I think that supporting WKS would probably need to wait for that to be implemented, whereas as this ticket is a stop-gap solution to fix the biggest current source of problem. Please can someone say if I have got this wrong?

@bjwheltor
Copy link

@nhsavage - thanks for the clarification. I'd assumed that it might be easiest to include 'crs_wkt' as it's just text, but that's assuming you treat it as a 'blob', whereas I think you're suggested this this should be handled more intelligently in Iris, which would be great!

@trexfeathers
Copy link
Contributor

#4643 would be a solution to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants