<div dir="ltr"><div>diri = &quot;/Users/ipshita/Documents/grads_NCL/&quot;<br><br>c=addfile(diri+&quot;<a href="http://vwnd.2008.nc">vwnd.2008.nc</a>&quot;,&quot;r&quot;)<br>e=addfile(diri+&quot;<a href="http://pres.sfc.mon.mean.nc">pres.sfc.mon.mean.nc</a>&quot;,&quot;r&quot;)<br><br>v  = c-&gt;vwnd                    ; (time,level,lat,lon) <br>ps = e-&gt;pres                    ; (time,lat,lon)        hPa<br><br>printVarSummary(ps)<br>print(&quot;---&quot;)<br>printVarSummary(v)<br>print(&quot;---&quot;)<br>print(v&amp;level)                  ; hPa  (1000-10) =&gt; bottom-to-top<br>print(&quot;---&quot;)<br>; =========================<br></div>; function requires top-to-bottom; reverse order<br>;==========================<br><div>v = v(:,::-1,:,:)<br><br>printVarSummary(v)    <br>print(&quot;---&quot;)<br>print(v&amp;level)                  ; hPa  (10-1000) =&gt; top-to-bottom<br>print(&quot;---&quot;)<br><br>; =========================<br></div><div>; function requires Pa ... not hPa/mb<br>;==========================<br>ps =(/ ps*100 /)                     ; function requires Pa<br>ps@units = &quot;Pa&quot;<br><br>v&amp;level = (/ 100*v&amp;level /)     ; function requires Pa<br>v&amp;level@units = &quot;Pa&quot; <br><br>zmpsi = zonal_mpsi_Wrap(v, v&amp;lat, v&amp;level, ps)<br>printVarSummary(zmpsi)<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 9, 2016 at 5:10 PM, Adam Phillips <span dir="ltr">&lt;<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.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 dir="ltr">Hi Ipshita,<div>The printVarSummary output shows what the problem is:</div><span class=""><div><div style="font-size:12.8px">Type: float</div><div style="font-size:12.8px">Total Size: 714816 bytes</div><div style="font-size:12.8px">            178704 values</div><div style="font-size:12.8px">Number of Dimensions: 3</div><div style="font-size:12.8px">Dimensions and sizes:<span style="white-space:pre-wrap">        </span>[level | 17] x [lat | 73] x [lon | 144]</div><div style="font-size:12.8px">Coordinates: </div><div style="font-size:12.8px">           <span style="background-color:rgb(255,217,102)"> level: [10..1000]</span></div></div><div style="font-size:12.8px"><span style="background-color:rgb(255,217,102)"><br></span></div></span><div style="font-size:12.8px">The error message that you are recieving states that the levels need to be in Pa:</div><span class=""><div style="font-size:12.8px"><span style="font-size:12.8px">fatal:zonal_mpsi: The pressure array must be between the values of 500 and 100500 (exclusive), and monotonically increasing.</span><br></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div></span><div style="font-size:12.8px"><span style="font-size:12.8px">Thus, you need to convert your pressure levels to Pa. I am unsure whether zonal_mpsi uses the level coordinate variable attached to your v1 array, so it is probably better to change that (as opposed to just altering the v1&amp;level array itself.</span></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">level = v1&amp;level</div><div style="font-size:12.8px">delete(v1&amp;level)</div><div style="font-size:12.8px">level = level*100.</div><div style="font-size:12.8px">level&amp;level = level</div><div style="font-size:12.8px">level@units = &quot;Pa&quot;</div><div style="font-size:12.8px">v1&amp;level = level</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">That should fix the issue..</div><span class="HOEnZb"><font color="#888888"><div style="font-size:12.8px">Adam</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><span style="font-size:12.8px"> </span></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 9, 2016 at 12:01 PM, Ipshita Majhi <span dir="ltr">&lt;<a href="mailto:ipmajhi@alaska.edu" target="_blank">ipmajhi@alaska.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 dir="ltr">Hi ,<div><br></div><div>Thank you for your input. I did try the above mentioned correction. I still get an error :</div><div><br></div><div>fatal:zonal_mpsi: The pressure array must be between the values of 500 and 100500 (exclusive), and monotonically increasing<br></div><div><br></div><div>Here is the printVarSummary and print for v1 Variable: v1</div><div><br></div><div>Type: float</div><div>Total Size: 714816 bytes</div><div>            178704 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes:<span style="white-space:pre-wrap">        </span>[level | 17] x [lat | 73] x [lon | 144]</div><div>Coordinates: </div><div>            level: [10..1000]</div><div>            lat: [90..-90]</div><div>            lon: [ 0..357.5]</div><div>Number Of Attributes: 14</div><div>  long_name :<span style="white-space:pre-wrap">        </span>Monthly mean v wind</div><div>  units :<span style="white-space:pre-wrap">        </span>m/s</div><div>  precision :<span style="white-space:pre-wrap">        </span>2</div><div>  least_significant_digit :<span style="white-space:pre-wrap">        </span>1</div><div>  var_desc :<span style="white-space:pre-wrap">        </span>v-wind</div><div>  level_desc :<span style="white-space:pre-wrap">        </span>Multiple levels</div><div>  statistic :<span style="white-space:pre-wrap">        </span>Mean</div><div>  parent_stat :<span style="white-space:pre-wrap">        </span>Other</div><div>  missing_value :<span style="white-space:pre-wrap">        </span>-9.96921e+36</div><div>  valid_range :<span style="white-space:pre-wrap">        </span>( -125, 160 )</div><div>  dataset :<span style="white-space:pre-wrap">        </span>NCEP Reanalysis Derived Products</div><div>  actual_range :<span style="white-space:pre-wrap">        </span>( -68.57001, 68.56999 )</div><div>  _FillValue :<span style="white-space:pre-wrap">        </span>-9.96921e+36</div><div>  time :<span style="white-space:pre-wrap">        </span>1297320</div><div><br></div><div><br></div><div>Variable: level (coordinate)</div><div>Type: float</div><div>Total Size: 68 bytes</div><div>            17 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span style="white-space:pre-wrap">        </span>[level | 17]</div><div>Coordinates: </div><div>Number Of Attributes: 7</div><div>  units :<span style="white-space:pre-wrap">        </span>millibar</div><div>  long_name :<span style="white-space:pre-wrap">        </span>Level</div><div>  positive :<span style="white-space:pre-wrap">        </span>down</div><div>  GRIB_id :<span style="white-space:pre-wrap">        </span>100</div><div>  GRIB_name :<span style="white-space:pre-wrap">        </span>hPa</div><div>  actual_range :<span style="white-space:pre-wrap">        </span>( 1000, 10 )</div><div>  axis :<span style="white-space:pre-wrap">        </span>Z</div><div>(0)<span style="white-space:pre-wrap">        </span>10</div><div>(1)<span style="white-space:pre-wrap">        </span>20</div><div>(2)<span style="white-space:pre-wrap">        </span>30</div><div>(3)<span style="white-space:pre-wrap">        </span>50</div><div>(4)<span style="white-space:pre-wrap">        </span>70</div><div>(5)<span style="white-space:pre-wrap">        </span>100</div><div>(6)<span style="white-space:pre-wrap">        </span>150</div><div>(7)<span style="white-space:pre-wrap">        </span>200</div><div>(8)<span style="white-space:pre-wrap">        </span>250</div><div>(9)<span style="white-space:pre-wrap">        </span>300</div><div>(10)<span style="white-space:pre-wrap">        </span>400</div><div>(11)<span style="white-space:pre-wrap">        </span>500</div><div>(12)<span style="white-space:pre-wrap">        </span>600</div><div>(13)<span style="white-space:pre-wrap">        </span>700</div><div>(14)<span style="white-space:pre-wrap">        </span>850</div><div>(15)<span style="white-space:pre-wrap">        </span>925</div><div>(16)<span style="white-space:pre-wrap">        </span>1000</div><div><br></div><div>Variable: PsPa</div><div>Type: float</div><div>Total Size: 42048 bytes</div><div>            10512 values</div><div>Number of Dimensions: 2</div><div>Dimensions and sizes:<span style="white-space:pre-wrap">        </span>[73] x [144]</div><div>Coordinates: </div><div>Number Of Attributes: 1</div><div>  _FillValue :<span style="white-space:pre-wrap">        </span>-9.96921e+36</div><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 9, 2016 at 8:10 AM, Adam Phillips <span dir="ltr">&lt;<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.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 dir="ltr">Hi Ipshita,<div>You are altering the order of your level dimension here:</div><div><span style="font-size:12.8px">v1=v_jan_1948(::-1,:,:)   </span><br></div><div><span style="font-size:12.8px">and that is completely fine. However, you are </span><span style="font-size:12.8px">then flipping the level dimension again here when you specify v1&amp;level:</span></div><div><span style="font-size:12.8px">zmpsi = zonal_mpsi(v1,v1&amp;lat,v1&amp;level(</span><span style="font-size:12.8px"><wbr>::-1),PsPa)</span><span style="font-size:12.8px"><br></span></div><div><br></div><div>Try changing this:</div><div><span style="font-size:12.8px">zmpsi = zonal_mpsi(v1,v1&amp;lat,v1&amp;level(</span><span style="font-size:12.8px"><wbr>::-1),PsPa)</span><br></div><div><span style="font-size:12.8px">to this:</span></div><div><span style="font-size:12.8px">zmpsi = zonal_mpsi(v1,v1&amp;lat,v1&amp;level</span><span style="font-size:12.8px">,<wbr>PsPa)</span><span style="font-size:12.8px"><br></span></div><div><br></div><div>If that does not fix the issue please add printVarSummary and print statements to your script and examine the output. The end of your script should look like this:</div><div><span style="font-size:12.8px">v1=v_jan_1948(::-1,:,:)</span><br></div><div><span style="font-size:12.8px">PsPa=ps_jan_1948*100</span><span style="font-size:12.8px"><br></span></div><div><div>printVarSummary(v1)</div><div>print(v1&amp;level)</div></div><div><span style="font-size:12.8px">zmpsi = zonal_mpsi(v1,v1&amp;lat,v1&amp;level</span><span style="font-size:12.8px">,<wbr>PsPa)</span><br></div><div><br></div><div>If you still are having trouble please respond to the ncl-talk email list with the printVarSummary and print output.</div><div>Adam</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Sep 8, 2016 at 5:02 PM, Ipshita Majhi <span dir="ltr">&lt;<a href="mailto:ipmajhi@alaska.edu" target="_blank">ipmajhi@alaska.edu</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><br clear="all"><div>Dear Users,</div><div><br></div><div>I want to plot stream function of wind (v) and I am using zonal_mpsi to calculate the stream function. I keep getting error messages.</div><div><br></div><div>fatal:zonal_mpsi: The pressure array must be between the values of 500 and 100500 (exclusive), and monotonically increasing.<br></div><div><br></div><div>I am not sure how to fix this problem.</div><div><br></div><div>I am attaching my code.</div><div><br></div><div>I read in the V wind and surface pressure</div><div><br></div><div>v-wind has 4 dimensions (time,lev,lat,lon)</div><div><br></div><div>Surface pressure has 3 dimensions (time,lat,lon)</div><div><br></div><div>Here is the code I wrote</div><div><br></div><div>;*****************************<wbr>******************************<wbr>***</div><div><div>;*****************************<wbr>**************</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl&quot;</div><div>;*****************************<wbr>**************</div><div><br></div><div>;*****************************<wbr>***************</div><div>;This is to read wind speed and wind direction</div><div>;from 1948-2016</div><div>;*****************************<wbr>***************</div><div><br></div><div>a=addfile(&quot;/Users/ipshita/Docu<wbr>ments/grads_NCL/<a href="http://wspd.mon.mean.nc" target="_blank">wspd.mon.mean.<wbr>nc</a>&quot;,&quot;r&quot;)</div><div>b=addfile(&quot;/Users/ipshita/Docu<wbr>ments/grads_NCL/<a href="http://uwnd.mon.mean.nc" target="_blank">uwnd.mon.mean.<wbr>nc</a>&quot;,&quot;r&quot;)</div><div>c=addfile(&quot;/Users/ipshita/Docu<wbr>ments/grads_NCL/<a href="http://vwnd.mon.mean.nc" target="_blank">vwnd.mon.mean.<wbr>nc</a>&quot;,&quot;r&quot;)</div><div>d=addfile(&quot;/Users/ipshita/Docu<wbr>ments/grads_NCL/<a href="http://omega.mon.mean.nc" target="_blank">omega.mon.mean<wbr>.nc</a>&quot;,&quot;r&quot;)</div><div>e=addfile(&quot;/Users/ipshita/Docu<wbr>ments/grads_NCL/<a href="http://pres.sfc.mon.mean.nc" target="_blank">pres.sfc.mon.m<wbr>ean.nc</a>&quot;,&quot;r&quot;)</div><div><br></div><div>v=c-&gt;vwnd   ;Wind in horizontal direction in m/s</div><div><br></div><div>level=c-&gt;level ;Pressure level from 1000hpa to 10 hpa</div><div><br></div><div>lat=c-&gt;lat</div><div><br></div><div>lon=c-&gt;lon</div><div><br></div><div>ps=e-&gt;pres</div><div><br></div><div>ps_jan_1948=ps(0,:,:)</div><div><br></div><div>printMinMax(ps_1948_2015,False<wbr>)</div><div><br></div><div>v_jan_1948=v(0,:,:,:)</div><div>;*****************************<wbr>****************</div><div>;Going from low to high in terms of level</div><div>;*****************************<wbr>****************</div><div><br></div><div>v1=v_jan_1948(::-1,:,:)</div><div>;*****************************<wbr>****************</div><div>;Converting Pressure into Pascals</div><div>;*****************************<wbr>****************</div><div><br></div><div>PsPa=ps_jan_1948*100</div><div><br></div><div>printMinMax(PsPa,False)</div><div><br></div><div>;*****************************<wbr>****************</div><div>zmpsi = zonal_mpsi(v1,v1&amp;lat,v1&amp;level(<wbr>::-1),PsPa)</div></div><div>;*****************************<wbr>******************************<wbr>********</div><div><br></div><div>I will be grateful if you can help me resolve this issue.</div><div><br></div><div>Best Regards</div><span><font color="#888888"><div>Ipshita</div><div><div dir="ltr"><br></div></div>
</font></span></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><span><font color="#888888"><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphill<wbr>i/</a>   </font></span><span><font color="#888888"><a href="tel:303-497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</font></span></font></span></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div><div><div>Ipshita Majhi<br></div>PhD Candidate<br></div>University of Alaska , Fairbanks<br></div>Atmospheric Science Department<br></div><a href="tel:%28907%29978-4220" value="+19079784220" target="_blank">(907)978-4220</a> <a href="mailto:ipmajhi@alaska.edu" target="_blank">ipmajhi@alaska.edu</a><br></div></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/<wbr>asphilli/</a>   </font></span><span><font color="#888888"><a href="tel:303-497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>
</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>