[ncl-talk] Regridding from fine Rectilinear data to coarse curvilinear grid
Yuqiang Zhang
yuqiangzhang.thu at gmail.com
Wed Oct 22 19:00:21 MDT 2014
Hi Dennis,
Thanks for your detailed explanation of the “bin_sum”.
I have used the “ESMF_Regridding” functions to regrid Global Emissions data in fine rectilinear grid to Regional scale in coarser rectilinear grid. I thought there are some interpolations happens during the regridding. Since I am regridding the population data, which needs to sum up the data in fine resolution into a coarse resolution, I hesitate to use the ESMF regridding function again. However, thanks for your advice, I will check whether Example_9 works for my case. I also found the this function “rgrid2rcm”, and I will also double –check about that.
Have a good night!
Regards,
Yuqiang
From: ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu] On Behalf Of Dennis Shea
Sent: Wednesday, October 22, 2014 4:50 PM
To: Yuqiang Zhang
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Regridding from fine Rectilinear data to coarse curvilinear grid
The 'bin_sum' function was developed to process multiple satellite swaths onto a *rectilinear* grid. Each swath's latitude and longitude arrays are typically 2-dimensional (think, curvilinear). Hence: curvilinear ==> rectilinear. More specifically, the ndtooned function is used on the lat2d, lon2d and data array so, internally the data are treated as random. The reason for confining the output to a rectilinear grid is that a simple 'location finding' algorith is used to determine the location of each input data.
You have 'shoe-horned' the 'bin-sum' function to do just the opposite. Yes, it works BUT you are invoking the function for EACH 'fine resolution' grid point via the double do-loop. EACH invocation requires the underlying code to reinitialize. This imposes a huge penalty.
===
The procedure can go fron one rectilinear grid to another.
An example of going from an input high ('fine') resolution rectilinear grid to an output coarser rectilinear grid is
http://www.ncl.ucar.edu/Applications/binning.shtml
Example 3
===
It may be best to use ESMF Regridding
http://www.ncl.ucar.edu/Applications/ESMF.shtml
See: Example 9
Likely, 'conservative remapping' is what you want
So, your 'src' (source) information is the rectilinear data.
The 'dst' (destination) is the curvilinear grid.
Note: the weight file need be generated only once. Subsequently, you can reuse it.
Good Luck
On Tue, Oct 21, 2014 at 9:31 PM, Yuqiang Zhang <yuqiangzhang.thu at gmail.com> wrote:
Hi All,
I need to regrid the population data from fine rectilinear grid to coarse curvilinear grid.
Procedure “bin_sum” will not work very efficiently for me, as
Bin_Sum
“ gbin [*][*] : numeric ,
gknt [*][*] : integer ,
glon [*] : numeric ,
glat [*] : numeric ,
zlon [*] : numeric ,
zlat [*] : numeric ,
z [*] : numeric ”
The targeted output “glon” and “glat” are one-dimension and need to be equals to the rightmost and leftmost dimension of the gbin. However, I need all of them at the same dimension (lat2d, lon2d). What I am doing right now is loop over each grid cell, and then apply the “bin_sum” procedure. It works fine, but just run very slowly. I copied part of my scripts down here:
;*****************************************************************
; Variables to hold binned quantities
;*****************************************************************
gbin = new ( (/nlat,mlon/), float )
gknt = new ( (/nlat,mlon/), integer)
gbin_temp = new ((/1, 1/), float )
gknt_temp = new ((/1, 1/), integer)
gbin_temp = 0.0 ; initialization
gknt_temp = 0
printVarSummary(gbin_temp)
;*****************************************************************
;loop over the all the latitude and longitude in target grid
do I = 0, mlon-1
do J = 0, nlat-1
bin_sum(gbin_temp,gknt_temp, glon(J,I), glat(J,I), ndtooned(zlon2d), ndtooned(zlat2d), ndtooned(z) )
gbin(J, I) = gbin_temp(0,0)
end do
print("zyq finish "+ I)
end do
Any one has the idea to improve this?
Thanks for all your time!
Regards,
Yuqiang
Regards,
Yuqiang
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141022/70a6784d/attachment.html
More information about the ncl-talk
mailing list