[ncl-talk] rcm2rgrid

debasish mazumder debasish at ucar.edu
Thu Dec 1 15:23:29 MST 2016


Thanks. I have used your suggestion. However, I got following error- (0) 
ESMF_regrid_gen_weights: 'ESMF_RegridWeightGen' was not successful.

with regards
-Deb

Here is my scripts

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"

begin
;---Read data off source file
srcFileName = "daymet_v3_tmax_monavg_1980_na.nc4"
sfile       = addfile(srcFileName,"r")
     madis       = sfile->tmax(0,:,:)
     madis at lat2d = sfile->lat
     madis at lon2d = sfile->lon

;---Assign zoom region
     minlon = min(madis at lon2d)
     maxlon = max(madis at lon2d)
     minlat = min(madis at lat2d)
     maxlat = max(madis at lat2d)

;---Read data off destination file
     dfile = addfile("/glade/scratch/debasish/CCSM4/CCSM4_T2_1958.nc","r")
     lat   = dfile->lat    ; Need these for coordinate arrays
     lon   = dfile->lon    ; for regridding
     lon = where(lon.gt.180,lon-360,lon)

     ;---Options for regridding
     Opt                 = True

     Opt at SrcFileName     = "AusSnow_src_SCRIP.nc"
     Opt at DstFileName     = "AusSnow_dst_SCRIP.nc"
     Opt at ForceOverwrite  = True

     Opt at SrcTitle        = srcFileName                  ; source grid
     Opt at SrcMask2D       = where(ismissing(madis),0,1)
     Opt at SrcRegional     = True

     Opt at DstTitle        = "Australia Rectilinear Grid" ; destination grid
     Opt at DstGridLat      = lat
     Opt at DstGridLon      = lon
     Opt at DstRegional     = True

     ;;Opt at PrintTimings  = True

     Opt at InterpMethod = "bilinear"

    Opt at WgtFileName  = "AUS_Swath_2_Rect_bilinear.nc"
     madis_regrid_b   = ESMF_regrid(madis,Opt)

     printVarSummary(madis_regrid_b)
     printMinMax(madis_regrid_b, True)

end




On 12/1/16 2:58 PM, Dennis Shea wrote:
> As suggested by Andrew, the ESMF approach is the way to go.
>
> [1] Save the weight file. Note: generating the weight file may be slow
> but it is done once.
> [2] Regrid using the weight file generated in [1]. This should be VERY
> FAST! It is basically a sparse matrix multiply.
>
> http://www.ncl.ucar.edu/Document/Functions/ESMF/ESMF_regrid_with_weights.shtml
> [3] See
>
> http://www.ncl.ucar.edu/Applications/ESMF.shtml
> EXample 4 + numerous others.
>
> Good luck
>
>
>
> On Thu, Dec 1, 2016 at 2:17 PM, debasish mazumder <debasish at ucar.edu
> <mailto:debasish at ucar.edu>> wrote:
>
>     I tried with ESMF regridding but it is still slow. Any other suggestion?
>     -Deb
>
>     On 12/1/16 1:14 PM, Andrew Kren - NOAA Affiliate wrote:
>     > I would try to use the NCL ESMF regridding tools, much faster and more
>     > options
>     >
>     > On Thu, Dec 1, 2016 at 1:12 PM, debasish mazumder <debasish at ucar.edu <mailto:debasish at ucar.edu>
>     > <mailto:debasish at ucar.edu <mailto:debasish at ucar.edu>>> wrote:
>     >
>     >     Hi All,
>     >
>     >     I am trying to interpolates data on a curvilinear grid to to a
>     >     rectilinear grid using rcm2rgrid.
>     >     Input data dimension is tmax(time = 12 months, y = 8075, x = 7814) and
>     >     lat2d(y = 8075, x = 7814), lon2d(y = 8075, x = 7814)
>     >
>     >     output lat(192) and lon(288)
>     >
>     >     tmaxi  = rcm2rgrid(lat2d,lon2d,tmax,lat,lon,0)
>     >
>     >     It took forever to perform the interpolation. Is there any faster way do
>     >     that.
>     >
>     >     with regards
>     >     -Deb
>     >     _______________________________________________
>     >     ncl-talk mailing list
>     >     ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>     <mailto:ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>>
>     >     List instructions, subscriber options, unsubscribe:
>     >     http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>     <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>     >     <http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>     <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>>
>     >
>     >
>     >
>     >
>     > --
>     > Andrew Kren, PhD
>     > Research Scientist I, Global Observing Systems Analysis (GOSA) Group
>     > NOAA ESRL Global Systems Division (Rm 3C515)
>     > 325 Broadway, Boulder, CO 80305
>     > (303) 497-5418 <tel:%28303%29%20497-5418> <tel:%28303%29%20497-5418>
>     _______________________________________________
>     ncl-talk mailing list
>     ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>     List instructions, subscriber options, unsubscribe:
>     http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>     <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>


More information about the ncl-talk mailing list