HOW TO PLOT THE AVERAGE OF TEMPERATURE SURFACE IN ONE FRAME

The NCL graphics package.

HOW TO PLOT THE AVERAGE OF TEMPERATURE SURFACE IN ONE FRAME

Postby LUCK » Sat Jun 18, 2016 8:56 pm

HI EVERYONE!!
I´VE TRYING TO PLOT THE AVERAGE OF A .nc OUT IN ALL THE TIME (SIX HOURS THAT THE FORECAST LAST)BUT I´VE HAD MANY PROBLEMS WHEN I DO IT. THE GOAL IS GET A PLOT OF THE AVERAGE OF TEMPERATURE IN A SINGLE FRAME, ´CAUSE WHEN I DO IT WITH THIS SCRIPT I ONLY GET 3 FRAMES, WHICH IS VERY RARE. SOMEONE KNOWS HOW COULD I DO FOR PLOT A SINGLE FRAME THAT CONTAINS THE AVERAGE OF TEMPERATURE FOR THE SIX HOURS THAT LAST THE FORECAST?????
THE SCRIPT I´VE USING SI THIS: 3


; Example script to produce plots for a WRF real-data run,
; with the ARW coordinate dynamics option.

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/contributed.ncl"
;load "./WRFUserARW.ncl"

begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
a = addfile("/usr/local/ncl-630/SCRIPT_XH3/wrfout_d01_2016-04-15_06_00_00_CON_WRFDA_RAD.nc","r")

; We generate plots, but what kind do we prefer?
; type = "X11"
type = "pdf"
; type = "ps"
; type = "ncgm"

wks = gsn_open_wks(type,"ejemplo")

; Set some basic resources
res = True
res@MainTitle = "REAL-TIME WRF"

pltres = True
mpres = True


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; What times and how many time steps are in the data set?
times = wrf_user_getvar(a,"times",-1) ; get all times in the file
ntimes = dimsizes(times) ; number of times in the file

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

do it = 0,ntimes-1,2 ; TIME LOOP

print("Working on time: " + times(it) )
res@TimeLabel = times(it) ; Set Valid time to use on plots


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need

slp = wrf_user_getvar(a,"slp",it) ; slp
wrf_smooth_2d( slp, 3 ) ; smooth slp
tc = wrf_user_getvar(a,"tc",it) ; 3D tc
td = wrf_user_getvar(a,"td",it) ; 3D td


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;calcula el promedio de tc
opts = res
opts@cnFillOn = True
opts@ContourParameters = (/ -20., 90., 5./)
opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map
tc!0="time"
tc!1="lat"
tc!2="lon"
average = avg(tc(lat|:,lon|:,time|:)) ;calculate zonal ave


contour_tc = wrf_contour(a,wks,average,opts)
delete(opts)



;--------------------------------------------------------------------------------------


; MAKE PLOTS
plot = wrf_map_overlays(a,wks,(/contour_tc/),pltres,mpres)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

end do ; END OF TIME LOOP

end






THANK YOU ALL!!!!
LUCK
 
Posts: 1
Joined: Sat Jun 18, 2016 8:14 pm

Return to NCL

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest

cron