;---------------------------------------------------------------------- ; wrf_gsn_8.ncl ;---------------------------------------------------------------------- ; Concepts illustrated: ; - Using gsn_csm scripts to plot WRF-ARW data ; - Drawing streamlines colored by another field over a map ;---------------------------------------------------------------------- ; This script is meant to show the difference between plotting WRF ; data using wrf_xxx scripts, and using gsn_csm_xxx scripts. ;---------------------------------------------------------------------- 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 ;---Open WRF output file filename = "wrfout_d01_2015-10-05_00:00:00.nc" a = addfile(filename,"r") ;---Read several WRF variables at first time step it = 0 u = wrf_user_getvar(a,"ua",it) ; 3D U at mass points v = wrf_user_getvar(a,"va",it) ; 3D V at mass points lat = wrf_user_getvar(a,"lat",it) lon = wrf_user_getvar(a,"lon",it) ;---Get the lowest (bottommost) level nl = 0 u10 = u(nl,:,:) v10 = v(nl,:,:) u10 = u10*1.94386 ; Convert wind into knots v10 = v10*1.94386 spd = sqrt(u10^2+v10^2) printVarSummary(u10) printVarSummary(v10) printVarSummary(spd) ;---Change the metadata u10@units = "kts" v10@units = "kts" ;---Required for plotting over map (not using WRF's map projection here) u10@lat2d = lat u10@lon2d = lon v10@lat2d = lat v10@lon2d = lon wks = gsn_open_wks("ps","streamline") res = True res@gsnMaximize = True res@mpMinLatF = min(lat)-1 res@mpMaxLatF = max(lat)+1 res@mpMinLonF = min(lon)-1 res@mpMaxLonF = max(lon)+1 res@gsnAddCyclic = False res@stLineThicknessF = 3.0 res@tiMainString = "U10/V10 streamlines color by wind speed" plot = gsn_csm_streamline_scalar_map(wks,u10,v10,spd,res) end