[ncl-talk] Regridding from fine Rectilinear data to coarse curvilinear grid
Dennis Shea
shea at ucar.edu
Wed Oct 22 14:49:59 MDT 2014
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/26d11aeb/attachment.html
More information about the ncl-talk
mailing list