load "/usr/share/ncarg/nclscripts/csm/gsn_code.ncl" load "/usr/share/ncarg/nclscripts/csm/gsn_csm.ncl" load "/usr/share/ncarg/nclscripts/csm/contributed.ncl" load "/usr/share/ncarg/nclscripts/wrf/WRFUserARW.ncl" load "/usr/share/ncarg/database/rangs" begin ;---Open WRF output file and read data dir = "/home/user/" filename = "wrfout_d01_2015-10-10_15:00:00.nc" a = addfile(dir + filename,"r") times = wrf_user_list_times(a) ; get times in the file ntimes = dimsizes(times) ; number of times in the file ;---Just look at first time step. it = 0 print("Working on time: " + times(it) ) ;---Read temperature and terrain height off file u = wrf_user_getvar(a,"U",it) ; Wind Speed lat2d = wrf_user_getvar(a,"XLAT",it) ; latitude lon2d = wrf_user_getvar(a,"XLONG",it) ; longitude dims = dimsizes(u) ;---Start the graphics wks = gsn_open_wks("png","boundaries") ;---Set some basic plot options opts = True opts@MainTitle = "" pltres = True mpres = True opts@TimeLabel = times(it) ; Set valid time to use on plots mpres@mpGeophysicalLineColor = "black" mpres@mpNationalLineColor = "black" mpres@mpUSStateLineColor = "black" mpres@mpGeophysicalLineThicknessF = 2.5 mpres@mpNationalLineThicknessF = 2.5 mpres@mpUSStateLineThicknessF = 2.5 mpres@mpOutlineBoundarySets = "Boundaries" mpres@mpDataBaseVersion = "HighRes" mpres@mpFillOn = False mpres@mpProjection = "Mercator" resMap = True resMap@mpDataSetName = "Earth..4" mpres@tmXBLabelFontHeightF = 0.040 mpres@pmTickMarkDisplayMode = "Always" ;---------------------------------------------------------------------- ; Plot full domain first. ;---------------------------------------------------------------------- opts@cnFillOn = True contour = wrf_contour(a,wks,u(it,:,:),opts) plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres) ;---------------------------------------------------------------------- ; Plot partial domain. ;---------------------------------------------------------------------- ;opts@sfXArray = lon2d ;opts@sfYArray = lat2d ;contour = wrf_contour(a,wks,u(it,:,:),opts) ;---Set special resource to indicate we are using XLAT/XLONG coordinates. pltres@LatLonOverlay = True pltres@tmXBLabelFontHeightF = 0.040 pltres@pmTickMarkDisplayMode = "Always" TLS_shp_name = "/home/isakhar/Downloads/TLS_adm_shp/TLS_adm1.shp" pltres@mpLimitMode = "LatLon" pltres@mpMinLatF = -11 pltres@mpMaxLatF = -8 pltres@mpMinLonF = 123 pltres@mpMaxLonF = 128 ;---Zoom in on map, which we can do because we're using lat/lon coordinates. plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres) end