E3SM-Project / E3SM

Energy Exascale Earth System Model source code. NOTE: use "maint" branches for your work. Head of master is not validated.
https://docs.e3sm.org/E3SM
Other
349 stars 359 forks source link

ncremap normalization option for bilinear maps #5818

Closed iulian787 closed 1 year ago

iulian787 commented 1 year ago

Here are the global attributes of a current bilinear a2o map , /lcrc/group/e3sm/data/inputdata/cpl/gridmaps/ne30pg2/map_ne30pg2_to_EC30to60E2r2_bilin.201005.nc

What does normalization="destarea"means in this case ?

// global attributes:
        :title = "ESMF Offline Regridding Weight Generator" ;
        :normalization = "destarea" ;
        :map_method = "Bilinear remapping" ;
        :ESMF_regrid_method = "Bilinear" ;
        :conventions = "NCAR-CSM" ;
        :domain_a = "ne30pg2_scrip.nc" ;
        :domain_b = "EC30to60E2r2.scrip.201005.nc" ;
        :grid_file_src = "ne30pg2_scrip.nc" ;
        :grid_file_dst = "EC30to60E2r2.scrip.201005.nc" ;
        :CVS_revision = "8.0.1" ;
        :history = "Mon Oct 5 08:52:13 PDT 2020: /qfs/people/brad323/v2/compsetfiles/ncremap -a bilinear -g 
EC30to60E2r2.scrip.201005.nc -s ne30pg2_scrip.nc -m map_ne30pg2_to_EC30to60E2r2_bilin.201005.nc -W
--extrap_method nearestidavg;
ESMF_RegridWeightGen -s \"ne30pg2_scrip.nc\" -d \"EC30to60E2r2.scrip.201005.nc\"
 -w \"map_ne30pg2_to_EC30to60E2r2_bilin.201005.nc\" --method bilinear --extrap_method nearestidavg > /dev/null" ;

        :remap_script = "ncremap" ;
        :remap_command = "\'/qfs/people/brad323/v2/compsetfiles/ncremap -a bilinear -g 
EC30to60E2r2.scrip.201005.nc -s ne30pg2_scrip.nc -m map_ne30pg2_to_EC30to60E2r2_bilin.201005.nc -W 
--extrap_method nearestidavg\'" ;
        :remap_hostname = "compy-e.pnl.gov" ;
        :remap_version = "4.9.5" ;
        :NCO = "netCDF Operators version 4.9.5 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)" ;
rljacob commented 1 year ago

maybe @ambrad knows since he made this map.

ambrad commented 1 year ago

Sorry; I don't. This is just a standard ESMF bilinear map written using a basic ncremap command. normalization=destarea is very likely some option with destarea its default value, either in ESMF or in ncremap. Since this is bilin interp, it's possible this option isn't even relevant.

Very likely this Confluence page https://acme-climate.atlassian.net/wiki/spaces/COM/pages/1112047753/theta-SL-pg2+v2+integration+ne30pg2+r05+oECv3#Generate-map-files shows the script used for this and related map files.

czender commented 1 year ago

ERWG writes this :normalization = "destarea" ; attribute. I think @ambrad is right in that it only means something for conservative interpolation methods like aave. In that case it means normalize by the destination area fraction (frac_b). For bilinear interpolation it is a no-op because the area fractions are not involved in the calculation, which is equivalent to frac_b=1. The full ESMF documentation explained the attribute this way a few years ago:

frac_a: When a conservative regridding method is used, this contains the fraction of each source cell that participated in the regridding. When a non-conservative regridding method is used, this array is set to 0.0. frac_b: When a conservative regridding method is used, this contains the fraction of each destination cell that participated in the regridding. When a non-conservative regridding method is used, this array is set to 1.0 where the point participated in the regridding (i.e. was within the unmasked source grid), and 0.0 otherwise. If the first-order conservative interpolation method is specified ("-m conserve") then the destination field may need to be adjusted by the destination fraction (frac_b). This should be done if the normalization type is ``dstarea'' (sic, really "destarea") and if the destination grid extends outside the unmasked source grid. If it isn't known if the destination extends outside the source, then it doesn't hurt to apply the destination fraction. (If it doesn't extend outside, then the fraction will be 1.0 everywhere anyway.) The following code shows how to adjust an already interpolated destination field (dst_field) by the destination fraction. The variables n_b, and frac_b are from the weight file: ! Adjust destination field by fraction do i=1, n_b if (frac_b(i) .ne. 0.0) then dst_field(i)=dst_field(i)/frac_b(i) endif enddo

LMK if this is unclear or if there are more questions.

rljacob commented 1 year ago

I assume ERWG refers to ESMF_RegridWeightGen. Then we should file a bug report asking to not write this in the global attributes when the map type is bilinear. Its just confusing.

czender commented 1 year ago

Yes, ERWG refers to ESMF_RegridWeightGen. It is true that ERWG 8.4.* still adds normalization = "destarea" ; to bilinear maps, and that is confusing. I will file a bug report. However, I wouldn't be surprised if ESMF refuses the change the current behavior because of backward compatibility concerns, and because the destarea algorithm does work on bilinear maps since ERWG wrties frac_b = 1 for all gridcells, as far as I am aware.

czender commented 1 year ago

ESMF will fix this soonishly

billsacks commented 1 year ago

This is fixed on the ESMF develop branch, and this fix will appear in the ESMF 8.6.0 release this fall. Moving forward, normalization will be given as "N/A" for any non-conservative maps. Thank you for bringing this issue to our attention.

By the way, I love the "soonishly" time frame... I think that's an apt descriptor of the time frame for much of my work :-)

czender commented 1 year ago

Thanks again, Bill. Hopefully TempestRemap will adopt the same convention for any non-conservative maps. @iulian787 can we close this issue soonishly?

rljacob commented 1 year ago

Since this isn't a bug/issue in E3SM itself, we can close it anytime.