<div dir="ltr">Dear Sir Dennis,<div><br></div><div>Many thanks for the suggestion. </div><div><br></div><div><div class="gmail_extra">I still have one question though:</div><div class="gmail_extra"><br></div><div class="gmail_extra">According to the ncl page:</div><div class="gmail_extra"><i><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"><br></span></i></div><div class="gmail_extra"><i><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">The returned array will be dimensioned 2 x </span><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml" style="margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133);font-family:verdana,sans-serif;font-size:13.3333px"><strong style="margin:0px;padding:0px">dimsizes</strong></a><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">(u), where the 0-th element of the leftmost dimension contains the stream function and the 1-th element of the leftmost dimension contains the velocity potential (both in ascending latitude order)</span><br clear="all"></i><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><i><br></i></div><div>If I understand this correctly, I should be adding this line in the script to save only the calculated velocity potential?</div><div><br></div><div><b style="color:rgb(255,0,0);font-size:12.8px">sfvp = sfvp(1,:,:,:)</b><br></div><div><b style="color:rgb(255,0,0);font-size:12.8px"><br></b></div><div><br></div><div><div style="font-size:12.8px"><div>begin</div><div>ufile = addfile(&quot;uwind200hPa_1975.nc&quot;,<wbr>&quot;r&quot;)       ;single level(200hPa) only</div><div>vfile = addfile(&quot;vwind200hPa_1975.nc&quot;,<wbr>&quot;r&quot;)        ;single level(200hPa) only</div><div><br></div><div>uwnd = ufile-&gt;uwnd(:,0,::-1,:)     ;sort coordinates usinf ::-1</div><div>printVarSummary(uwnd)</div><div><br></div><div>vwnd = vfile-&gt;vwnd(:,0,::-1,:)     ;sort coordinates using ::-1</div><div>printVarSummary(vwnd)</div><div><br></div><div>sfvp = uv2sfvpF(uwnd,vwnd)</div><div><br></div><div><font color="#ff0000"><b>sfvp = sfvp(1,:,:,:)</b></font></div><div><br></div><div>sfvp = sfvp/1e6                  ;rescaling by 1e6</div><div><br></div><div><b><font color="#ff0000">copy_VarCoords(uwnd,sfvp)</font></b></div><div><br></div><div>sfvp@long_name = &quot;velocity potential&quot;</div><div>sfvp@units     = &quot;m/s&quot;</div></div><div style="font-size:12.8px"><div>ncdf = addfile(&quot;<a href="http://test.nc/" target="_blank">test.nc</a>&quot; ,&quot;c&quot;)  ; open output netCDF file</div><div><br></div><div>fAtt               = True            ; assign file attributes</div><div>fAtt@title         = &quot;Velocity Potential&quot;</div><div>fAtt@source_file   =  &quot;<a href="https://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.pressure.html" target="_blank">https://www.esrl.noaa.gov/<wbr>psd/data/gridded/data.ncep.<wbr>reanalysis.pressure.html</a>&quot;</div><div>fAtt@Conventions   = &quot;None&quot;</div><div>fAtt@creation_date = systemfunc (&quot;date&quot;)</div><div>fileattdef( ncdf, fAtt )            ; copy file attributes</div><div><br></div><div>ncdf-&gt;sfvp = sfvp</div><div>end</div></div></div><div><br></div><div><br></div><div>Many thanks for the help.</div><div><br></div><div><b>Lyndz</b></div></div></div></div></div></div></div></div></div></div>
<div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><br><div class="gmail_quote">On Fri, Jan 6, 2017 at 10:23 AM, &quot;김창환&quot; <span dir="ltr">&lt;<a href="mailto:blueedu@korea.kr" target="_blank">blueedu@korea.kr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p style="border:0px;padding:0px;margin:0px;font-family:돋움;font-size:10pt"></p><p style="margin:0px;padding:0px;border:0px currentcolor;line-height:1.5;font-family:돋움;font-size:10pt">Hi,</p><p style="margin:0px;padding:0px;border:0px currentcolor;line-height:1.5;font-family:돋움;font-size:10pt"> </p><p style="margin:0px;padding:0px;border:0px currentcolor;line-height:1.5;font-family:돋움;font-size:10pt">Why don&#39;t you use &quot;<strong><font color="#cc0000">sfvp</font></strong> = <b><font color="#990000">sfvp </font></b>/ 1e6&quot; instead of &quot;<font color="#cc0000"><strong>sfvp</strong></font> = (/<b><font color="#990000">sfvp</font></b>/1e6/)&quot;?</p><p style="margin:0px;padding:0px;border:0px currentcolor;line-height:1.5;font-family:돋움;font-size:10pt"><font color="#cc0000"><font color="#000000">and</font><strong> vp</strong></font> = (/<b><font color="#cc0000">vp</font></b>/1e6/) =&gt; <strong><font color="#cc0000">vp</font></strong> = <b><font color="#cc0000">vp</font></b>/1e6 </p><p style="margin:0px;padding:0px;border:0px currentcolor;line-height:1.5;font-family:돋움;font-size:10pt"> </p><p style="margin:0px;padding:0px;border:0px currentcolor;line-height:1.5;font-family:돋움;font-size:10pt">Changhwan.</p><div style="color:rgb(0,102,204);font-family:돋움,arial;font-size:12px;font-weight:bold;margin-top:30px;margin-left:0.8em">--------- 원본 메일 ---------</div><blockquote style="margin:0pt 0pt 0pt 0.8em;padding-left:1em;font-size:12px;border-left-width:2px;border-left-style:solid"><div style="line-height:1.5;font-family:arial,돋움"><b>보낸사람</b> : Lyndon Mark Olaguera &lt;<a href="mailto:olagueralyndonmark429@gmail.com" target="_blank">olagueralyndonmark429@gmail.<wbr>com</a>&gt;<br><b>받는사람</b> : Mary Haley &lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;<br><b>참조</b> : &quot;<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>&quot; &lt;<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>&gt;<br><b>받은날짜</b> : 2017년 Jan 6일(Fri) 10:12:36<br><b>제목</b> : Re: [ncl-talk] Calculating Velocity Potential (problem with saving        output)<div><div class="gmail-h5"><br><div style="margin-top:5px"><div dir="ltr">Dear Mary,<div><br></div><div>I corrected my script but I still encounter the following errors:</div><div><br></div><div><div><font color="#ff0000">fatal:Subscript out of range, error in subscript #0</font></div><div><font color="#ff0000">fatal:An error occurred reading dfrom</font></div><div><font color="#ff0000">fatal:[&quot;Execute.c&quot;:8575]:<wbr>Execute: Error occurred at or near line 190 in file /usr/local/ncl-6.3.0/lib/<wbr>ncarg/nclscripts/csm/<wbr>contributed.ncl</font></div><div><font color="#ff0000">fatal:[&quot;Execute.c&quot;:8575]:<wbr>Execute: Error occurred at or near line 20 in file chi.ncl</font></div></div><div><br></div><div><br></div><div>Line 20 in the script is the <span style="color:rgb(80,0,80);font-size:12.8px">copy_VarCoords(ufile,</span><font color="#cc0000" style="font-size:12.8px"><b>vp</b></font><span style="color:rgb(80,0,80);font-size:12.8px">). </span></div><div><span style="color:rgb(80,0,80);font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><font color="#000000">Any suggestions to properly output this?</font></span></div><div><span style="font-size:12.8px"><font color="#000000"><br></font></span></div><div><span style="font-size:12.8px"><font color="#000000">Many thanks,</font></span></div><div class="gmail_extra"><br clear="all"><div><div class="gmail-m_-3658964425906237427gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><font face="comic sans ms, sans-serif"><b><u>Lyndz</u></b></font></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Fri, Jan 6, 2017 at 12:39 AM, Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left:1px solid rgb(204,204,204)"><div dir="ltr"><div style="font-size:small">Lyndz,</div><div style="font-size:small"><br></div><div style="font-size:small">It looks like a simple typo.  You have:</div><div style="font-size:small"><br></div><div><span><div><b><font color="#cc0000">sfvp</font></b> = uv2sfvpF(uwnd,vwnd)</div><div><b><font color="#cc0000">sfvp</font></b> = (/<b><font color="#990000">sfvp</font></b>/1e6/)                   ;rescaling by 1e6</div><div><br></div><div>copy_VarCoords(ufile,<font color="#cc0000"><b>vp</b></font>)</div><div><br></div><div><b><font color="#cc0000">vp</font></b>@long_name = &quot;velocity potential&quot;</div><div><b><font color="#cc0000">vp</font></b>@units     = &quot;m/s&quot;</div><div><br></div></span><div>The variable you&#39;re computing is called <b><font color="#cc0000">sfvp</font></b>, but then you refer to <b><font color="#cc0000">vp</font></b> after that. Change the two <b><font color="#cc0000">sfvp</font></b> lines to be <b><font color="#cc0000">vp</font></b> instead:</div><div><br></div><div><div><b><font color="#cc0000">vp</font></b> = uv2sfvpF(uwnd,vwnd)</div><div><b><font color="#cc0000">vp</font></b> = (/<b><font color="#cc0000">vp</font></b>/1e6/)                   ;rescaling by 1e6</div><div><br></div><div>--Mary</div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="gmail-m_-3658964425906237427h5">On Thu, Jan 5, 2017 at 1:34 AM, Lyndon Mark Olaguera <span dir="ltr">&lt;<a href="mailto:olagueralyndonmark429@gmail.com" target="_blank">olagueralyndonmark429@gmail.c<wbr>om</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left:1px solid rgb(204,204,204)"><div><div class="gmail-m_-3658964425906237427h5"><div dir="ltr"><div><div class="gmail-m_-3658964425906237427m_-3790415598148152265m_-8213661668546040251gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Dear All,</div><div><br></div><div>I&#39;m trying to calculate the velocity potential (fixed grid) at 200 hPa from NCEP daily reanalysis data. I am using the uv2sfvpF(u,v) function. </div><div><br></div><div>I am having trouble in saving the output to a netcdf file. How do I save the calculated velocity potential with the same grid coordinates (i.e. same lat order as the original file) as the original file?</div><div><br></div><div>I attached the link of the files that I&#39;m working with and the script in this email.</div><div>I highlight in red the line where I got stuck.</div><div><br></div><div>I&#39;ll appreciate any help. </div><div><br></div><div>Many thanks,</div><div><br></div><div>Lyndz</div><div><br></div><div><br></div><div>Here&#39;s my script:</div><div><div><br></div><div>;*****************************<wbr>***********************</div><div>;This script calculates the velocity potential</div><div>;Input: U and V wind components</div><div>;*****************************<wbr>***********************</div><div>begin</div><div>ufile = addfile(&quot;uwind200hPa_1975.nc&quot;,<wbr>&quot;r&quot;)</div><div>vfile = addfile(&quot;vwind200hPa_1975.nc&quot;,<wbr>&quot;r&quot;)</div><div>uwnd = ufile-&gt;uwnd(:,:,::-1,:)     ;sort coordinates usinf ::-1</div><div>printVarSummary(uwnd)</div><div><br></div><div>vwnd = vfile-&gt;vwnd(:,:,::-1,:)     ;sort coordinates using ::-1</div><div>printVarSummary(vwnd)</div><div><br></div><div>sfvp = uv2sfvpF(uwnd,vwnd)</div><div>sfvp = (/sfvp/1e6/)                   ;rescaling by 1e6</div><div><br></div><div><b><font color="#ff0000">copy_VarCoords(ufile,vp)</font></b></div><div><br></div><div>vp@long_name = &quot;velocity potential&quot;</div><div>vp@units     = &quot;m/s&quot;</div></div><div><div>ncdf = addfile(&quot;<a href="http://test.nc" target="_blank">test.nc</a>&quot; ,&quot;c&quot;)  ; open output netCDF file</div><div><br></div><div>fAtt               = True            ; assign file attributes</div><div>fAtt@title         = &quot;Velocity Potential&quot;</div><div>fAtt@source_file   =  &quot;<a href="https://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.pressure.html" target="_blank">https://www.esrl.noaa.gov/ps<wbr>d/data/gridded/data.ncep.reana<wbr>lysis.pressure.html</a>&quot;</div><div>fAtt@Conventions   = &quot;None&quot;</div><div>fAtt@creation_date = systemfunc (&quot;date&quot;)</div><div>fileattdef( ncdf, fAtt )            ; copy file attributes</div><div><br></div><div>ncdf-&gt;vp = vp</div><div>end</div></div><div><br></div><div><br></div><div>Here&#39;s the link to the files:</div><div><br></div><div><a href="https://drive.google.com/drive/folders/0B9faET7Bc2o8MmtGS2VJLTB2NE0?usp=sharing" target="_blank">https://drive.google.com/drive<wbr>/folders/0B9faET7Bc2o8MmtGS2VJ<wbr>LTB2NE0?usp=sharing</a></div></div></div></div></div></div></div></div></div>
</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><br></div>
</blockquote></div><br></div></div>
</div><br></div></div></div></blockquote><p></p>
<img src="http://kmmbox.korea.kr/checkread/MTY4MTcyODg=/b2xhZ3VlcmFseW5kb25tYXJrNDI5QGdtYWlsLmNvbQ==/Mg==/MA==/" width="1px" height="1px"></blockquote></div><br></div></div></div>