<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Times New Roman","serif";
        color:#1F497D;
        font-weight:normal;
        font-style:normal;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Hi Lifen,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Try add this line at the beginning of the script:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal><span style='color:#1F497D'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Yuqiang<o:p></o:p></span></p></div><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> ncl-talk-bounces@ucar.edu [mailto:ncl-talk-bounces@ucar.edu] <b>On Behalf Of </b>Jiang, Lifen<br><b>Sent:</b> Tuesday, February 17, 2015 4:41 PM<br><b>To:</b> Mary Haley<br><b>Cc:</b> ncl-talk@ucar.edu<br><b>Subject:</b> Re: [ncl-talk] Missing values are regridded?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><span style='color:black'>Hi Mary, <o:p></o:p></span></p><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>Thanks for creating the script, but it showed error message when I ran it:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><div><p class=MsoNormal><span style='color:red'>fatal:Could not open ($NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:red'>fatal:error at line 5 in file regrid.ncl</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>Do you have any idea about this?<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>Thanks again,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>Lifen<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><div class=MsoNormal align=center style='text-align:center'><span style='color:black'><hr size=2 width="100%" align=center></span></div><div id=divRpF956059><p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black'> 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> <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br><b>Subject:</b> Re: [ncl-talk] Missing values are regridded?</span><span style='color:black'><o:p></o:p></span></p></div><div><div><div><p class=MsoNormal><span style='color:black'>Hi,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>I'm not sure why the area_conserve_remap function is not working. However, the documentation for this function states:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black;background:yellow'> "Missing values, designated by the _FillValue attribute, are <b>not</b> allowed. If any missing <br> values are encountered, the remap will not be performed for that grid."</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>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.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>Meanwhile, you can try <b>ESMF_regrid</b> instead. I've created a new script for you, based on your original script, that uses "bilinear", "conservative", and "nearest neighbor" methods for regridding.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>You need to replace this code:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><div><p class=MsoNormal><span style='font-family:"Courier New";color:black'>regrid = area_conserve_remap_Wrap(t&lon,t&lat,t,newlon,newlat,False)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>with this code:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><div><p class=MsoNormal><span style='font-family:"Courier New";color:black'>opt = True</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Courier New";color:black'>opt@DstGridLat = newlat</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Courier New";color:black'>opt@DstGridLon = newlon</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Courier New";color:black'>opt@ForceOverwrite = True</span><span style='color:black'><o:p></o:p></span></p></div><div><div><p class=MsoNormal><span style='font-family:"Courier New";color:black'>opt@InterpMethod = "conserve"</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Courier New";color:black'>regrid = ESMF_regrid(t,opt)</span><span style='color:black'><o:p></o:p></span></p></div></div></div></div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'> </span><span style='color:black'> <o:p></o:p></span></p><div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'>Please see the attached "regrid_and_plot.ncl" script, which uses ESMF_regrid for the three methods, and creates a panel plot.</span><span style='color:black'><o:p></o:p></span></p></div></div><div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div></div><div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'>--Mary<o:p></o:p></span></p></div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p><div><p class=MsoNormal><span style='color:black'>On Tue, Feb 17, 2015 at 12:50 PM, Jiang, Lifen <<a href="mailto:lfjiang@ou.edu" target="_blank">lfjiang@ou.edu</a>> wrote:<o:p></o:p></span></p><div><div><div><p class=MsoNormal><span style='color:black'>Hello,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>I am regridding "y" (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. <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>My code is enclosed below and my data file is attached.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>Could anybody help me to find why missing function doesn't work? <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>Thanks for your time!<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>Lifen<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><div><p class=MsoNormal><span style='color:black'>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>begin<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>fili = "2000_MPI-ESM-MR.nc"<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>a = addfile (fili, "r")<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>t=a->y<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>t@_FillValue = -999.0<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>t@missing_value = t@_FillValue<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>t = lonFlip(t)<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>printVarSummary(t)<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>newlat=fspan(-89.50,89.50,180) ;create a sequence for the new values of lat <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>newlon=fspan(-179.5,179.5,360) ;create a sequence for the new values of lon<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>newlat@units = "degrees_north"<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>newlon@units = "degrees_east"<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>regrid= area_conserve_remap_Wrap(t&lon,t&lat,t,newlon,newlat,False)<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>printVarSummary(regrid)<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>print("regrid: min="+min(regrid)+" max="+max(regrid))<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>filo = "Regrid."+fili<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>system("/bin/rm -f "+filo)<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>fout=addfile(filo,"c")<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>fout@creation_date = systemfunc("date")<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>fout@title="Regrid_1*1 of "+fili<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>fout->regrid=regrid<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>end<o:p></o:p></span></p></div></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='color:black'><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><o:p></o:p></span></p></div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div></div></div></div></div></div></div></div></body></html>