<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 5 Jan 2017, at 20:54, Lyndon Mark Olaguera &lt;<a href="mailto:olagueralyndonmark429@gmail.com" class="">olagueralyndonmark429@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><b style="font-family: Helvetica; font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: rgb(255, 0, 0); font-size: 12.8px;" class="">sfvp = sfvp(1,:,:,:)</b></div></blockquote></div><br class=""><div class="">This won’t in NCL. &nbsp;NCL won’t dynamically change the size of an existing variable. &nbsp;</div><div class=""><br class=""></div><div class="">You can (assuming you’re using a recent version of NCL) however use the := notation, which will effectively redefine the sfvp variable. &nbsp;e.g. &nbsp;sfvp := sfvp(1,:,:,:)</div><div class="">Then the rest of your script should work as expected. &nbsp;</div><div class=""><br class=""></div><div class="">Though for the sake of having variable names that make sense I would do as below.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><div class=""><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">begin</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">ufile = addfile("uwind200hPa_1975.nc",<wbr class="">"r") &nbsp; &nbsp; &nbsp; ;single level(200hPa) only</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">vfile = addfile("vwind200hPa_1975.nc",<wbr class="">"r") &nbsp; &nbsp; &nbsp; &nbsp;;single level(200hPa) only</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class=""><br class=""></font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">uwnd = ufile-&gt;uwnd(:,0,::-1,:) &nbsp; &nbsp; ;sort coordinates usinf ::-1</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">printVarSummary(uwnd)</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class=""><br class=""></font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">vwnd = vfile-&gt;vwnd(:,0,::-1,:) &nbsp; &nbsp; ;sort coordinates using ::-1</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">printVarSummary(vwnd)</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class=""><br class=""></font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">sfvp = uv2sfvpF(uwnd,vwnd)</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class=""><br class=""></font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">vp = sfvp(1,:,:,:)</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class=""><br class=""></font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">vp = vp/1e6 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;rescaling by 1e6</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class=""><br class=""></font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">copy_VarCoords(uwnd,vp)</font></div><div style="font-size: 12.8px;" class=""><font face="InputMono-Regular" class="">vp@long_name = "velocity potential"</font></div><div class=""><font face="InputMono-Regular" style="font-size: 12.8px;" class="">vp@units &nbsp; &nbsp; = "m/s</font><font face="InputMono-Regular" class=""><span style="font-size: 12.800000190734863px;" class="">”</span></font></div><div style="font-size: 12.8px;" class=""><span style="font-family: InputMono-Regular;" class="">printVarSummary(</span><span style="font-family: InputMono-Regular;" class="">vp</span><span style="font-family: InputMono-Regular;" class="">)</span></div></div><div style="font-size: 12.8px;" class=""><span style="font-family: InputMono-Regular;" class=""><br class=""></span></div><div style="font-size: 12.8px;" class=""><div class=""><font face="InputMono-Regular" class="">ncdf = addfile("<a href="http://test.nc/" target="_blank" class="">test.nc</a>" ,"c") &nbsp;; open output netCDF file</font></div><div class=""><font face="InputMono-Regular" class=""><br class=""></font></div><div class=""><font face="InputMono-Regular" class="">fAtt &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = True &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; assign file attributes</font></div><div class=""><font face="InputMono-Regular" class="">fAtt@title &nbsp; &nbsp; &nbsp; &nbsp; = "Velocity Potential"</font></div><div class=""><font face="InputMono-Regular" class="">fAtt@source_file &nbsp; = &nbsp;"<a href="https://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.pressure.html" target="_blank" class="">https://www.esrl.noaa.gov/<wbr class="">psd/data/gridded/data.ncep.<wbr class="">reanalysis.pressure.html</a>"</font></div><div class=""><font face="InputMono-Regular" class="">fAtt@Conventions &nbsp; = "None"</font></div><div class=""><font face="InputMono-Regular" class="">fAtt@creation_date = systemfunc ("date")</font></div><div class=""><font face="InputMono-Regular" class="">fileattdef( ncdf, fAtt ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; copy file attributes</font></div><div class=""><font face="InputMono-Regular" class=""><br class=""></font></div><div class=""><font face="InputMono-Regular" class="">ncdf-&gt;sfvp = vp</font></div><div class=""><font face="InputMono-Regular" class="">end</font></div><div class=""><br class=""></div></div></div></div></body></html>