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

Mary Haley haley at ucar.edu
Thu Sep 10 11:21:50 MDT 2015


Neil,

I think the failure is on the setting of SrcGridMask.  If I remember
correctly, this must be a 2D array, dimensioned nlat x nlon.  Try this:

 Opt at SrcGridMask = where(swe(0,:,:).eq.-9999,0,1)

If, however, the mask is *not* the same for each time step, then you will
need to call the regridding function separately for each time step, and
pass in the new mask every time.

Meanwhile, I will fix the ESMF_regrid code so that it produces a more
meaningful error message.

--Mary



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

>
> 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)
>
>
>
>
>
>
>
>
> _______________________________________________
> 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/20150910/8e5a556b/attachment.html 


More information about the ncl-talk mailing list