<div dir="ltr"><div><div><div>Hi,<br><br></div>I don't know for certain, but I suspect that although you've given names to the dimensions of your variable TKtimeAvg, there are likely no coordinate-variables in your file by that name. The printVarSummary shows no coordinates associated with the variable. Your input file appears to be a WRF file, and for example, the latitude coordinates in a WRF file are typically named XLAT (and are two/three dimensional). I don't know offhand what would correspond to "lev".<br><br></div>Hopefully that helps some...<br></div>Rick<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 12, 2016 at 11:42 PM, Shreta Ghimire <span dir="ltr"><<a href="mailto:shreta.g@gmail.com" target="_blank">shreta.g@gmail.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">Hello, <div><br></div><div>I am fairly new to NCL. I am using ncl version 6.1.2. I am trying to create a Press/Hgt vs Lat plot using gsn_csm_pres_hgt and it's throwing me the following error</div><div><font face="monospace, monospace"><b><br></b></font></div><div><div><font face="monospace, monospace"><b>(0) gsn_csm_pres_hgt: Fatal: The first dimension of the input data must</b></font></div><div><font face="monospace, monospace"><b>(0) have a coordinate variable called 'lev.'</b></font></div><div><font face="monospace, monospace"><b>(0) Cannot create plot.</b></font></div><div><font face="monospace, monospace"><b>fatal:Illegal right-hand side type for assignment</b></font></div><div><font face="monospace, monospace"><b>fatal:["Execute.c":8128]:Execute: Error occurred at or near line 118 in file check_Verticle.ncl</b></font></div><div><br></div><div>I have checked the earlier talk on the similar error " <a href="http://www.ncl.ucar.edu/Support/talk_archives/2009/1887.html" target="_blank">http://www.ncl.ucar.edu/Support/talk_archives/2009/1887.html</a> " </div><div>I tried to fix the error but still the code is producng the same error. </div><div><br></div><div>Here is the code that i have used. </div><div><br></div><div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">; Load Packages</font></i></div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" </font></i></div><div><i><font face="monospace, monospace">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</font></i></div><div><i><font face="monospace, monospace">load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</font></i></div><div><i><font face="monospace, monospace">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</font></i></div><div><i><font face="monospace, monospace"><br></font></i></div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">; Read File</font></i></div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">a = addfile("<a href="http://wrfout_d01.nc" target="_blank">wrfout_d01.nc</a>", "r")<br></font></i></div></div><div><div data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div><i><font face="monospace, monospace"><br></font></i></div><div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">; Read Variable</font></i></div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">theta = a->T<br></font></i></div><div><i><font face="monospace, monospace">perturbP = a->P</font></i></div><div><i><font face="monospace, monospace">baseStateP = a->PB</font></i></div><div><i><font face="monospace, monospace"><br></font></i></div><div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">; Calculations</font></i></div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">P1 = perturbP + baseStateP</font></i></div><div><i><font face="monospace, monospace">theta = theta + 300</font></i></div><div><i><font face="monospace, monospace"><br></font></i></div><div><i><font face="monospace, monospace">TK = wrf_tk(P1,theta)</font></i></div></div><div><i><font face="monospace, monospace"><br></font></i></div><div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">; Rename Dimensions of Variable</font></i></div><div><i><font face="monospace, monospace">; **************************************</font></i></div></div><div><div><i><font face="monospace, monospace">TK!0 = "time"</font></i></div><div><i><font face="monospace, monospace">TK!1 = "lev"</font></i></div><div><i><font face="monospace, monospace">TK!2 = "lat"</font></i></div><div><i><font face="monospace, monospace">TK!3 = "lon"</font></i></div></div><div><i><font face="monospace, monospace"><br></font></i></div><div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">; reorder the dimensions </font></i></div><div><i><font face="monospace, monospace">; compute average based on dimensions</font></i></div><div><i><font face="monospace, monospace">; **************************************</font></i></div></div><div><i><font face="monospace, monospace">TKreorder = TK(lev|:,lat|:,lon|:,time|:) ; (lev,lat,lon,time)<br></font></i></div><div><i><font face="monospace, monospace">TKtime = dim_avg_Wrap(TKreorder)<span style="white-space:pre-wrap">         </span>; (lev,lat,lon)<br></font></i></div><div><i><font face="monospace, monospace">TKtimeAvg = dim_avg_Wrap(TKtime_reorder) ; (lev,lat)<br></font></i></div><div><i><font face="monospace, monospace">printVarSummary(TKtimeAvg)<br></font></i></div><div><i><font face="monospace, monospace"><br></font></i></div><div><div><i><font face="monospace, monospace">; **************************************</font></i></div><div><i><font face="monospace, monospace">; Creat Plot</font></i></div><div><i><font face="monospace, monospace">; **************************************</font></i></div></div><div><div><i><font face="monospace, monospace">wks = gsn_open_wks("png", "PressVsLat_TK")</font></i></div><div><i><font face="monospace, monospace">gsn_define_colormap(wks,"NCV_bright")</font></i></div></div><div><i><font face="monospace, monospace"><br></font></i></div><div><div><i><font face="monospace, monospace">res = True</font></i></div><div><i><font face="monospace, monospace">res@cnFillOn = True</font></i></div><div><i><font face="monospace, monospace">res@lbLabelAutoStride = True</font></i></div></div><div><i><font face="monospace, monospace"><br></font></i></div><div><i><font face="monospace, monospace">plot = gsn_csm_pres_hgt(wks,TKtimeAvg(lev|:,lat|:),res)</font></i><br></div><div>; ==================================================<br></div><div><br></div><div>printVarSummary(TKtimeAvg) gives the following output, which shows the first dimension of the variable to be "lev"</div><div><br></div><div><div> <font face="monospace, monospace">Variable: TKtimeAvg</font></div><div><font face="monospace, monospace"> Type: float</font></div><div><font face="monospace, monospace"> Total Size: 32000 bytes</font></div><div><font face="monospace, monospace"> 8000 values</font></div><div><font face="monospace, monospace"> Number of Dimensions: 2</font></div><div><font face="monospace, monospace"> Dimensions and sizes: [lev | 40] x [lat | 200]</font></div><div><font face="monospace, monospace"> Coordinates:</font></div><div><font face="monospace, monospace"> Number Of Attributes: 3</font></div><div><font face="monospace, monospace"> units : K</font></div><div><font face="monospace, monospace"> description : Temperature</font></div><div><font face="monospace, monospace"> average_op_ncl : dim_avg over dimension(s): lon</font></div></div><div><br></div><div><br></div><div><br></div><div><br></div>Regards,<br>Shreta Ghimire<br><br></div></div></div></div></div>
</div></div>
<br>_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>