# [ncl-talk] ESMF Conservative Regridding of population and population density

Tabish Ansari tabishumaransari at gmail.com
Thu Mar 16 10:55:01 MDT 2023

```Hi

I need to understand a fundamental feature of the ESMF "conserve"
regridding: does it conserve fluxes or absolute values?

I've got a *population count* and *population density* data on a native
1deg x 1deg grid. Ultimately, I need a population count on a 1.9deg x
2.5deg grid. I tried to achieve this in two ways:

1. Regridding the population count directly: This gives me a grid sum
of 1.67 billion instead of 7.96 billion (world population in 2020) as
obtained from the native grid sum. Strangely enough, if I multiply 1.67
billion with 1.9*2.5, the result gets pretty close to 7.96 billion but I'm
unable to interpret why that might be the case.

2. Regridding population density data and multiplying by a matrix of
gridpoint areas (I have obtained this separately) to get total population.
In this case, the grid sum turns out to be 13.5 billion which is
significantly higher than the actual world population of 7.96 billion again.

So, my first question is, which is the right way to regrid population when
using conservative remapping? And further, are there any obvious issues in
my approach?

Here's my code to generate weights file:

"\$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"begin    sfile =
<http://gpw_v4_population_density_rev11_1_deg.nc>","r")    dfile =
<http://HTAP_transient_1.9x2.5_emis_NO_20201217.nc>","r")    varname =
"Population Density, v4.11 (2000, 2005, 2010, 2015, 2020): 1 degree" ; A
TERRIBLE VARIABLE NAME!    pop     = sfile->\$varname\$    pop2020 =
pop(4,:,:) ; EXTRACTING 2D POPULATION DATA FOR THE YEAR 2020    nox_cams =
dfile->glseas(0,:,:)    poplat = pop2020&latitude    poplon =
pop2020&longitude    camslat = nox_cams&lat    camslon = nox_cams&lon   Opt
= True   Opt at ForceOverwrite = True   Opt at InterpMethod   =
"conserve"   Opt at SrcGridLon        = poplon   Opt at SrcGridLat        =
poplat   Opt at DstGridLon        = camslon   Opt at DstGridLat        = camslat
pop_regrid = ESMF_regrid(pop2020,Opt)   printVarSummary(pop_regrid)end*

Here's the code to generate the regridded data using the newly created
weights file:

*beginsfile =
<http://gpw_v4_population_density_rev11_1_deg.nc>","r")dfile =
<http://popdensity2020_regridded.nc>","c")varname = "Population Density,
v4.11 (2000, 2005, 2010, 2015, 2020): 1 degree" pop     =
sfile->\$varname\$pop2020 = pop(4,:,:)WF =
"/work/users/tan/nclscripts/pop-regridfiles/weights_file.nc
<http://weights_file.nc>"pop2020_regrid =
ESMF_regrid_with_weights(pop2020,WF,False) ;REGRIDDINGdfile->popdensity2020
= pop2020_regrid  ;STORINGprint("Regridded!")*

*end*

Thanks a lot.

best regards,

Tabish

-------------------------------
Dr Tabish Ansari
Research Associate
Air Quality Modelling Group
IASS-Potsdam
Germany
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20230316/4def3803/attachment.htm>
```