[ncl-talk] Error with gsn_csm_pres_hgt

Shreta Ghimire shreta.g at gmail.com
Tue Jul 12 23:42:40 MDT 2016


Hello,

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

*(0)     gsn_csm_pres_hgt: Fatal: The first dimension of the input data
must*
*(0)     have a coordinate variable called 'lev.'*
*(0)     Cannot create plot.*
*fatal:Illegal right-hand side type for assignment*
*fatal:["Execute.c":8128]:Execute: Error occurred at or near line 118 in
file check_Verticle.ncl*

I have checked the earlier talk on the similar error "
http://www.ncl.ucar.edu/Support/talk_archives/2009/1887.html "
I tried to fix the error but still the code is producng the same error.

Here is the code that i have used.

*; ***************************************
*; Load Packages*
*; ***************************************
*load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"   *
*load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"*
*load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"*
*load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"*

*; ***************************************
*; Read File*
*; ***************************************

*a = addfile("wrfout_d01.nc <http://wrfout_d01.nc>", "r")*

*; ***************************************
*; Read Variable*
*; ***************************************

*theta = a->T*
*perturbP = a->P*
*baseStateP = a->PB*

*; ***************************************
*; Calculations*
*; ***************************************
*P1 = perturbP + baseStateP*
*theta = theta + 300*

*TK = wrf_tk(P1,theta)*

*; ***************************************
*; Rename Dimensions of Variable*
*; ***************************************
*TK!0 = "time"*
*TK!1 = "lev"*
*TK!2 = "lat"*
*TK!3 = "lon"*

*; ***************************************
*; reorder the dimensions *
*; compute average based on dimensions*
*; ***************************************

*TKreorder = TK(lev|:,lat|:,lon|:,time|:)                ;
(lev,lat,lon,time)*

*TKtime = dim_avg_Wrap(TKreorder) ; (lev,lat,lon)*

*TKtimeAvg = dim_avg_Wrap(TKtime_reorder)   ; (lev,lat)*

*printVarSummary(TKtimeAvg)*

*; ***************************************
*; Creat Plot*
*; ***************************************
*wks = gsn_open_wks("png", "PressVsLat_TK")*
*gsn_define_colormap(wks,"NCV_bright")*

*res = True*
*res at cnFillOn = True*
*res at lbLabelAutoStride = True*

*plot = gsn_csm_pres_hgt(wks,TKtimeAvg(lev|:,lat|:),res)*
; ==================================================

printVarSummary(TKtimeAvg) gives the following output, which shows the
first dimension of the variable to be "lev"

         Variable: TKtimeAvg
         Type: float
         Total Size: 32000 bytes
                         8000 values
         Number of Dimensions: 2
         Dimensions and sizes:   [lev | 40] x [lat | 200]
         Coordinates:
         Number Of Attributes: 3
             units :       K
             description : Temperature
             average_op_ncl :      dim_avg over dimension(s): lon




Regards,
Shreta Ghimire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160713/dbf071db/attachment.html 


More information about the ncl-talk mailing list