<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Times New Roman;color: #000000;font-size: 12pt;">
Hi Mary,
<div><br>
</div>
<div>Thanks for creating the script, but it showed error message when I ran it:</div>
<div><br>
</div>
<div>
<div><font color="#ff0000">fatal:Could not open ($NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl)</font></div>
<div><font color="#ff0000">fatal:error at line 5 in file regrid.ncl</font></div>
<div><br>
</div>
<div>Do you have any idea about this?</div>
<div><br>
</div>
<div>Thanks again,</div>
<div><br>
</div>
<div>Lifen</div>
<div><br>
</div>
<div>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma">
<div style="font-family:Tahoma">
<div style="font-family:Tahoma">
<div>
<div></div>
<div style="font-size:13px">
<div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF956059" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> Mary Haley [haley@ucar.edu]<br>
<b>Sent:</b> Tuesday, February 17, 2015 2:52 PM<br>
<b>To:</b> Jiang, Lifen<br>
<b>Cc:</b> ncl-talk@ucar.edu<br>
<b>Subject:</b> Re: [ncl-talk] Missing values are regridded?<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Hi,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">I'm not sure why the area_conserve_remap function is not working. However, the documentation for this function states:</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small"><span style="background-color:rgb(255,255,0)">&nbsp; &nbsp;&quot;Missing values, designated by the _FillValue attribute, are
<b>not</b> allowed. If any missing &nbsp; &nbsp; <br>
&nbsp; &nbsp; values are encountered, the remap will not be performed for that grid.&quot;</span></div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">I take this to mean that it should have returned *all* missing values, which apparently it didn't. I will file a ticket on this. I think, though, you cannot use this routine if you have missing values.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">Meanwhile, you can try <b>ESMF_regrid</b> instead.&nbsp; I've created a new script for you, based on your original script, that uses &quot;bilinear&quot;, &quot;conservative&quot;, and &quot;nearest neighbor&quot; methods for regridding.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">You need to replace this code:</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="">
<div class="gmail_default" style="font-size:small"><font face="monospace, monospace">regrid = area_conserve_remap_Wrap(t&amp;lon,t&amp;lat,t,newlon,newlat,False)</font></div>
<div style="font-size:small"><br>
</div>
<div style="font-size:small">with this code:</div>
<div style="font-size:small"><br>
</div>
<div style="">
<div style=""><font face="monospace, monospace">opt &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= True</font></div>
<div style=""><font face="monospace, monospace">opt@DstGridLat &nbsp; &nbsp; = newlat</font></div>
<div style=""><font face="monospace, monospace">opt@DstGridLon &nbsp; &nbsp; = newlon</font></div>
<div style=""><font face="monospace, monospace">opt@ForceOverwrite = True</font></div>
<div style="">
<div><font face="monospace, monospace">opt@InterpMethod &nbsp; = &quot;conserve&quot;</font></div>
<div><font face="monospace, monospace"><br>
</font></div>
<div><font face="monospace, monospace">regrid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = ESMF_regrid(t,opt)</font></div>
</div>
</div>
</div>
<font face="arial, helvetica, sans-serif">&nbsp;</font>
<div>
<div class="gmail_default" style="font-size:small; display:inline"><font face="arial, helvetica, sans-serif">​Please see the attached &quot;regrid_and_plot.ncl&quot; script, which uses ESMF_regrid for the three methods, and creates a panel plot.</font></div>
</div>
<div>
<div class="gmail_default" style="font-size:small; display:inline"><font face="arial, helvetica, sans-serif"><br>
</font></div>
</div>
<div><font face="arial, helvetica, sans-serif">
<div class="gmail_default" style="font-size:small; display:inline">​--Mary</div>
<br>
</font>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Feb 17, 2015 at 12:50 PM, Jiang, Lifen <span dir="ltr">
&lt;<a href="mailto:lfjiang@ou.edu" target="_blank">lfjiang@ou.edu</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 style="direction:ltr; font-family:Times New Roman; color:#000000; font-size:12pt">
<div>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma">
<div style="font-family:Tahoma">
<div style="font-family:Tahoma">
<div>
<div></div>
<div style="font-size:13px">
<div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>Hello,</div>
<div><br>
</div>
<div>I am regridding &quot;y&quot; (lat, lon) to 1 degree grids. My codes always re-map the missing values as well (-999) as the printed min is -994.176, which should be a positive number.&nbsp;</div>
<div><br>
</div>
<div>My code is enclosed below and my data file is attached.</div>
<div><br>
</div>
<div>Could anybody help me to find why missing function doesn't work?&nbsp;</div>
<div><br>
</div>
<div>Thanks for your time!</div>
<div><br>
</div>
<div>Lifen</div>
<div><br>
</div>
<div>
<div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;</div>
<div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;</div>
<div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot; &nbsp;</div>
<div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl&quot;&nbsp;</div>
<div><br>
</div>
<div>begin</div>
<div>fili = &quot;2000_MPI-ESM-MR.nc&quot;</div>
<div>a = addfile (fili, &quot;r&quot;)</div>
<div>t=a-&gt;y</div>
<div><br>
</div>
<div>t@_FillValue &nbsp;= -999.0</div>
<div>t@missing_value = t@_FillValue</div>
<div><br>
</div>
<div>t = lonFlip(t)</div>
<div>printVarSummary(t)</div>
<div><br>
</div>
<div>newlat=fspan(-89.50,89.50,180) &nbsp; ;create a sequence for the new values of lat&nbsp;</div>
<div>newlon=fspan(-179.5,179.5,360) &nbsp; ;create a sequence for the new values of lon</div>
<div><br>
</div>
<div>newlat@units = &quot;degrees_north&quot;</div>
<div>newlon@units = &quot;degrees_east&quot;</div>
<div><br>
</div>
<div>regrid= area_conserve_remap_Wrap(t&amp;lon,t&amp;lat,t,newlon,newlat,False)</div>
<div>printVarSummary(regrid)</div>
<div>print(&quot;regrid: &nbsp;min=&quot;&#43;min(regrid)&#43;&quot; &nbsp;max=&quot;&#43;max(regrid))</div>
<div><br>
</div>
<div>filo = &quot;Regrid.&quot;&#43;fili</div>
<div>system(&quot;/bin/rm -f &quot;&#43;filo)</div>
<div>fout=addfile(filo,&quot;c&quot;)</div>
<div>fout@creation_date = systemfunc(&quot;date&quot;)</div>
<div>fout@title=&quot;Regrid_1*1 of &quot;&#43;fili</div>
<div>fout-&gt;regrid=regrid</div>
<div>end</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>