<html><head></head><body><div class="">Hi Dennis,<br><br>The problem is sovled. Thanks for your advice!&nbsp;<br><br>&nbsp;Wang Na&nbsp;</div><div>&nbsp;</div><hr style="WIDTH: 210px; HEIGHT: 1px" color="#b5c4df" size="1" align="left"><div><span><div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt"><div>wangna@mail.iap.ac.cn</div></div></span></div><blockquote style="margin-Top: 0px; margin-Bottom: 0px; margin-Left: 0.5em"><div>&nbsp;</div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><div><b>From:</b>&nbsp;<a href="mailto:shea@ucar.edu">Dennis Shea</a></div><div><b>Date:</b>&nbsp;2017-04-05&nbsp;21:55</div><div><b>To:</b>&nbsp;<a href="mailto:wangna@mail.iap.ac.cn">wangna@mail.iap.ac.cn</a></div><div><b>CC:</b>&nbsp;<a href="mailto:ncl-talk@ucar.edu">ncl-talk</a></div><div><b>Subject:</b>&nbsp;Re: [ncl-talk] ESMF regridding on mutiple time steps</div></div></div><div><div class=""><style>div.FoxDIV_20170406093206724 { font-size: 10.5pt }
</style><div class="FoxDIV_20170406093206724"><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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>where(.not.ismissing(var),1,0)<wbr> <br><br></i></font><br>The left-hand-side clearly expect a 2D array, 'var' (tos) is 3D. Try:<br><br>&nbsp;<font color="#0000ff" face="微软雅黑, Tahoma"><i>Opt@SrcMask2D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>where(.not.ismissing(var(0,:,:)),1,0)<wbr>&nbsp;&nbsp;&nbsp; ; 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&nbsp;"$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"<br>load&nbsp;"$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"<br>load&nbsp;"$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"<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's a full
list of the preloaded scripts:
</p><p>

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

It's okay to still load these scripts even though it'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&nbsp;"$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl"</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 &nbsp;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:&nbsp;Dimension&nbsp;size,&nbsp;for&nbsp;<wbr>dimension&nbsp;number&nbsp;0,&nbsp;of&nbsp;<wbr>operands&nbsp;does&nbsp;not&nbsp;match,&nbsp;can'<wbr>t&nbsp;continue<br><br>fatal:["Execute.c":8640]:<wbr>Execute:&nbsp;Error&nbsp;occurred&nbsp;at&nbsp;or&nbsp;<wbr>near&nbsp;line&nbsp;1108&nbsp;in&nbsp;file&nbsp;./ESMF_<wbr>regridding.ncl<br><br>fatal:["Execute.c":8640]:<wbr>Execute:&nbsp;Error&nbsp;occurred&nbsp;at&nbsp;or&nbsp;<wbr>near&nbsp;line&nbsp;2978&nbsp;in&nbsp;file&nbsp;./ESMF_<wbr>regridding.ncl<br><br>fatal:["Execute.c":8640]:<wbr>Execute:&nbsp;Error&nbsp;occurred&nbsp;at&nbsp;or&nbsp;<wbr>near&nbsp;line&nbsp;3089&nbsp;in&nbsp;file&nbsp;./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's my script:</div><div style="font-family:微软雅黑,Tahoma"><br></div><div><font color="#0000ff" face="微软雅黑, Tahoma"><i>load&nbsp;"$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"<br>load&nbsp;"$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"<br>load&nbsp;"$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"<br>load&nbsp;"$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl"<br><br>begin<br>;---Data&nbsp;file&nbsp;containing&nbsp;<wbr>source&nbsp;grid<br>&nbsp;&nbsp;&nbsp;&nbsp;dir&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;"/home/wangn/<wbr>data/CMIP5/LGM/monthly/tos/"<br>&nbsp;&nbsp;&nbsp;&nbsp;src_file&nbsp;=&nbsp;"tos_Omon_CNRM-<wbr>CM5_lgm_r1i1p1_197001-197912.<wbr>nc" &nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;sfile&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;addfile(dir&nbsp;+&nbsp;<wbr>src_file,"r")<br><br>;---Get&nbsp;variable&nbsp;to&nbsp;regrid<br>&nbsp;&nbsp;&nbsp;&nbsp;varname&nbsp;=&nbsp;"tos" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;sfile-&gt;tos<br>&nbsp;&nbsp;&nbsp;&nbsp;src_lat&nbsp;=&nbsp;sfile-&gt;lat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;src_lon&nbsp;=&nbsp;sfile-&gt;lon &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br><br>;---Set&nbsp;up&nbsp;regridding&nbsp;options<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>True<br><br>;---"bilinear"&nbsp;is&nbsp;the&nbsp;default.<wbr>&nbsp;"patch"&nbsp;and&nbsp;"conserve"&nbsp;are&nbsp;<wbr>other&nbsp;options.<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@InterpMethod&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;"<wbr>bilinear"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;;---Change&nbsp;(<wbr>maybe)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@WgtFileName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;"<a href="http://curv_to_1deg.nc" target="_blank">c<wbr>urv_to_1deg.nc</a>"<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@SrcGridLat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>src_lat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@SrcGridLon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>src_lon<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@SrcRegional&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>False &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@SrcInputFileName&nbsp;&nbsp;=&nbsp;<wbr>src_file &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@SrcMask2D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>where(.not.ismissing(var),1,0)<wbr>&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@DstGridType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;"<wbr>1deg" &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@DstLLCorner&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;(/<wbr>-89.75d,&nbsp;&nbsp;&nbsp;0.00d&nbsp;/) &nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@DstURCorner&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;(/<wbr>&nbsp;89.75d,&nbsp;359.75d&nbsp;/) &nbsp;</i></font></div><div><font color="#0000ff" face="微软雅黑, Tahoma"><i><br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@DstRegional&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>False &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@PrintTimings&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>True<br>&nbsp;&nbsp;&nbsp;&nbsp;Opt@Debug&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<wbr>True<br><br>&nbsp;&nbsp;&nbsp;&nbsp;var_regrid&nbsp;=&nbsp;ESMF_regrid(<wbr>var,Opt) &nbsp; &nbsp;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;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>
</div></div></div></blockquote></body></html>