Re: wrf_user_intrp3d

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 21 Jan 2009 17:32:38 -0700 (MST)

Hi Guan,

Since this script came off the WRF/MMM website, I'm CC-ing
wrfhelp_at_ucar.edu. Hopefully it is as simple as changing the "units"
attribute of your variable.

--Mary

On Wed, 21 Jan 2009, Guan Song wrote:

>
> Hey
>
> I have modified a script to plot horzontal interpolated graphs.
>
> Basically, I interpolated temperature to two specific height (3000 and 8000 m).
> So I modified the given sample script that interpolate to 500 hpa level (http://www.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/wrf_PressureLevel1.ncl).
>
> It works but the upper left corner legend is automatically saying
>
> Temperature (C) at 3000 hpa.
>
> It should be at 3000 m actually, so I am not sure how can I make a change of this incorrect infor.
>
> Thanks a lot,
> Guan
>
> ---------------------------------------------------------------------------------------------
> Code is attached below:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> begin
> ; The WRF ARW input file.
> ; This needs to have a ".nc" appended, so just do it.
> a = addfile("/home/gs6r/test1/WRFV3/test/em_real/guanoutput/wrfout_d01_2007-01-30_00:00:00.nc", "r")
> ; We generate plots, but what kind do we prefer?
> type = "x11"
> ; type = "pdf"
> ; type = "ps"
> wks = gsn_open_wks(type,"Pressure")
> ; Set some basic resources
> res = True
> res_at_MainTitle = "REAL-TIME WRF"
> res_at_Footer = False
> pltres = True
> mpres = True
> mpres_at_mpGeophysicalLineColor = "Black"
> mpres_at_mpNationalLineColor = "Black"
> mpres_at_mpUSStateLineColor = "Black"
> mpres_at_mpGridLineColor = "Black"
> mpres_at_mpLimbLineColor = "Black"
> mpres_at_mpPerimLineColor = "Black"
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; What times and how many time steps are in the data set?
> times = wrf_user_list_times(a) ; get times in the file
> ntimes = dimsizes(times) ; number of times in the file
> ; The specific height levels that we want the data interpolated to.
> height_levels = (/3000., 8000./) ; heigth levels to plot - in meter
> nlevels = dimsizes(height_levels) ; number of height levels
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> do it = 0,ntimes-1,2 ; TIME LOOP
> print("Working on time: " + times(it) )
> res_at_TimeLabel = times(it) ; Set Valid time to use on plots
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; First get the variables we will need
> tc = wrf_user_getvar(a,"tc",it) ; T in C
> u = wrf_user_getvar(a,"ua",it) ; u averaged to mass points
> v = wrf_user_getvar(a,"va",it) ; v averaged to mass points
> p = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical coordinate
> z = wrf_user_getvar(a, "z",it) ; grid point height
> rh = wrf_user_getvar(a,"rh",it) ; relative humidity
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> do level = 0,nlevels-1 ; LOOP OVER LEVELS
> height = height_levels(level)
> p_plane = wrf_user_intrp3d( p,z,"h",height,0.,False)
> tc_plane = wrf_user_intrp3d(tc,z,"h",height,0.,False)
> rh_plane = wrf_user_intrp3d(rh,z,"h",height,0.,False)
> u_plane = wrf_user_intrp3d( u,z,"h",height,0.,False)
> v_plane = wrf_user_intrp3d( v,z,"h",height,0.,False)
> u_plane = u_plane*1.94386 ; kts
> v_plane = v_plane*1.94386 ; kts
> u_plane_at_units = "kts"
> v_plane_at_units = "kts"
> ; Plotting options for T
> opts = res
> opts_at_cnLineColor = "Red"
> opts_at_ContourParameters = (/ 2.0 /)
> opts_at_cnInfoLabelOrthogonalPosF = 0.07 ; offset second lable information
> opts_at_gsnContourLineThicknessesScale = 2.0
> contour_tc = wrf_contour(a,wks,tc_plane,opts)
> delete(opts)
>
> ; Plotting options for Pressure
> opts = res
> opts_at_cnLineColor = "Blue"
> opts_at_gsnContourLineThicknessesScale = 3.0
> contour_p = wrf_contour(a,wks,p_plane,opts)
> delete(opts)
>
> ; Plotting options for RH
> opts = res
> opts_at_cnFillOn = True
> opts_at_ContourParameters = (/ 10., 90., 10./)
> opts_at_cnFillColors = (/"White","White","White", \
> "White","Chartreuse","Green",\
> "Green3","Green4", \
> "ForestGreen","PaleGreen4"/)
> contour_rh = wrf_contour(a,wks,rh_plane,opts)
> delete(opts)
> ; Plotting options for Wind Vectors
> opts = res
> opts_at_FieldTitle = "Wind" ; overwrite Field Title
> opts_at_NumVectors = 20 ; wind barb density
> vector = wrf_vector(a,wks,u_plane,v_plane,opts)
> delete(opts)
>
> ; MAKE PLOTS
> map = wrf_map(wks,a,mpres)
>
> wrf_map_overlay(wks,map,(/contour_tc,contour_p, \
> vector/),pltres)
>
> end do ; END OF LEVEL LOOP
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> end do ; END OF TIME LOOP
> end
>
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 21 2009 - 17:32:38 MST

This archive was generated by hypermail 2.2.0 : Wed Jan 28 2009 - 09:24:27 MST