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/csm/contributed.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl" begin ;---Open WRF output file a= addfile("/home/gaurav/ncl_scripts/sst2014mslp.nc","r") ;---Read several WRF variables at first time step it = 210 slp = wrf_user_getvar(a,"msl",it) ; sea level pressure ;wrf_smooth_2d( slp,3 ) ; smooth slp ;---Now get the lowest (bottommost) level nl = 0 ;---Change the metadata wks = gsn_open_wks("png","SLP") ;---Set common resources for all plots res = True res@gsnFrame = True res@gsnDraw = True res@gsnLeftString = "" res@gsnRightString = "" ;---Necessary for contours to be overlaid correctly on WRF projection res@tfDoNDCOverlay = True ;---SLP line contour plot levels = ispan(960,1010,4) info_string = "Sea level pressure contours from 960 to 1020 by 4" slp_res = res slp_res@cnLineColor = "NavyBlue" ;slp_res@cnLevelSelectionMode = "ExplicitLevels" ;slp_res@cnLevelSelectionMode = "ImplicitLevels" ;slp_res@cnLevels = levels slp_res@cnLineLabelBackgroundColor = -1 ; transparent slp_res@cnLineThicknessF = 2 slp_res@cnHighLabelsOn = False slp_res@cnLowLabelsOn = True slp_res@cnHighLabelBackgroundColor = -1 slp_res@cnLowLabelBackgroundColor = -1 slp_res@cnInfoLabelString = info_string slp_res@cnInfoLabelFontColor = "NavyBlue" slp_res@cnInfoLabelPerimOn = True contour_psl = gsn_csm_contour(wks,slp,slp_res) ;---Map plot minLon=50 maxLon=95 minLat=0 maxLat=30 map_res = True map_res@mpMinLonF = minLon map_res@mpMaxLonF = maxLon map_res@mpMinLatF = minLat map_res@mpMaxLatF = maxLat map_res@gsnFrame = True map_res@gsnDraw = True map_res@tiMainString = a map_res@gsnLeftString = slp@description + " (" + slp@units + ")~C~" map_res@gsnLeftStringFontHeightF = 0.02 ;---Set map resources based on projection on WRF output file map_res = wrf_map_resources(a,map_res) map = gsn_csm_map(wks,map_res) ;---Overlay plots on map and draw. overlay(map,contour_psl) draw(map) ; This will draw all overlaid plots and the map frame(wks) end