[ncl-talk] [EXT] regridding routine for grids with 2D lat and lon

Dennis Shea shea at ucar.edu
Thu Apr 30 21:35:30 MDT 2020


THX for the grib files.

I modified one of the ESMF examples. The attached script
*ESMF_stovern.ncl:*
(a) reads the desired variable and the source and destination grids
(b) interpolates using bilinear interpolation
(c) plots the source and interpolated variables
(d) creates a netCDF file containing the interpolated variable on the
destination grid.
===
The initial interpolation took surprisingly long: 72 seconds on my *old*
MAC.
The ESMF software is a separate/external suite of software. This fact is
hidden from users.
===
The good news is that once the weight file is generated, the interpolation
can be performed in less that a second :-)


;---ESMF_regrid with weights generated in a previous script
    wgtFile         = "QPF_weight_bilinear".nc"
    var_regrid    = *ESMF_regrid_with_weights*(var,*wgtFile*,False)  ; less
than a second
;---

Cheers
D

On Wed, Apr 29, 2020 at 8:15 PM Dennis Shea <shea at ucar.edu> wrote:

> Hi Diana,
>
> Bill Schfetic's response is correct.:  ESMF is the way to go.
>
> *http://www.ncl.ucar.edu/Applications/ESMF.shtml*
> <http://www.ncl.ucar.edu/Applications/ESMF.shtml>
> ESMF_{16, 20} are two examples.
> ---
> Note that the regridding requires the source and destination lat/lon grid
> values.
> Map projection information is not used.
> ---
> If you can make the source file and the  destination grid coordinates
> available [drop box, ftp, ...] , I could take a look.
>
> ftp ftp.cgd.ucar.edu
> anonymous
> your_email
> cd incoming
> put SOURCE_FILE
> quit
>
>
> Stay Healthy!
> D
>
> On Wed, Apr 29, 2020 at 7:51 PM William Scheftic via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Hi Diana,
>>
>> I haven't done your specific regridding.  But using the ESMF regridding
>> routines is the best way to go.  You can save the regridding in a special
>> netCDF file that only you requires the regridding weights to be calculated
>> once and then reloaded for future needs.  There are some examples that deal
>> with non-rectilinear grids sending in 2-d lat and lon grids, rather than
>> 1-d.
>>
>> http://www.ncl.ucar.edu/Applications/ESMF.shtml
>>
>> http://www.ncl.ucar.edu/Document/Functions/ESMF.shtml
>>
>> Cheers,
>>
>> Bill
>>
>>
>> On 4/29/2020 3:17 PM, Diana Stovern - NOAA Affiliate via ncl-talk wrote:
>>
>> *External Email*
>> Hello,
>>
>> I need to regrid rainfall data from a lambert conformal grid to a polar
>> sterographic grid.  The lat and lon data in both grids are 2D arrays (see
>> filedump output below).  Is there a regridding routine in NCL that allows
>> for both the input and output lat and lon to be 2D arrays?  I see most of
>> the routines require lat and lon to be 1D arrays.
>>
>> Thanks!
>>
>> Diana Stovern
>>
>>
>> *Grid 1:*
>>       float gridlat_0 ( ygrid_0, xgrid_0 )
>>          corners :      ( 23.117, 19.80368, 45.61871, 53.51192 )
>>          long_name :    latitude
>>          grid_type :    Polar Sterographic Projection (North or South)
>>          units :        degrees_north
>>          Dy :   4.763
>>          Dx :   4.763
>>          Lov :  255
>>          Lo1 :  240.977
>>          La1 :  23.117
>>
>>       float gridlon_0 ( ygrid_0, xgrid_0 )
>>          corners :      ( -119.023, -80.74672, -59.95137, -134.043 )
>>          long_name :    longitude
>>          grid_type :    Polar Sterographic Projection (North or South)
>>          units :        degrees_east
>>          Dy :   4.763
>>          Dx :   4.763
>>          Lov :  255
>>          Lo1 :  240.977
>>          La1 :  23.117
>>
>> *Grid 2:*
>>       float gridlat_0 ( ygrid_0, xgrid_0 )
>>          corners :      ( 20.192, 20.33182, 54.37271, 54.20572 )
>>          long_name :    latitude
>>          grid_type :    Lambert Conformal (secant, tangent, conical or
>> bipolar)
>>          units :        degrees_north
>>          Latin2 :       25
>>          Latin1 :       25
>>          Dy :   2.539702
>>          Dx :   2.539703
>>          Lov :  265
>>          Lo1 :  238.446
>>          La1 :  20.192
>>
>>       float gridlon_0 ( ygrid_0, xgrid_0 )
>>          corners :      ( -121.554, -69.20839, -59.04248, -131.9951 )
>>          long_name :    longitude
>>          grid_type :    Lambert Conformal (secant, tangent, conical or
>> bipolar)
>>          units :        degrees_east
>>          Latin2 :       25
>>          Latin1 :       25
>>          Dy :   2.539702
>>          Dx :   2.539703
>>          Lov :  265
>>          Lo1 :  238.446
>>          La1 :  20.192
>>
>> _______________________________________________
>> ncl-talk mailing listncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> 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/20200430/cba6229a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ESMF_stovern.ncl
Type: application/octet-stream
Size: 8299 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200430/cba6229a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: QPF.APCP_P8_2L1_GLC0_acc6h.bilinear.png
Type: image/png
Size: 173633 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200430/cba6229a/attachment.png>


More information about the ncl-talk mailing list