Graphics: NCL - Example
wrf_moving_nest.ncl: An experimental example script to plot all moving next domains on the same map background.
-If you have comments/suggestions about this script, please send an email to wrfhelp@ucar.edu
*Note that since this is experimental, the exact way this may be implemented in future may vary from the way it is presented here.
-To use this code, you also need to download and link to this new file WRFUserARW_add.ncl
In this script note:
;Get a list of all the moving nest output files
DATADir = "./"
FILES = systemfunc ("csh -c ' ls -1 " + DATADir + "wrfout_d02_2005-08-??_??:00:00'")
numFILES = dimsizes(FILES)
do ff = 0,numFILES-1
FILES(ff) = FILES(ff)+".nc"
end do
f = addfiles(FILES,"r")
; Read in slp, as well as lat/lon/times associated
; To get more information about the function below - see the experimental script about using split files
var_in = wrf_user_getvar_from_files(FILES,"slp",-1,True)
lat = wrf_user_getvar_from_files(FILES,"XLAT",-1,True)
lon = wrf_user_getvar_from_files(FILES,"XLONG",-1,True)
times = wrf_user_getvar_from_files(FILES,"times",-1,True)
; set some data information for contour intervals
; Also note that we are setting a large number of resources - this is because not all the functionality has been linked with the basic WRFUserARW script
mn = min(var_in)
mx = max(var_in)
nlev = tointeger((mx-mn)/2)+1
levels = nice_mnmxintvl(mn,mx,nlev,True)
ilevs = tointeger(levels)
res = True
; Set some contouring resources.
res@cnFillOn = True
res@cnLinesOn = False
res@gsnSpreadColors = True
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = levels(0)
res@cnMaxLevelValF = levels(1)
res@cnLevelSpacingF = ilevs(2)
; Add map resources
res@mpDataBaseVersion = "MediumRes" ; Default is LowRes
res@mpOutlineDrawOrder = "PostDraw" ; Draw map outlines last
res@mpGridAndLimbOn = False ; Turn off lat/lon lines
res@pmTickMarkDisplayMode = "Always" ; Turn on map tickmarks
; Note getting basic map information is linked - so this is how we set the basic map resources
res = set_mp_wrf_map_resources(f[0],res)
; We need to override the map extend so that we have the same map background for all the plots
res@mpLimitMode = "Corners" ; Portion of map to zoom
res@mpLeftCornerLatF = min (lat) - 2.0
res@mpLeftCornerLonF = min (lon) - 5.0
res@mpRightCornerLatF = max (lat) + 2.0
res@mpRightCornerLonF = max (lon) + 5.0
; Add label bar resources
res@lbLabelAutoStride = True
res@lbBoxMinorExtentF = 0.13
res@lbLabelFontHeightF = 0.012
res@gsnLeftStringFontHeightF = 0.01
res@gsnRightStringFontHeightF = 0.008
res@gsnMaximize = True ; Maximize plot in frame
; Loop though the times and plot each
; Note how we pass time-dependent map information to the contouring routine
do ip = 0,numFILES-1
var = var_in(ip,:,:)
var@lat2d = lat(ip,:,:)
var@lon2d = lon(ip,:,:)
res@gsnRightString = times(ip)
map = gsn_csm_contour_map(wks, var, res)
end do
And how will this looks as a movie?
|