[ncl-talk] ESMF regridding on mutiple time steps

wangna at mail.iap.ac.cn wangna at mail.iap.ac.cn
Tue Apr 4 22:47:26 MDT 2017


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"

    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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170405/00cce594/attachment.html 


More information about the ncl-talk mailing list