<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Mary,<div><br></div><div>That fixed the error and the regridding procedure is now working on my 3D array with the grid mask applied to it. Thanks!</div><div><br></div><div>Neil</div><div><br><div><div>On Sep 10, 2015, at 10:21 AM, Mary Haley <<a href="mailto:haley@ucar.edu">haley@ucar.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><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"><<a href="mailto:neil.berg14@gmail.com" target="_blank">neil.berg14@gmail.com</a>></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 <<a href="mailto:neil.berg14@gmail.com" target="_blank">neil.berg14@gmail.com</a>> 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'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"><blockquote type="cite"><div style="word-wrap:break-word"><div></div></div></blockquote></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>"</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)">"r"</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->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->Snow_Water_Equivalent_with_State_Model_variable_type(:,:,:)</span><br><span style="font-family:Menlo;font-size:11px"> lat = infile->latitude</span><br><span style="font-family:Menlo;font-size:11px"> lon = infile->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)">"snodas_SrcSCRIP.nc"</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)">"snodas_DstSCRIP.nc"</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)">".0818deg"</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)">"bilinear"</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">"snodas_Swath_2_Rect_bilinear.nc"</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>
</blockquote></div><br></div></body></html>