[ncl-talk] problem at skewt plot

maryam karimian mkarimian59 at yahoo.com
Tue Jul 11 21:53:36 MDT 2017


Dear allI want to draw SKEWT gfs data. I write below script. but I have below error:fatal:Number of dimensions in parameter (2) of (skewT_PlotData) is (3), (1) dimensions were expected
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 113 in file grb-SKEWT-1.ncl

Please guide me.thanks
************************

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"
begin
 a = addfile("./gfs.t12z.pgrb2.0p50.f012.nc","r")
type = "x11"
  wks = gsn_open_wks(type,"gfs-skewt")

  gsn_define_colormap(wks,"WhViBlGrYeOrReWh")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need at time 2

    tk  =  a->TMP_P0_L100_GLL0(lv_ISBL0|:, lat_0|:, lon_0|:)          ; T in C
    tk1 = tk
    tc = tk1 - 273.15
    tc at units= "degC"

   rh   = a->RH_P0_L100_GLL0(lv_ISBL0|:, lat_0|:, lon_0|:)
   rh1 = rh
   td  = dewtemp_trh(tk1,rh1) - 273.15
   td at units = "degC"

;   p     = a->lv_ISBL0(lv_ISBL0|:)               ;  ( lv_ISBL0 )

;p     = a->PRES_P0_L103_GLL0(lat_0|:, lon_0|:)
  p = a->PRES_P0_L109_GLL0(lv_PVL3|:, lat_0|:, lon_0|:)
  p     = p*0.01                    ; change units
   p at units = "hPa"                   ; skewT, mixhum_ptrh use mb (hPa)


    u    = a->UGRD_P0_L100_GLL0(lv_ISBL0|:, lat_0|:, lon_0|:)
    v    = a->VGRD_P0_L100_GLL0(lv_ISBL0|:, lat_0|:, lon_0|:)

   ; q   = mixhum_ptrh (p, tk1, rh1, 2)
   ; q at units = "kg/kg"
 z    = a->HGT_P0_L100_GLL0

    wspd = sqrt(u^2 + v^2)
    wdir = wind_direction(u,v,0)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Get ij point in model domain for our location of interest
; loc(1) is south-north (y) and loc(0) is west-east (x)
; Ensure this point is in the domain, as we are not checking
; We are interested in NCL array pointers, so subtract 1

;  loc = wrf_user_ll_to_ij(a, 59.6, 36.3, True)
 ; locX = loc(0) - 1
 ; locY = loc(1) - 1


; Define a few skew-T plotting options
  skewtOpts          = True
  skewtOpts at DrawHeightScale   = True    ; plot height scale on side
  skewtOpts at DrawHeightScaleFt = False   ; plot height scale in km
  skewtOpts at DrawStandardAtm   = True    ; draw standard atm on plot
  skewtOpts at vpXF              = 0.12    ; controls off-set from left
  skewtOpts at vpYF              = 0.87    ; controls off-set from top
  skewtOpts at vpWidthF          = 0.75    ; controls size of plot
  skewtOpts at vpHeightF         = 0.75    ; controls size of plot
  skewtOpts at DrawFahrenheit    = False   ; use deg C scale
  skewtOpts at tiMainFontHeightF = 0.015   ; change height of main title
 ;skewtOpts at DrawColLine       = False   ; draw lines in black
  skewtOpts at DrawColAreaFill   = True    ; color on background plot
 ;skewtOpts at DrawColAreaColor  = "Green" ; final color may depend on the color table used
  skewtOpts at DrawColAreaColor  = 53      ; Light Green for WhViBlGrYeOrReWh color table
  skewtOpts at PrintOpts         = False   ; do not print options out


; Get the skew-T background
  skewtOpts at tiMainString = "Initial Condition: 12UTC 20161127, Valid for: 00UTC 20161128, D1(22.5KM)"
  skewt_bkgd             = skewT_BackGround (wks, skewtOpts)
  draw (skewt_bkgd)


; Draw the skew-T plot
  dataOpts           = True
  dataOpts at colTemperature = "Red"   ; default -> "Foreground"
  dataOpts at Parcel    = 1
  dataOpts at WspdWdir  = False  ; wind speed and dir [else: u,v]
  dataOpts at HspdHdir  = True   ; wind speed and dir [else: u,v]
 skewtOpts at tiMainString   = "Raob; Thicker Wind Barbs"
  dataOpts at DrawWindBarbThk = 1.5  ; default value is 1.0 (may be fractional)

skewt_bkgd = skewT_BackGround (wks, skewtOpts)
skewt_data = skewT_PlotData (wks, skewt_bkgd, p,tc,td,z,wspd,wdir,dataOpts)


draw (skewt_bkgd)
draw (skewt_data)
  frame(wks)

end 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170712/d7ce1f41/attachment.html 


More information about the ncl-talk mailing list