;---------------------------------------------------------------------- ; This is a basic NCL template for creating contours over maps using ; WRF data, and attaching shapefile outlines. This template plots one ; timestep of HGT from a WRF file, and attaches shapefile outlines ; from the "USA_adm2.shp" and "CAN_adm2.shp" shapefiles, downloaded ; from http://www.gadm.org/country/ ;---------------------------------------------------------------------- ; Note: as of NCL V6.2.0, you don't need these three load commands ;---------------------------------------------------------------------- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" begin filename = "wrfout_d01_2002-07.nc" a = addfile(filename,"r") ter = a->HGT(0,:,:) ; Read the variable to memory wks = gsn_open_wks("x11","wrf_hgt_shapefile") gsn_define_colormap(wks,"OceanLakeLandSnow") ; Change color map res = True ; Use basic options for this field res@cnFillOn = True ; Create a color fill plot res@ContourParameters = (/1,1100,20/) contour = wrf_contour(a,wks,ter,res) pltres = True ; Set plot options pltres@PanelPlot = True ; Tells wrf_map_overlays not to remove contours mpres = True ; Set map options mpres@mpOutlineOn = False mpres@mpFillOn = False ;---Create the contours over the WRF map (nothing will be drawn yet). plot = wrf_map_overlays(a,wks,contour,pltres,mpres) ;---Attach the shapefile polylines using files read off gadm.org/country. usa_shp_name = "USA_adm/USA_adm2.shp" canada_shp_name = "CAN_adm/CAN_adm2.shp" lnres = True lnres@gsLineColor = "gray25" lnres@gsLineThicknessF = 0.5 usa_id = gsn_add_shapefile_polylines(wks,plot,usa_shp_name,lnres) can_id = gsn_add_shapefile_polylines(wks,plot,canada_shp_name,lnres) draw(plot) ; This will draw the map and the shapefile outlines. frame(wks) ; Advance the frame end