GEOS-ESM / MAPL

MAPL is a foundation layer of the GEOS architecture, whose original purpose is to supplement the Earth System Modeling Framework (ESMF)
https://geos-esm.github.io/MAPL/
Apache License 2.0
27 stars 18 forks source link

Improper vertical flipping of input files with dimensionless vertical pressure grid #3041

Open lizziel opened 1 day ago

lizziel commented 1 day ago

I encountered a silent bug in GCHP where GEOS-Chem Classic output files read into MAPL do not have the proper vertical orientation in the imports. I traced the problem to reliance on the positive attribute in the file rather than the lev coordinate values. The GEOS-Chem Classic output files use a dimensionless hybrid sigma pressure coordinate which is similar to a pressure grid in that coordinate values decrease in the up direction. These files should be handled as containing pressure coordinates in ExtData for proper vertical flipping.

ExtData currently has handling for pressure coordinates with the criteria that lev units are 'hpa' or 'pa'. However, it does not detect if the coordinates are pressure with a different unit or if the coordinates are a dimensionless pressure proxy.

To fix this I added functionality to the old version of MAPL in GCHP to (1) extend the lev unit criteria for pressure to include 'sigma_level', and (2) also check the lev standard_name attribute to determine if it equal to one of the dimensionless pressure proxy grids defined in CF.

Is this something that you want to bring into MAPL? My PR is at https://github.com/geoschem/MAPL/pull/37. Because this is off an old version of MAPL I had to add retrieval of standard_name to metadata utilities. I see in latest develop that is now an available feature. That limits the update to just ExtData and ExtData2G (nearly identical updates in both). I can create a PR on develop if you would like me to submit this.

bena-nasa commented 1 day ago

Hi @lizziel I will take a look. Note that I am actively working on getting vertical regridding into ExtData2G. So I am going to have to be must more strict (following the CF conventions) about the file metadata to support this. We could take this into the old ExtData, but I would say no point for now in the new since I'll be redoing a lot of this, hopefully so this sort of issue will be addressed.

lizziel commented 1 day ago

Thanks @bena-nasa. The grid we are using is one of the CF grids listed at https://cfconventions.org/Data/cf-conventions/cf-conventions-1.0/build/apd.html. According to the CF conventions, units for the dimensionless vertical coordinates can simply be 'level' which would be inadequate for determining whether to flip, hence I branched out to standard_name. Those units will also be deprecated but will hang around in old files.

When updating ExtData2G could you make sure these sorts of things are taken into account? I'm happy to discuss specific instances of the metadata.