This is the path of Typhoon SOULIK plotted by WRF.
The location was marked per every day from 12:00 on the 17th to 12:00 on the 20th, and since then, it is plotted per 12 hours. In fact, compared to SOULIK's path announced by the Korea Meteorological Administration, it was found that the conspiracy to be much more left-leaning.
;----------------------------------------------------------------------
; Reference:
; http://ncl.ucar.edu/Applications/Scripts/WRF_track_1.ncl
;----------------------------------------------------------------------
; These files are loaded by default in NCL V6.2.0 and newer
; 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.
idir = "/home/numodel2/SOULIK/WRFOUT/"
ifil = "wrfout_d01_2018-08-15_12:00:00"
a = addfile(idir + ifil, "r")
;---Read lat/lon and time
lat2d = a->XLAT(0,:,:)
lon2d = a->XLONG(0,:,:)
lon1d = ndtooned(lon2d) ; convert 2-D array to 1-D array
lat1d = ndtooned(lat2d)
; Times for ndate
times = a->Times
sdate = tostring(times(:,8:9))+tostring(times(:,11:12)) ; ddhh
ndate = dimsizes(sdate)
; Array for saving index
imin = new(ndate,integer)
jmin = new(ndate,integer)
smin = new(ndate,integer)
; Array for plotting center of typhoon
dot = new(ndate,graphic) ; Make sure each gsn_add_polyxxx call
line = new(ndate,graphic) ; is assigned to a unique variable.
;---Find best track
do it = 48, ndate-1
; Read sea level pressure
slp2d = wrf_user_getvar(a,"slp",it)
dims = dimsizes(slp2d)
; We need to convert 2-D array to 1-D array to find the minima.
slp1d = ndtooned(slp2d)
smin(it) = minind(slp1d)
; Convert the index for 1-D array back to the indeces for 2-D array.
minij = ind_resolve(ind(slp1d.eq.min(slp2d)),dims)
imin(it) = minij(0,0)
jmin(it) = minij(0,1)
print(sdate(it)+" : "+min(slp2d)+" ("+imin(it)+","+jmin(it)+")")
end do
;---Set some basic plot options
type = "x11"
wks=gsn_open_wks(type,"track") ; Open wks
res = True
res@gsnDraw = False ; Turn off draw.
res@gsnFrame = False ; Turn off frame advance.
res@gsnMaximize = True ; Maximize plot in frame.
;---Necessary for contours to be overlaid correctly on WRF projection
res@tfDoNDCOverlay = True ; Tell NCL you are doing a native plot
res = wrf_map_resources(a,res)
res@tiMainString = "Typhoon SOULIK" ; Main title
plot = gsn_csm_map(wks,res) ; Create a map.
;---Set up resources for polylines.
res_lines = True
res_lines@gsLineThicknessF = 3. ; 3x as thick
res_lines@gsLineColor = cols(0)
;---Set up resources for date (Legend)
txres = True
txres@txFontHeightF = 0.015
txres@txFontColor = cols(0)
txres@txJust = "CenterRight"
ijump = 12
do i = 48, ndate-1, ijump
dot(i) = gsn_add_polymarker(wks,plot,lon1d(smin(i)),lat1d(smin(i)),gsres)
if ( i .lt. ndate-ijump) then
xx=(/lon1d(smin(i)),lon1d(smin(i+ijump))/)
yy=(/lat1d(smin(i)),lat1d(smin(i+ijump))/)
line(i) = gsn_add_polyline(wks,plot,xx,yy,res_lines)
end if
ix = smin(i) - 3 ; keep distance from track
txid1 = gsn_add_text(wks,plot,sdate(i),lon1d(ix),lat1d(ix),txres)
end do
draw(plot)
frame(wks)
end
Comments