[ncl-talk] Problem with plotting skewt plot

Vidhi Bharti vidhi.bharti at monash.edu
Tue Jun 18 21:13:55 MDT 2019


Hi,

I am trying to plot WRF soundings with station data using skewt_4.ncl
and skewt_10.ncl. WRF soundings are plotted fine but for the station data,
there are always black lines printed on top as shown in the figure. PFA.
See code as well.
I tried:
 skewtOpts at Panel = True ; Default is False

but then it did not plot the wind barbs as well.
I need to plot the wind barbs. Please help.

Thank you so much.

Regards,
Vidhi








*Kind RegardsVidhi BhartiRoom No - 106, 9 Rainforest WalkSchool of Earth,
Atmosphere and EnvironmentMonash UniversityClayton Campus, Melbourne VIC
3800T:  +61-3-9905-5831*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190619/5cf0290f/attachment-0001.html>
-------------- next part --------------
;**************************************************
; skewt_4.ncl
;
; Concepts illustrated:
;   - Drawing Skew-T plots
;   - Drawing two raobs on the same Skew-T plot
;   - Customizing the background of a Skew-T plot
;**************************************************
;
; This file is loaded by default in NCL V6.2.0 and newer
; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
;
; This file still has to be loaded maually


 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"

 begin

; --- Read Data ----------------------------------------;
  diri = "./"
  fili = "sounding_201603312345Z.txt"
  nlvl = 3641
  ncol = 6 
  TestData = asciiread (diri+fili , (/nlvl,ncol/), "float")
  p_obs    = TestData (:,0)
  tc_obs   = TestData (:,1)
  tdc_obs  = TestData (:,2)
  z_obs    = TestData (:,3)
  ;wspd     = TestData (:,4)
  ;wdir     = TestData (:,5)
  u_obs = TestData (:,4)
  v_obs = TestData (:,5)

  p_obs at _FillValue = -32768
  tc_obs at _FillValue = -32768
  tdc_obs at _FillValue = -32768
  z_obs at _FillValue = -32768
  ;wdir at _FillValue = -32768
  ;wspd at _FillValue = -32768
  u_obs at _FillValue = -32768
  v_obs at _FillValue = -32768


;*************************
; create plot
;*************************
  wks  = gsn_open_wks ("x11", "skewt_sound1")  ; send graphics to PNG file

; --- Create background skew-T and plot sounding----------------

  skewtOpts                 = True
  skewtOpts at DrawColAreaFill = True    ; default is False
  skewtOpts at DrawStandardAtm   = True    ; draw standard atm on plot
  skewtOpts at DrawHeightScale  = True    ; default is False
  skewtOpts at DrawHeightScaleFt = False ;plot height scale in km
  skewtOpts at DrawFahrenheit   = False   ; default is True
  skewtOpts at PrintOpts         = False   ;
  skewtOpts at tiMainString    = "CAPRICORN 2016 sounding vs. WRF sounding 31 March 2016"

  skewt_bkgd = skewT_BackGround (wks, skewtOpts)
  draw (skewt_bkgd)

  dataOpts                  = True     ; options describing data and ploting
  dataOpts at PrintZ           = True    ; do not print Z
  dataOpts at DrawFahrenheit   = False    ; default is True
  dataOpts at ThermoInfo       = False   ; print thermodynamic info

;*****************************************************************
; First sounding
;*****************************************************************
  dataOpts at colTemperature   = "blue"
  dataOpts at colDewPt         = "blue"
  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]
  dataOpts at PlotWindH = False  ; plot wind barbs at h lvls [pibal; special]
  dataOpts at xpWind           = 40     ; move to left [default is 45]
  dataOpts at DrawWindBarbThk = 1.0     ; wind barb thickness
  dataOpts at Wthin           = 20
  skewt_data = skewT_PlotData(wks, skewt_bkgd, p_obs, (tc_obs)-273.16, (tdc_obs)-273.16, z_obs/1000., u_obs, v_obs, dataOpts)
  draw (skewt_data)

;*****************************************************************
; Second sounding   [bogus data: original altered slightly]
;*****************************************************************

 ncdf_in    = addfile("wrfout_d03_2016-03-31_23:30:00","r")
 P_tot      = wrf_user_getvar(ncdf_in,"pressure",0)  ; model 3D pressure
 z_tot      = wrf_user_getvar(ncdf_in,"z",-1)        ; model 3D height
 uvmet      = wrf_user_getvar(ncdf_in,"uvmet",-1)    ; Earth-relative U and V winds on mass points
 U          = uvmet(0,0,:,:,:)*1.94                      ; Earth-relative U wind on mass points
 V          = uvmet(1,0,:,:,:)*1.94                       ; Earth-relative V wind on mass points
 TC         = wrf_user_getvar(ncdf_in,"tc",-1)       ; model temperature in Celsius
 TD         = wrf_user_getvar(ncdf_in,"td",-1)       ; model dewpoint in Celsius

 snd_lat= -50.4
 snd_lon = 147.03
 loc = wrf_user_ll_to_ij(ncdf_in,snd_lon,snd_lat,True)  ; model i,j indices for the given lat/lon
 locX = loc(0) - 1                           ; subtract 1, since WRF is base 1, but NCL is base 0
 locY = loc(1) - 1                           ; subtract 1, since WRF is base 1, but NCL is base 0

 dataOpts at colTemperature  = "red"  ; temperature line color
 dataOpts at colDewPt        = "red" ; dewpoint line color
 dataOpts at DrawWindBarbThk = 1.0     ; wind barb thickness
 dataOpts at Parcel          = 1      ; subscript corresponding to initial parcel
 dataOpts at WspdWdir        = False  ; True = use wind speed and dir, False = use U & V
 dataOpts at Wthin           = 5      ; 0 = draw wind barbs at all levels, 1 = draw every other, 2 = every 3rd, etc.
 dataOpts at xpWind    = 45
 skewT_data = skewT_PlotData(wks, skewt_bkgd, P_tot(:,locY,locX),TC(0,:,locY,locX),TD(0,:,locY,locX),z_tot(0,:,locY,locX),U(:,locY,locX),V(:,locY,locX),dataOpts)
 draw (skewT_data)

 frame(wks)

 end

-------------- next part --------------
A non-text attachment was scrubbed...
Name: April2.png
Type: image/png
Size: 437699 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190619/5cf0290f/attachment-0001.png>


More information about the ncl-talk mailing list