Graphics: NCL – Example

wrf_moving_nest.ncl: An example script to plot moving domains on the same map background.

In this script note:

;Get a list of all the moving nest output files
DATADir = "./"
FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d02_2005-08-30_??:00:00")
numFILES = dimsizes(FILES)

f = addfiles(FILES+".nc","r")

; Read in slp, as well as lat/lon/times associated
var_in = wrf_user_getvar(f,"slp",-1)
lat = wrf_user_getvar(f,"XLAT",-1)
lon = wrf_user_getvar(f,"XLONG",-1)
times = wrf_user_getvar(f,"times",-1)

; 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@mpFillOn = False
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?