<div dir="ltr"><div class="gmail_default" style="font-size:small">Neil,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-family:Menlo;font-size:11px"> Opt@SrcGridMask = </span><span style="font-family:Menlo;font-size:11px;color:rgb(52,187,199)">where</span><span style="font-family:Menlo;font-size:11px">(swe(0,:,:).eq.-</span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">9999</span><span style="font-family:Menlo;font-size:11px">,</span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">0</span><span style="font-family:Menlo;font-size:11px">,</span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">1</span><span style="font-family:Menlo;font-size:11px">)</span><br></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">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.</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">Meanwhile, I will fix the ESMF_regrid code so that it produces a more meaningful error message.</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">--Mary</font></div><div class="gmail_default"><font face="Menlo"><span style="font-size:11px"><br></span></font></div><div class="gmail_default"><font face="Menlo"><span style="font-size:11px"><br></span></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 9, 2015 at 9:14 PM, Neil Berg <span dir="ltr">&lt;<a href="mailto:neil.berg14@gmail.com" target="_blank">neil.berg14@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div>On Sep 9, 2015, at 8:01 PM, Neil Berg &lt;<a href="mailto:neil.berg14@gmail.com" target="_blank">neil.berg14@gmail.com</a>&gt; wrote:</div><br>Hello all,<br><font color="#0f61c8"><br></font>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 (<a href="http://snodas_tmp.nc" target="_blank">snodas_tmp.nc</a>) and the relevant code below.  <br><font color="#0f61c8"><br></font>The error message when including multiple time steps is: <br><font color="#0f61c8"><br></font><span style="font-family:Menlo;font-size:11px">fatal:Eq: Dimension size, for dimension number 0, of operands does not match, can&#39;t continue</span><br><font color="#0f61c8"><br></font>Any tips for using ESMF_regrid with a mask over multiple time steps?<br><font color="#0f61c8"><br></font>Thanks in advance,<br><font color="#0f61c8"><br></font>Neil<br><font color="#0f61c8"><br></font><blockquote type="cite"><div style="word-wrap:break-word"><div><blockquote type="cite"><div style="word-wrap:break-word"><div></div></div></blockquote></div></div></blockquote></div></div><br><div style="word-wrap:break-word"><div><br><font color="#0f61c8"><br><br></font><font face="Menlo"><span style="font-size:11px">    source_file = </span></font><font color="#c33720" face="Menlo"><span style="font-size:11px">“./<a href="http://snodas_tmp.nc" target="_blank">snodas_tmp.nc</a>&quot;</span></font><br><font color="#0f61c8" face="Menlo"><span style="font-size:11px"><br></span></font><span style="font-family:Menlo;font-size:11px">    infile = </span><span style="font-family:Menlo;font-size:11px;color:rgb(52,187,199)">addfile</span><span style="font-family:Menlo;font-size:11px">(source_file, </span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">&quot;r&quot;</span><span style="font-family:Menlo;font-size:11px">)</span><br><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">    </span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">; WORKS</span><br><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">    </span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">;swe = infile-&gt;Snow_Water_Equivalent_with_State_Model_variable_type(0,:,:)</span><br><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">    </span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">; FAILS</span><br><span style="font-family:Menlo;font-size:11px">    swe = infile-&gt;Snow_Water_Equivalent_with_State_Model_variable_type(:,:,:)</span><br><span style="font-family:Menlo;font-size:11px">    lat = infile-&gt;latitude</span><br><span style="font-family:Menlo;font-size:11px">    lon = infile-&gt;longitude</span><br><font color="#0f61c8" face="Menlo"><span style="font-size:11px"><br></span></font><span style="font-family:Menlo;font-size:11px">    minlon = </span><span style="font-family:Menlo;font-size:11px;color:rgb(52,187,199)">min</span><span style="font-family:Menlo;font-size:11px">(lon)</span><br><span style="font-family:Menlo;font-size:11px">    maxlon = </span><span style="font-family:Menlo;font-size:11px;color:rgb(52,187,199)">max</span><span style="font-family:Menlo;font-size:11px">(lon)</span><br><span style="font-family:Menlo;font-size:11px">    minlat = </span><span style="font-family:Menlo;font-size:11px;color:rgb(52,187,199)">min</span><span style="font-family:Menlo;font-size:11px">(lat)</span><br><span style="font-family:Menlo;font-size:11px">    maxlat = </span><span style="font-family:Menlo;font-size:11px;color:rgb(52,187,199)">max</span><span style="font-family:Menlo;font-size:11px">(lat)</span><br><font color="#0f61c8" face="Menlo"><span style="font-size:11px"><br></span></font><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">    Opt = </span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">True</span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px"> </span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">; Regridding options</span><br><font color="#0f61c8" face="Menlo"><span style="font-size:11px"><br></span></font><span style="font-family:Menlo;font-size:11px">    Opt@SrcFileName = </span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">&quot;snodas_SrcSCRIP.nc&quot;</span><span style="font-family:Menlo;font-size:11px"> </span><span style="font-family:Menlo;font-size:11px;color:rgb(83,48,225)">; Output files</span><br><span style="font-family:Menlo;font-size:11px">    Opt@DstFilename = </span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">&quot;snodas_DstSCRIP.nc&quot;</span><br><span style="font-family:Menlo;font-size:11px">    Opt@ForceOverwrite = </span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">True</span><br><font color="#0f61c8" face="Menlo"><span style="font-size:11px"><br></span></font><span style="font-family:Menlo;font-size:11px">    Opt@SrcTitle = source_file</span><br><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">    </span><br><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">    Opt@DstGridType = </span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">&quot;.0818deg&quot;</span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px"> </span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">; destination grid of 9km or .0818 degrees </span><br><span style="font-family:Menlo;font-size:11px">    Opt@DstLLCorner = (/minlat, minlon/)</span><br><span style="font-family:Menlo;font-size:11px">    Opt@DstURCorner = (/maxlat, maxlon/)</span><br><font color="#0f61c8" face="Menlo"><span style="font-size:11px"><br></span></font><span style="font-family:Menlo;font-size:11px">    Opt@SrcRegional = </span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">True</span><span style="font-family:Menlo;font-size:11px"> </span><span style="font-family:Menlo;font-size:11px;color:rgb(83,48,225)">; regional grid source</span><br><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">    Opt@DstRegional = </span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">True</span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px"> </span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">; regional grid destination</span><br><font color="#0f61c8" face="Menlo"><span style="font-size:11px"><br></span></font><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">    </span><span style="color:rgb(83,48,225);font-family:Menlo;font-size:11px">; need to mask out water pts, marked as -9999</span><br><span style="font-family:Menlo;font-size:11px">    Opt@SrcGridMask = </span><span style="font-family:Menlo;font-size:11px;color:rgb(52,187,199)">where</span><span style="font-family:Menlo;font-size:11px">(swe.eq.-</span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">9999</span><span style="font-family:Menlo;font-size:11px">,</span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">0</span><span style="font-family:Menlo;font-size:11px">,</span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">1</span><span style="font-family:Menlo;font-size:11px">)</span><br><font color="#0f61c8" face="Menlo"><span style="font-size:11px"><br></span></font><span style="font-family:Menlo;font-size:11px">    Opt@InterpMethod = </span><span style="font-family:Menlo;font-size:11px;color:rgb(195,55,32)">&quot;bilinear&quot;</span><br><span style="color:rgb(195,55,32);font-family:Menlo;font-size:11px">    Opt@WgtFileName = </span><span style="color:rgb(195,55,32);font-family:Menlo;font-size:11px">&quot;snodas_Swath_2_Rect_bilinear.nc&quot;</span><br><font color="#0f61c8" face="Menlo"><span style="font-size:11px"><br></span></font><span style="font-family:Menlo;font-size:11px">    swe_regrid = ESMF_regrid(swe,Opt)</span><br><font color="#0f61c8"><br><br><br><br><br></font><div style="word-wrap:break-word"><div><div style="word-wrap:break-word"><div></div></div></div><br></div></div><br></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>