;---------------------------------------------------------------------- ; This script overlays vectors over color contours over a map. ; ; ;---------------------------------------------------------------------- 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 ;---Make a list of all files we are interested in DATADir = "~/ncl/data/20160115-18/" FILES = systemfunc (" ls -1 " + DATADir + "rap* ") numFILES = dimsizes(FILES) do ifil = 0,numFILES-1 ;---Start the graphics wks = gsn_open_wks("png","jan16storm") a = addfile(FILES(ifil)+".grb2","r") ; Open the next file refc = a->REFC_P0_L200_GLC0 u = a->UGRD_P0_L7_GLC0 v = a->VGRD_P0_L7_GLC0 lat = a->gridlat_0 lon = a->gridlat_0 ;---Set some contour resources cnres = True cnres@gsnMaximize = True ; maximize plot in frame cnres@gsnDraw = False ; turn off draw cnres@gsnFrame = False ; turn off frame cnres@cnFillOn = True ; turn on color fill cnres@cnFillPalette = "gui_default" ; choose colormap cnres@cnLinesOn = False ; turn off contour lines cnres@gsnLeftString = "REFC (" + refc@units + ")" cnres@gsnRightString = "UV winds (" + u@units + ")" cnres@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels cnres@cnMinLevelValF = -12. ; set min contour level cnres@cnMaxLevelValF = 36 ; set max contour level cnres@cnLevelSpacingF = 4 ; set contour spacing cnres@mpOutlineOn = False ; We're going to add cnres@mpFillOn = False ; shapefile outlines. cnres@mpMinLatF = 35 cnres@mpMaxLatF = 47 cnres@mpMinLonF = -80 cnres@mpMaxLonF = -67 contour_plot = gsn_csm_contour_map(wks,refc,cnres) ;---Set some vector resources vcres = True vcres@gsnMaximize = True ; maximize plot in frame vcres@gsnDraw = False ; turn off draw vcres@gsnFrame = False ; turn off frame vcres@vcMinDistanceF = 0.005 ; thin the vectors vcres@vcRefLengthF = 0.05 ; width/num_vectors (~25 vectors) vcres@vcLineArrowColor = "Gray25" vcres@gsnRightString = "" ; turn off sub-titles vcres@gsnLeftString = "" vector_plot = gsn_csm_vector(wks,u,v,vcres) overlay(contour_plot,vector_plot) frame(wks) end do end