<div dir="ltr"><div><div>[1] The function should work across all time steps.<br></div><div>[2] The following might cause an issue:<br><br><font color="#0000ff" face="微软雅黑, Tahoma"><i>Opt@SrcMask2D         = <wbr>where(.not.ismissing(var),1,0)<wbr> <br><br></i></font><br>The left-hand-side clearly expect a 2D array, &#39;var&#39; (tos) is 3D. Try:<br><br> <font color="#0000ff" face="微软雅黑, Tahoma"><i>Opt@SrcMask2D         = <wbr>where(.not.ismissing(var(0,:,:)),1,0)<wbr>    ; 2D<br><br></i></font></div><div><font color="#0000ff" face="微软雅黑, Tahoma"><span style="color:rgb(0,0,0)">Note: if there are no _FillValue then setting this attribute is not necessary.</span><i><br></i></font></div><div><br>========================================================================<br><br></div><div><br>A side point: from NCL 6.2.1 onward the following libraries need not be explicitly loaded by the user.<br><br><font color="#0000ff" face="微软雅黑, Tahoma"><i>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl&quot;<br><br></i></font></div><font color="#0000ff" face="微软雅黑, Tahoma"><span style="color:rgb(0,0,0)">In fact, for 6.4.0, the following libraries are loaded by default.</span><i><br></i></font></div><br><div><b>Preloaded NCL scripts</b><p>

Several NCL scripts are now preloaded, and you no longer need to
explicitly load them at the top of your own scripts. Here&#39;s a full
list of the preloaded scripts:
</p><p>

</p><pre>    &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;
    &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;
    &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;
    &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl&quot;
    &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/bootstrap.ncl&quot;
    &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/extval.ncl&quot;
    &quot;$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl&quot;
</pre>
<p>

It&#39;s okay to still load these scripts even though it&#39;s no longer required. <br></p><p><br></p><p>----</p><p>Only, the ESMF_regridding.ncl need be loaded.<br></p><p><font color="#0000ff" face="微软雅黑, Tahoma"><i>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl&quot;</i></font></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 4, 2017 at 10:47 PM, <a href="mailto:wangna@mail.iap.ac.cn">wangna@mail.iap.ac.cn</a> <span dir="ltr">&lt;<a href="mailto:wangna@mail.iap.ac.cn" target="_blank">wangna@mail.iap.ac.cn</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<div><span></span><br></div><div><div style="font-family:微软雅黑,Tahoma">Dear all,</div><div style="font-family:微软雅黑,Tahoma"><br></div><div style="font-family:微软雅黑,Tahoma">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:</div><div style="font-family:微软雅黑,Tahoma"><br></div><div style="font-family:微软雅黑,Tahoma"><span style="background-color:rgba(0,0,0,0);font-style:italic"><font color="#0000ff">fatal:Eq: Dimension size, for <wbr>dimension number 0, of <wbr>operands does not match, can&#39;<wbr>t continue<br><br>fatal:[&quot;Execute.c&quot;:8640]:<wbr>Execute: Error occurred at or <wbr>near line 1108 in file ./ESMF_<wbr>regridding.ncl<br><br>fatal:[&quot;Execute.c&quot;:8640]:<wbr>Execute: Error occurred at or <wbr>near line 2978 in file ./ESMF_<wbr>regridding.ncl<br><br>fatal:[&quot;Execute.c&quot;:8640]:<wbr>Execute: Error occurred at or <wbr>near line 3089 in file ./ESMF_<wbr>regridding.ncl</font></span></div><div style="font-family:微软雅黑,Tahoma"><br></div><div style="font-family:微软雅黑,Tahoma">But for the 2-D variale, my script can be run.</div><div style="font-family:微软雅黑,Tahoma"><br></div><div style="font-family:微软雅黑,Tahoma">Do I need to write a loop to regrid on mutiple time steps? Or are there any other ways?</div><div style="font-family:微软雅黑,Tahoma"><br></div><div style="font-family:微软雅黑,Tahoma">P.S. the ncl version is 6.4.0</div><div style="font-family:微软雅黑,Tahoma"><br></div><div style="font-family:微软雅黑,Tahoma">Here&#39;s my script:</div><div style="font-family:微软雅黑,Tahoma"><br></div><div><font color="#0000ff" face="微软雅黑, Tahoma"><i>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl&quot;<br><br>begin<br>;---Data file containing <wbr>source grid<br>    dir      = &quot;/home/wangn/<wbr>data/CMIP5/LGM/monthly/tos/&quot;<br>    src_file = &quot;tos_Omon_CNRM-<wbr>CM5_lgm_r1i1p1_197001-197912.<wbr>nc&quot;   <br>    sfile    = addfile(dir + <wbr>src_file,&quot;r&quot;)<br><br>;---Get variable to regrid<br>    varname = &quot;tos&quot;                      <br>    var     = sfile-&gt;tos<br>    src_lat = sfile-&gt;lat              <br>    src_lon = sfile-&gt;lon              <br><br>;---Set up regridding options<br>    Opt                   = <wbr>True<br><br>;---&quot;bilinear&quot; is the default.<wbr> &quot;patch&quot; and &quot;conserve&quot; are <wbr>other options.<br>    Opt@InterpMethod      = &quot;<wbr>bilinear&quot;        ;;---Change (<wbr>maybe)<br><br>    Opt@WgtFileName       = &quot;<a href="http://curv_to_1deg.nc" target="_blank">c<wbr>urv_to_1deg.nc</a>&quot;<br><br>    Opt@SrcGridLat        = <wbr>src_lat          <br>    Opt@SrcGridLon        = <wbr>src_lon<br>    Opt@SrcRegional       = <wbr>False             <br>    Opt@SrcInputFileName  = <wbr>src_file        <br>    Opt@SrcMask2D         = <wbr>where(.not.ismissing(var),1,0)<wbr> <br>                                                                                   <br><br>    Opt@DstGridType       = &quot;<wbr>1deg&quot;         <br>    Opt@DstLLCorner       = (/<wbr>-89.75d,   0.00d /)   <br>    Opt@DstURCorner       = (/<wbr> 89.75d, 359.75d /)  </i></font></div><div><font color="#0000ff" face="微软雅黑, Tahoma"><i><br>    Opt@DstRegional       = <wbr>False                 <br>    Opt@PrintTimings      = <wbr>True<br>    Opt@Debug             = <wbr>True<br><br>    var_regrid = ESMF_regrid(<wbr>var,Opt)    <br><br>    printVarSummary(var_<wbr>regrid)<br>end</i></font><br></div><div style="font-family:微软雅黑,Tahoma"><br></div><div style="font-family:微软雅黑,Tahoma"><br></div><div style="font-family:微软雅黑,Tahoma"><span style="background-color:rgba(0,0,0,0)"><br></span></div><div style="font-family:微软雅黑,Tahoma">Thank you for your attention</div><div style="font-family:微软雅黑,Tahoma"><br></div><div style="font-family:微软雅黑,Tahoma">Wang Na</div></div>
<div><br></div><hr style="width:210px;height:1px" align="left" color="#b5c4df" size="1"><span class="HOEnZb"><font color="#888888">
<div><span><div style="MARGIN:10px;FONT-FAMILY:verdana;FONT-SIZE:10pt"><div><a href="mailto:wangna@mail.iap.ac.cn" target="_blank">wangna@mail.iap.ac.cn</a></div></div></span></div>
</font></span></div><br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>