<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:["Execute.c":8575]:Execute: Error occurred at or near line 190 in file /usr/local/ncl-6.3.0/lib/ncarg/nclscripts/csm/contributed.ncl</font></div><div><font color="#ff0000">fatal:["Execute.c":8575]: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_signature" data-smartmail="gmail_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"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</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 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 class=""><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 = "velocity potential"</div><div><b><font color="#cc0000">vp</font></b>@units = "m/s"</div><div><br></div></span><div>The variable you'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="h5">On Thu, Jan 5, 2017 at 1:34 AM, Lyndon Mark Olaguera <span dir="ltr"><<a href="mailto:olagueralyndonmark429@gmail.com" target="_blank">olagueralyndonmark429@gmail.<wbr>com</a>></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 class="h5"><div dir="ltr"><div><div class="m_-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'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'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'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'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("uwind200hPa_1975.nc",<wbr>"r")</div><div>vfile = addfile("vwind200hPa_1975.nc",<wbr>"r")</div><div>uwnd = ufile->uwnd(:,:,::-1,:) ;sort coordinates usinf ::-1</div><div>printVarSummary(uwnd)</div><div><br></div><div>vwnd = vfile->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 = "velocity potential"</div><div>vp@units = "m/s"</div></div><div><div>ncdf = addfile("<a href="http://test.nc" target="_blank">test.nc</a>" ,"c") ; open output netCDF file</div><div><br></div><div>fAtt = True ; assign file attributes</div><div>fAtt@title = "Velocity Potential"</div><div>fAtt@source_file = "<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>"</div><div>fAtt@Conventions = "None"</div><div>fAtt@creation_date = systemfunc ("date")</div><div>fileattdef( ncdf, fAtt ) ; copy file attributes</div><div><br></div><div>ncdf->vp = vp</div><div>end</div></div><div><br></div><div><br></div><div>Here'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>