[ncl-talk] ESMF regrid fails when mask applied on multiple time steps

Neil Berg neil.berg14 at gmail.com
Wed Sep 9 21:14:07 MDT 2015


On Sep 9, 2015, at 8:01 PM, Neil Berg <neil.berg14 at gmail.com> wrote:

Hello all,

I am having an issue using ESMF_regrid after masking out water grid cells (marked by -9999) in my source array when ingesting all times in the 3D array (ntim x nlat x nlon).  There is no issue if I only read in the first time step, hence making the input 2D (nlat x nlon).  The lat/lon grid is the same for all time steps and I’ve included both a small sample of the source array data (snodas_tmp.nc) and the relevant code below.  

The error message when including multiple time steps is: 

fatal:Eq: Dimension size, for dimension number 0, of operands does not match, can't continue

Any tips for using ESMF_regrid with a mask over multiple time steps?

Thanks in advance,

Neil




    source_file = “./snodas_tmp.nc"

    infile = addfile(source_file, "r")
    ; WORKS
    ;swe = infile->Snow_Water_Equivalent_with_State_Model_variable_type(0,:,:)
    ; FAILS
    swe = infile->Snow_Water_Equivalent_with_State_Model_variable_type(:,:,:)
    lat = infile->latitude
    lon = infile->longitude

    minlon = min(lon)
    maxlon = max(lon)
    minlat = min(lat)
    maxlat = max(lat)

    Opt = True ; Regridding options

    Opt at SrcFileName = "snodas_SrcSCRIP.nc" ; Output files
    Opt at DstFilename = "snodas_DstSCRIP.nc"
    Opt at ForceOverwrite = True

    Opt at SrcTitle = source_file
    
    Opt at DstGridType = ".0818deg" ; destination grid of 9km or .0818 degrees 
    Opt at DstLLCorner = (/minlat, minlon/)
    Opt at DstURCorner = (/maxlat, maxlon/)

    Opt at SrcRegional = True ; regional grid source
    Opt at DstRegional = True ; regional grid destination

    ; need to mask out water pts, marked as -9999
    Opt at SrcGridMask = where(swe.eq.-9999,0,1)

    Opt at InterpMethod = "bilinear"
    Opt at WgtFileName = "snodas_Swath_2_Rect_bilinear.nc"

    swe_regrid = ESMF_regrid(swe,Opt)







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150909/80f255ca/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snodas_tmp.nc
Type: application/octet-stream
Size: 6852 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150909/80f255ca/attachment.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150909/80f255ca/attachment-0001.html 


More information about the ncl-talk mailing list