<div dir="ltr"><div><div><br>The following documentation:<br><br> <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/int2p.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>int2p.shtml</a><br> <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/int2p_n.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>int2p_n.shtml</a><br> <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/int2p_n_Wrap.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/<wbr>Contributed/int2p_n_Wrap.shtml</a><br><br>states that the '<b>pin</b>' argument "<b>values must be monotonically increasing or decreasing</b>."<br><br>In your usage, 'pin' ==> 'theta' (potential temperature [PT])<span class="gmail-im"><br><br> pv2 = <b>int2p_n</b>(theta, pv, lvl, 1, 1)<br><br></span>NCL's function for potential vorticity [PV] on isobaric surfaces<br><br> <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/pot_vort_isobaric.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/<wbr>Contributed/pot_vort_isobaric.<wbr>shtml</a><br><br>calculates and returns PV and PT. The PT calculation is pretty simple: <br><br> theta = t*(p0/p)^0.286 <br><br>where 't' is the temperature [K]; 'p' [hPa or Pa] is the isobaric level.<br><br>This uses the monthly mean 't' at each grid point. <b>For a time average 'theta' (eg: monthly mean),<br>one would expect a stable atmosphere. Hence, PT would always be monotonically increasing. </b><br><br><b>Unfortunately, isobaric data includes the results of temperature values which have<br>been derived via extrapolation below the surface. </b>EG: If the surface pressure [PSFC] is 902 hPa, <br>the temperatures at 925, 950 and 1000hPa are derived via some unknown extrapolation method.<br>Also, how is the monthly mean 't' of the computed? Do they average the (say) 4 times daily values<br>for a month? <br><br>A rule-of-thumb is that <b>extrapolation is always dangerous</b>!!!!!!!! <br>Be careful with usage. Just because there are numbers, does not means they are the correct numbers.<br><br>This is demonstrated in your data because the PT at the lowest level(s) may-or-may not be<br>monotonically increasing. Where it is not, 'int2p_n' return an _FillValue. Hence,<br>the issue you have encountered.<br><br></div>Likely, there is some fix. I'll think about it.<br><br></div>Good Luck<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 10, 2018 at 7:03 PM, 张 南水 <span dir="ltr"><<a href="mailto:zhangnanshui@hotmail.com" target="_blank">zhangnanshui@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_4931556715212014327divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0"></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US">Dear Sir,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> I have a problem to interpolate potential vorticity to isentropic levels. All
the data is derived from NCEP-DOE Reanalysis 2.<span style="color:rgb(68,68,68);font-family:Helvetica,Verdana,sans-serif;font-size:15.2152px"> </span>The potential vorticity is obtained via the function "pot_vort_isobaric", and so as to the potential
temperature. And the interpolation is done by the function "int2p_n". However, plenty of undefined grids appear in the the potential vorticity field at an isentropic level, see 350K. And the undefined grids, which locate at the same position for all time, are
not coherent with the <span>topography. </span>I have no idea that how does those undefined grids appear and how to deal with it? Thank you for your attention to this matter.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US">The version of NCL I used is 6.4. And my system is Ubuntu 16.0 on windows 10. My
script is as following and the image is attached.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US">;=============================<wbr>==============================<wbr>===============<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> begin<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> f1 = addfile("/mnt/e/NCEP/NCEP-R2/<wbr>Daily/pv/<a href="http://pv.2010.nc" id="m_4931556715212014327LPlnk284853" class="m_4931556715212014327OWAAutoLink" target="_blank">pv.2010.nc</a>","r")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> f2 = addfile("/mnt/e/NCEP/NCEP-R2/<wbr>Daily/pt/<a href="http://pt.2010.nc" id="m_4931556715212014327LPlnk162122" class="m_4931556715212014327OWAAutoLink" target="_blank">pt.2010.nc</a>","r")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u> <span style="font-family:Arial,sans-serif;font-size:16px"> </span><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u><span style="font-family:Arial,sans-serif;font-size:16px"> pv = f1->pv</span><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> time = f1->time<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> theta = f2->pt<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><br>
</span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> ; lvl = ispan(270,400,10)*1.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> lvl = (/ 300, 350, 400/) ; user specified inentropic levels<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> lvl@description = "isentropic level" ; add meta data<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> lvl@units = theta@units<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> lvl!0 = "lvl"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> lvl&lvl = lvl<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><br>
</p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> ; pv2 = int2p(theta(time|:,lat|:,lon|:<wbr>,level|:), \<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> ; pv(time|:,lat|:,lon|:,level|:<wbr>), lvl, 1)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2 = int2p_n(theta, pv, lvl, 1, 1)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2!0 = "time" ; name dimensions<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2!2 = "lat"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2!3 = "lon"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2!1 = "lvl"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2&time = time ; assign coordinates<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2&lvl = lvl ; isentropic levels<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2&lat = pv&lat<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2&lon = pv&lon<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2@long_name = pv@long_name ; attributes<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> pv2@units = pv@units<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> ;------output <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> fNameo = "/mnt/e/NCEP/NCEP-R2/Daily/pv_<wbr>pt/<a href="http://pv.2010.nc" id="m_4931556715212014327LPlnk490240" class="m_4931556715212014327OWAAutoLink" target="_blank">pv.2010.nc</a>"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> system("/bin/rm -f " + fNameo)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> fout = addfile(fNameo,"c")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> fout@title = " potential vorticity"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> fout@creation_date = systemfunc("date")<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> filedimdef(fout,"time",-1,<wbr>True)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"> fout->pv = pv2<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US">end<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US">;=============================<wbr>==============================<wbr>===============<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US">Yours,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:black" lang="EN-US">Nanshui<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:12.0pt;font-family:SimSun" lang="EN-US"><u></u> <u></u></span></p>
<br>
<p></p>
</div>
</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>