[ncl-talk] ESMF regridding on mutiple time steps
wangna at mail.iap.ac.cn
wangna at mail.iap.ac.cn
Wed Apr 5 20:08:21 MDT 2017
[1] The function should work across all time steps.
[2] The following might cause an issue:
*Opt at SrcMask2D = where(.not.ismissing(var),1,0) *
The left-hand-side clearly expect a 2D array, 'var' (tos) is 3D. Try:
*Opt at SrcMask2D = where(.not.ismissing(var(0,:,:)),1,0) ; 2D*
Note: if there are no _FillValue then setting this attribute is not
necessary.
========================================================================
A side point: from NCL 6.2.1 onward the following libraries need not be
explicitly loaded by the user.
*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"*
In fact, for 6.4.0, the following libraries are loaded by default.
*Preloaded NCL scripts*
Several NCL scripts are now preloaded, and you no longer need to explicitly
load them at the top of your own scripts. Here's a full list of the
preloaded scripts:
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/bootstrap.ncl"
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/extval.ncl"
"$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
It's okay to still load these scripts even though it's no longer required.
----
Only, the ESMF_regridding.ncl need be loaded.
*load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"*
On Tue, Apr 4, 2017 at 10:47 PM, wangna at mail.iap.ac.cn <
wangna at mail.iap.ac.cn> wrote:
>
> Dear all,
>
> I am trying to use ESMF_regrid to regrid from a curvillinear grid to a
> 1deg grid. When the variable needed to regrid is 3-D(time,i,j), I got an
> error as follows:
>
> fatal:Eq: Dimension size, for dimension number 0, of
> operands does not match, can't continue
>
> fatal:["Execute.c":8640]:Execute: Error occurred at or
> near line 1108 in file ./ESMF_regridding.ncl
>
> fatal:["Execute.c":8640]:Execute: Error occurred at or
> near line 2978 in file ./ESMF_regridding.ncl
>
> fatal:["Execute.c":8640]:Execute: Error occurred at or
> near line 3089 in file ./ESMF_regridding.ncl
>
> But for the 2-D variale, my script can be run.
>
> Do I need to write a loop to regrid on mutiple time steps? Or are there
> any other ways?
>
> P.S. the ncl version is 6.4.0
>
> Here's my script:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *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;---Data file containing source grid dir = "/home/wangn/data/CMIP5/LGM/monthly/tos/" src_file = "tos_Omon_CNRM-CM5_lgm_r1i1p1_197001-197912.nc"
> sfile = addfile(dir + src_file,"r");---Get variable to regrid varname = "tos"
> var = sfile->tos src_lat = sfile->lat
> src_lon = sfile->lon
> ;---Set up regridding options Opt = True;---"bilinear" is the default. "patch" and "conserve" are other options. Opt at InterpMethod = "bilinear" ;;---Change (maybe) Opt at WgtFileName = "curv_to_1deg.nc
> <http://curv_to_1deg.nc>" Opt at SrcGridLat = src_lat
> Opt at SrcGridLon = src_lon Opt at SrcRegional = False
> Opt at SrcInputFileName = src_file
> Opt at SrcMask2D = where(.not.ismissing(var),1,0)
>
> Opt at DstGridType = "1deg"
> Opt at DstLLCorner = (/-89.75d, 0.00d /)
> Opt at DstURCorner = (/ 89.75d, 359.75d /) *
>
>
>
>
>
>
>
>
> * Opt at DstRegional = False
> Opt at PrintTimings = True Opt at Debug = True var_regrid = ESMF_regrid(var,Opt)
> printVarSummary(var_regrid)end*
>
>
>
> Thank you for your attention
>
> Wang Na
>
> ------------------------------
> wangna at mail.iap.ac.cn
>
> _______________________________________________
> 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/20170406/bdc52b4a/attachment.html
More information about the ncl-talk
mailing list