SciTools / iris

A powerful, format-agnostic, and community-driven Python package for analysing and visualising Earth science data
https://scitools-iris.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
635 stars 284 forks source link

Allow creation of area weights for Lambert Conformal Grids #4812

Open nhsavage opened 2 years ago

nhsavage commented 2 years ago

✨ Feature Request

iris.analysis.cartography.area_weights should work for cubes on a Lambert Conformal Grid

Motivation

at the current time, the iris.analysis.cartography.area_weights function only supports spherical geometries (regular lat/lon and rotated pole). Many regional climate models (and other related data) are on other projections. One common example for Europe is the Lambert conformal grid which is used by the REGCM climate model for Europe

Additional context

documentation for iris.analysis.cartography.area_weights states The cube must have coordinates ‘latitude’ and ‘longitude’ with bounds.
trexfeathers commented 2 years ago

Thanks @nhsavage. We've discussed this in the @SciTools/peloton and we expect it would be non-trivial! If you know that this would be widely used, please encourage people to vote so that we know it's worth it!

bjlittle commented 2 years ago

@nhsavage Do you have some example lambert conformal grid data that you could share with me? 😄

bjlittle commented 2 years ago

Related to https://github.com/SciTools-incubator/iris-esmf-regrid/pull/198

nhsavage commented 2 years ago

sample data at /data/users/fris/REGCM/EAS-22/tas_EAS-22_NCC-NorESM1-M_historical_r1i1p1_ICTP-RegCM4-4_v0_mon_199101-200012.nc

nhsavage commented 2 years ago

see also https://github.com/ESMValGroup/ESMValCore/issues/1156

bjlittle commented 1 year ago

@nhsavage Do you know if there is a mathematical formula for calculating the area of a cell in the Lambert Conformal projection ?

Also, do you have a deadline for a resolution to this issue ? That would help us prioritise on this end, thanks.

(ping @ehogan)

nhsavage commented 1 year ago

I am sure there is a formula but I don't have a reference for it. I couldn't find anything with a quick Google.

nhsavage commented 1 year ago

CDO is able to do this, but it doesn't give a reference. http://www.idris.fr/media/ada/cdo.pdf 2.15.3. GRIDCELL - Grid cell quantities

I guess the source code might contain some clues. https://code.mpimet.mpg.de/attachments/29019 file is src/grid_area.cc

I guess if push comes to shove, for ESMValTool we could perhaps use this to make a grid cell area file if it is missing

nhsavage commented 1 year ago

as for deadline - there is no specific date. While this issue remains unresovled, people are unable to use ESMValTool for analysis of data with Lambert conformal conic grids. This means they find alternative solutions (regridding to a lat/lon grid, using a different tool). This menas there is no specific deadline

nhsavage commented 12 months ago

Another thing to consider here is that there are multiple projected coordinate systems in use in CORDEX data and so a generic solution would be better if we could come up with one. We don't need areas as such, only area weights. Could this funciton from ESMPy help? https://earthsystemmodeling.org/esmpy_doc/release/ESMF_8_0_1/html/field.html#ESMF.api.field.Field.get_area

stephenworsley commented 12 months ago

@nhsavage I suspect ESMPy could get you close to the area weights, but I imagine there would be a slight difference between the weights ESMPy gives you and the "proper" weights due to the difference what counts as a straight line between two points in a given projection and what counts in ESMF (always a great circle arc). If such an answer would be close enough, there could be a case for adding this as a feature to iris-esmf-regrid in order to keep the iris dependencies minimal.

stephenworsley commented 12 months ago

As mentioned here https://github.com/ESMValGroup/ESMValCore/issues/1156#issuecomment-1840648041, there may be a solution possible via iris-esmf-regrid. If this solution works, this would become less of a priority in Iris, though it would still be good to have a solution in Iris if we were able to get better accuracy by using explicit fomulae.