[ncl-talk] Streamlines Vertical Cross Section
Thomas Orton
thomasorton94 at hotmail.co.uk
Thu Dec 11 17:56:36 MST 2014
Dear NCL help team,
I am having issues plotting a vertical cross section of a streamline of wind. I am trying to plot a cross section of Vertical velocity and horizontal (U) winds. This plot is 90 degrees so I am ignoring V winds. Obviously U winds are much stronger than W so I have manually adjusted these by multiplying it by 100. I have included the script below in addition to the screen output. Please can you advise me on how to do this.
Many Thanks
Thomas Orton
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin;; The WRF ARW input file.; This needs to have a ".nc" appended, so just do it. a = addfile("wrf.nc","r")
; We generate plots, but what kind do we prefer? type = "x11"; type = "pdf"; type = "ps"; type = "ncgm" wks = gsn_open_wks(type,"plt_CrossSection2")
; Set some basic resources res = True res at MainTitle = "REAL-TIME WRF"
pltres = True
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FirstTime = True times = wrf_user_list_times(a) ; get times in the file ntimes = dimsizes(times) ; number of times in the file
mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the file nd = dimsizes(mdims)
;---------------------------------------------------------------
do it = 0,ntimes-1,2 ; TIME LOOP
ua_in = wrf_user_getvar(a,"ua",it) ; Horizontal Winds va_in = wrf_user_getvar(a,"va",it) ; Other Horizontal Wind wa_in = wrf_user_getvar(a,"wa",it) ; Vertical Winds z_in = wrf_user_getvar(a,"z",it) ; grid point Height
ter_in = wrf_user_getvar(a,"HGT",it) ; Terrain Height T_in = wrf_user_getvar(a,"T",it) ; Potential Temperature; pa_in = wrf_user_getvar(a,"p",it) ; Pressure
ua = ua_in(0:45,:,:) va = va_in(0:45,:,:) wa = wa_in(0:45,:,:) z = z_in(0:45,:,:) T = T_in(0:45,:,:); pa = pa_in(0:45,:,:)
ua = ua*1.94386 va = va*1.94386 wa = wa*1.94386;------------------------------------------------------------;===========================================================; Altered Values of wa (multiplied by 100) for visual purposes
wa = wa*100;===========================================================;---------------------------------------------------------- opts = True ; setting start and end points plane = new(4,float) pii = 3.14159 plane = (/100,105, 0,0/) ; start x;y & end x;y point angle = 90.0
ua_plane = wrf_user_intrp3d(ua,z,"v",plane,angle,opts) va_plane = wrf_user_intrp3d(va,z,"v",plane,angle,opts) wa_plane = wrf_user_intrp3d(wa,z,"v",plane,angle,opts) T_plane = wrf_user_intrp3d(T,z,"v",plane,angle,opts)
res = TrueT_plane!0 = "lev"ua_plane!0 = "lev"va_plane!0 = "lev"
printVarSummary(T_plane)printVarSummary(ua_plane)printVarSummary(va_plane)
;------- MAKE PLOTS -----------------------------------------plot = gsn_csm_pres_hgt_streamline(wks,T_plane,ua_plane,wa_plane,res);-------------------------------------------------------------
end do ;ends the time loop
end
Screen output:
Variable: times
Type: stringTotal Size: 8 bytes 1 valuesNumber of Dimensions: 1Dimensions and sizes: [1]Coordinates:Number Of Attributes: 2 description : times in file _FillValue : missing(0) 2013-07-31_15:00:00
Variable: T_planeType: floatTotal Size: 2000 bytes 500 valuesNumber of Dimensions: 2Dimensions and sizes: [lev | 100] x [Horizontal | 5]Coordinates:Number Of Attributes: 4 _FillValue : 9.96921e+36 units : K description : perturbation potential temperature (theta-t0) Orientation : Cross-Section: (100,0) to (104,0)
Variable: ua_planeType: floatTotal Size: 2000 bytes 500 valuesNumber of Dimensions: 2Dimensions and sizes: [lev | 100] x [Horizontal | 5]Coordinates:Number Of Attributes: 4 _FillValue : 9.96921e+36 units : m s-1 description : x-wind component Orientation : Cross-Section: (100,0) to (104,0)
Variable: va_planeType: floatTotal Size: 2000 bytes 500 valuesNumber of Dimensions: 2Dimensions and sizes: [lev | 100] x [Horizontal | 5]Coordinates:Number Of Attributes: 4 _FillValue : 9.96921e+36 units : m s-1 description : y-wind component Orientation : Cross-Section: (100,0) to (104,0)(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 assignmentfatal:["Execute.c":8128]:Execute: Error occurred at or near line 12763 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 92 in file stream5.txt
Undergraduate Meteorology StudentSchool of Earth and EnvironmentUniversity of LeedsWest YorkshireUnited Kingdom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141212/3a3f89c0/attachment.html
More information about the ncl-talk
mailing list