Re: question about plotting typhoon best track

From: Jonathan Vigh <vigh_at_nyahnyahspammersnyahnyah>
Date: Fri Nov 20 2009 - 10:14:53 MST

Hi Li,
   If you just want to plot one typhoon track, check out the attached
script - this should be easier than trying to adapt unique_1.ncl. You'll
still need to revamp the data read section a bit - Dennis's e-mail
should help you with that.

Best regards,
Jonathan

Dennis Shea wrote:
> The unique_1.ncl was written long before the str_* functions were
> created. The attached script uses "str_get_col" to extract some of
> the data. You can expand as needed.
>
> The unique_1.ncl predefined storm names and numbers.
> You will have to create code that performs that task.
>
> Anyway, the attached script should get you started.
>
> Good luck
>
>
> Li Richard wrote:
>> Hello everyone,
>> I would like to know how can I plot the typhoon best track using ncl.
>> I have found a similar code unique_1.ncl
>> <http://www.ncl.ucar.edu/Applications/Scripts/unique_1.ncl> on the
>> web page of application example, but I don't know how to read in the
>> data I get from the JTWC. An example of the data can be seen in the
>> attachment. I would be much appreciated if anyone can kindly answer
>> my question. Thank you.
>> Richard
>>
>> ;********************************************************
>> ; unique_1.ncl
>> ;
>> ; The purpose of this script is to plot the best tracks
>> ; for a given season storms including all data (subtropical
>> ; storms, depressions, extrtropical lows, etc.)
>> ;********************************************************
>> 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/csm/shea_util.ncl"
>> begin
>> ; First set the year and number of storms in the season
>> ; yyyy = 2001
>> ; ncurves = 17
>> ; nstorms = 17
>> ; yyyy = 2002
>> ; ncurves = 14
>> ; nstorms = 17
>> yyyy = 2003
>> ncurves = 21
>> nstorms = 21
>> bcurve = 0 ; Start at first storm
>> ; Next, set the plotting parameters (which cases to plot)
>> ;
>> ; Note that this script probably won't work for TypeOn = False, because
>> ; we don't have the data file for it.
>> ;
>> TypeOn = True ; If you just want the legend to
>> have the basic (H, TS, and TD) designators (* and S), set TypeOn to
>> False
>> ; NOTE -- this will cause the program to grab a different
>> input file -- one in which all the
>> ; extratropical (E), remnant low (L), and wave cases (W)
>> have been taken out; additionally,
>> ; there will not be a distinction between the S and * cases
>> (they will just be plotted according to
>> ; intensity
>> PlotSubTropicalSegments = True ; If you wish to exclude all
>> subtropical line segments, set to False
>> ; Note: if TypeOn is set to False, the following (W, L, E) cases
>> won't be plotted regardless of their value
>> PlotWaveSegments = True ; If you wish to exclude all wave
>> segments, set to False
>> PlotLowSegments = True ; If you wish to exclude all remnant
>> low segments, set to False
>> PlotExtraTropicalSegments = True ; If you wish to exclude all
>> extratropical line sements, set to False if (yyyy.eq.2001) then
>> name =
>> (/"Allison","Two","Barry","Chantal","Dean","Erin","Felix","Gabrielle","Nine","Humberto","Iris","Jerry","Karen","Lorenzo","Michelle","Noel","Olga"/)
>>
>> ssn =
>> (/"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"/)
>>
>> end if if (yyyy.eq.2002) then
>> name =
>> (/"Arthur","Bertha","Cristobal","Dolly","Edouard","Fay","Seven","Gustav","Hanna","Isidore","Josephine","Kyle","Lili","Fourteen"/)
>>
>> ssn = (/"1","2","3","4","5","6","7","8","9","10","11","12","13","14"/)
>> end if
>>
>> if (yyyy.eq.2003) then
>> name =
>> (/"Ana","Two","Bill","Claudette","Danny","Six","Seven","Erika","Nine","Fabian","Grace","Henri","Isabel","Fourteen","Juan","Kate","Larry","Mindy","Nicholas","Odette","Peter"/)
>>
>> ssn =
>> (/"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21"/)
>>
>> end if
>>
>> ;********************************
>> ; get data
>> ;********************************
>> if(TypeOn) then
>> tStr = asciiread("best_all_" + yyyy + ".inp", -1,"string") ;
>> Info includes type so cases can be weeded out
>> else
>> tStr = asciiread("best_" + yyyy + ".inp", -1,"string") ; Info
>> includes type so cases can be weeded out
>> end if tChr = stringtochar(tStr)
>>
>> nrows = dimsizes(tStr)
>>
>> sn = stringtofloat( chartostring(tChr(:,0:1)) )
>> year = stringtofloat( chartostring(tChr(:,2:3)) )
>> month = stringtofloat( chartostring(tChr(:,4:5)) ) day =
>> stringtofloat( chartostring(tChr(:,6:7)) )
>> hour = stringtofloat( chartostring(tChr(:,8:9)) )
>>
>> lat = stringtofloat( chartostring(tChr(:,10:13)) )
>> lon = stringtofloat( chartostring(tChr(:,15:18)) )
>> vmax = stringtofloat( chartostring(tChr(:,21:23)) )
>>
>> type = chartostring(tChr(:,30:30))
>>
>> beginning = new((/ncurves/),integer)
>> ending = new((/ncurves/),integer)
>> ic = 0
>> beginning(ic) = 0
>> do i=1,dimsizes(hour)-1
>>
>> ; Look for end of storm record (first check to see if at end of file)
>> if (i.eq.dimsizes(hour)-1) then
>> ending(ic) = i
>> else if (sn(i-1).ne.sn(i)) then
>> ending(ic) = i-1
>> ic = ic + 1
>> beginning(ic) = i
>> end if end if
>> end do
>> lengths = ending - beginning + 1
>> max_npts = max(lengths) ; Max # of
>> points.
>>
>> ; Now rearrange the arrays to hold individual curve data
>> msg_val = -999. ; Set to a safe missing value.
>>
>> new_lat = new((/ncurves,max_npts/),float,msg_val)
>> new_lon = new((/ncurves,max_npts/),float,msg_val)
>> new_hour = new((/ncurves,max_npts/),float,msg_val)
>> new_day = new((/ncurves,max_npts/),string,msg_val)
>> new_vmax = new((/ncurves,max_npts/),float,msg_val)
>> new_type = new((/ncurves,max_npts/),string,msg_val)
>>
>> do nc = bcurve,ncurves-1
>> new_lat(nc,0:lengths(nc)-1) = lat(beginning(nc):ending(nc))/10.0
>> new_lon(nc,0:lengths(nc)-1) = -lon(beginning(nc):ending(nc))/10.0
>> new_hour(nc,0:lengths(nc)-1) = hour(beginning(nc):ending(nc))
>> new_day(nc,0:lengths(nc)-1) = day(beginning(nc):ending(nc))
>> new_vmax(nc,0:lengths(nc)-1) = vmax(beginning(nc):ending(nc))
>> new_type(nc,0:lengths(nc)-1) =
>> type(beginning(nc):ending(nc)) end do
>> ; Now create arrays that only hold the points for the 00z locations
>> lat0 = mask(new_lat,new_hour,0)
>> lon0 = mask(new_lon,new_hour,0)
>>
>> lat12 = mask(new_lat,new_hour,12)
>> lon12 = mask(new_lon,new_hour,12)
>> day12 = mask(new_day,new_hour,12)
>>
>> ;********************************
>> ; select sub-regions
>> ;********************************
>> minlat = 0.0 ; deg N
>> maxlat = 57.0 ; deg N
>> minlon = -100.0 ; - deg E = deg W
>> maxlon = -20.0 ; - deg E = deg W
>> ;***** Define some NICE color maps to use.
>> colors_6 =
>> (/"White","Black","Black","MediumPurple1","MediumPurple3","Blue1",\
>> "CadetBlue3","Aquamarine2","SeaGreen2","LawnGreen","Green4", \
>> "GreenYellow","Gold","Tan1","Sienna1","Tomato","VioletRed1", \
>>
>> "Yellow","DarkGreen","Grey37","Red","Orange","GoldenRod1","DarkOrange","SteelBlue1","SlateBlue1",
>> \
>>
>> "LightSlateBlue","DarkSeaGreen","Magenta","DodgerBlue","Moccasin"/)
>> ;********************************
>> ; create plot
>> ;********************************
>> wks = gsn_open_wks("ps","unique")
>> gsn_define_colormap(wks,colors_6)
>> res = True
>> res@gsnMaximize <mailto:res@gsnMaximize> = True
>> res@gsnPaperOrientation <mailto:res@gsnPaperOrientation> = "Portrait"
>> res@gsnDraw <mailto:res@gsnDraw> = False ; so we can
>> add poly stuff
>> res@gsnFrame <mailto:res@gsnFrame> = False ; do not
>> advance frame
>> res@mpDataBaseVersion <mailto:res@mpDataBaseVersion> =
>> "Ncarg4_1" ; Alias 'MediumRes'
>> res@mpDataSetName <mailto:res@mpDataSetName> = "Earth..1"
>> res@mpProjection <mailto:res@mpProjection> =
>> "LambertConformal"
>> res@mpLambertParallel1F <mailto:res@mpLambertParallel1F> = 20.0
>> res@mpLambertParallel2F <mailto:res@mpLambertParallel2F> = 40.0
>> res@mpLambertMeridianF <mailto:res@mpLambertMeridianF> = -60.0
>> res@mpLimitMode <mailto:res@mpLimitMode> = "LatLon"
>> res@mpMinLatF <mailto:res@mpMinLatF> = minlat
>> res@mpMaxLatF <mailto:res@mpMaxLatF> = maxlat
>> res@mpMinLonF <mailto:res@mpMinLonF> = minlon
>> res@mpMaxLonF <mailto:res@mpMaxLonF> = maxlon
>>
>> res@mpFillOn <mailto:res@mpFillOn> = True ; False
>> to turn off gray continents
>> res@mpOutlineOn <mailto:res@mpOutlineOn> = True ;
>> turn on continental outline
>> res@mpOutlineBoundarySets <mailto:res@mpOutlineBoundarySets> =
>> "AllBoundaries"
>> res@mpLandFillColor <mailto:res@mpLandFillColor> =
>> "GoldenRod1"
>> res@mpInlandWaterFillColor <mailto:res@mpInlandWaterFillColor> =
>> "PaleTurquoise3"
>> res@mpOceanFillColor <mailto:res@mpOceanFillColor> =
>> "PaleTurquoise3"
>> res@mpGeophysicalLineColor
>> <mailto:res@mpGeophysicalLineColor> = "Grey37"
>> res@mpGeophysicalLineThicknessF
>> <mailto:res@mpGeophysicalLineThicknessF> = 0.5
>> res@mpUSStateLineColor <mailto:res@mpUSStateLineColor>
>> = "Grey37"
>> res@mpUSStateLineThicknessF
>> <mailto:res@mpUSStateLineThicknessF> = 0.5
>> res@mpNationalLineColor <mailto:res@mpNationalLineColor> =
>> "Grey37"
>> res@mpNationalLineThicknessF
>> <mailto:res@mpNationalLineThicknessF> = 0.5
>> res@mpGridAndLimbOn <mailto:res@mpGridAndLimbOn> = "True"
>> res@mpGridAndLimbDrawOrder <mailto:res@mpGridAndLimbDrawOrder> =
>> "Draw"
>> res@mpGridMaskMode <mailto:res@mpGridMaskMode> = "MaskLand"
>> res@mpGridSpacingF <mailto:res@mpGridSpacingF> = 5.0
>> res@mpGridLineColor <mailto:res@mpGridLineColor> = "Grey37"
>> res@tmXBLabelFontHeightF <mailto:res@tmXBLabelFontHeightF> = 0.005
>> res@tmXBMajorLengthF <mailto:res@tmXBMajorLengthF> = -0.001
>> res@pmTickMarkDisplayMode <mailto:res@pmTickMarkDisplayMode> =
>> "Always"
>>
>> ;***************************************
>> ; plot base map *
>> ;***************************************
>> plot = gsn_csm_map(wks,res) ; draw one of eight map projections
>> ;***************************************
>> ; Draw best track history as polylines *
>> ;***************************************
>> res_poly = True ; polyline mods desired
>>
>> ; Create array of dummy graphic variables. This is required, b/c each
>> line
>> ; must be associated with a unique dummy variable.
>> dum = new(dimsizes(hour),graphic) ic = 0
>> do i=0,ncurves-1
>> do k=0,max_npts-2
>> if(.not.ismissing(new_lat(i,k)))
>> res_poly@gsLineDashPattern <mailto:res_poly@gsLineDashPattern> = 0
>> res_poly@gsLineThicknessF
>> <mailto:res_poly@gsLineThicknessF> = 4 if(.not. TypeOn) then
>> ; Plot hurricane segments
>> if((new_vmax(i,k).gt.64).and.(new_type(i,k).eq."*")) then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "Red"
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> ; Plot tropical storm segments
>> if((new_vmax(i,k).lt.64).and.(new_vmax(i,k).gt.34).and.(new_type(i,k).eq."*"))
>> then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "Yellow"
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1 end if ; Plot tropical
>> depression segments
>> if((new_vmax(i,k).lt.34).and.(new_type(i,k).eq."*")) then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "DarkGreen"
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> ; Now plot the subtropical segments with dashed lines
>> ; Plot hurricane segments of subtropical systems with dashed red lines
>> if((new_vmax(i,k).gt.64).and.(new_type(i,k).eq."S")) then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "Red"
>> res_poly@gsLineDashPattern
>> <mailto:res_poly@gsLineDashPattern> = 2
>> res_poly@gsLineDashSegLenF
>> <mailto:res_poly@gsLineDashSegLenF> = 0.1
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> ; Plot tropical storm segments of subtropical systems with dashed
>> yellow lines
>> if((new_vmax(i,k).lt.64).and.(new_vmax(i,k).gt.34).and.(new_type(i,k).eq."S"))
>> then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "Yellow"
>> res_poly@gsLineDashPattern
>> <mailto:res_poly@gsLineDashPattern> = 2
>> res_poly@gsLineDashSegLenF
>> <mailto:res_poly@gsLineDashSegLenF> = 0.1
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1 end if ; Plot tropical
>> depression segments of subtropical systems with dashed dark green lines
>> if((new_vmax(i,k).lt.34).and.(new_type(i,k).eq."S")) then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "DarkGreen"
>> res_poly@gsLineDashPattern
>> <mailto:res_poly@gsLineDashPattern> = 2
>> res_poly@gsLineDashSegLenF
>> <mailto:res_poly@gsLineDashSegLenF> = 0.1
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> else ; if(TypeOn) -- plot pure tropical segments as solid lines
>> (red for hurricane, etc.).
>> ; Plot hurricane segments
>> if((new_vmax(i,k).gt.64).and.(new_type(i,k).eq."*")) then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "Red"
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> ; Plot tropical storm segments
>> if((new_vmax(i,k).lt.64).and.(new_vmax(i,k).gt.34).and.(new_type(i,k).eq."*"))
>> then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "Yellow"
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1 end if ; Plot tropical
>> depression segments
>> if((new_vmax(i,k).lt.34).and.(new_type(i,k).eq."*")) then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "DarkGreen"
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> if(PlotWaveSegments) then ; Plot tropical wave segments
>> if(new_type(i,k).eq."W") then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "DarkGreen"
>> res_poly@gsLineDashPattern
>> <mailto:res_poly@gsLineDashPattern> = 2
>> res_poly@gsLineDashSegLenF
>> <mailto:res_poly@gsLineDashSegLenF> = 0.1
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> end if
>> if(PlotLowSegments) then ; Plot remanant low segments
>> if(new_type(i,k).eq."L") then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "SlateBlue"
>> res_poly@gsLineDashPattern
>> <mailto:res_poly@gsLineDashPattern> = 2
>> res_poly@gsLineDashSegLenF
>> <mailto:res_poly@gsLineDashSegLenF> = 0.1
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> end if
>> if(PlotSubTropicalSegments) then
>> ; Plot subtropical storm segments
>> if((new_vmax(i,k).gt.34).and.(new_type(i,k).eq."S")) then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "DarkOrange"
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1 end if
>> ; Plot subtropical depression segments
>> if((new_vmax(i,k).lt.34).and.(new_type(i,k).eq."S")) then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "Blue1"
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> end if
>>
>> if(PlotExtraTropicalSegments) then ; Plot extratropical segments
>> if(new_type(i,k).eq."E") then
>> res_poly@gsLineColor
>> <mailto:res_poly@gsLineColor> = "Black"
>> res_poly@gsLineDashPattern <mailto:res_poly@gsLineDashPattern> = 2
>> res_poly@gsLineDashSegLenF
>> <mailto:res_poly@gsLineDashSegLenF> = 0.1
>> dum(ic) =
>> gsn_add_polyline(wks,plot,new_lon(i,k:k+1),new_lat(i,k:k+1),res_poly)
>> ic = ic + 1
>> end if
>> end if
>> end if
>>
>> end if
>> end do
>> end do
>> ;***************************************
>> ; Draw black polymarkers at 00Z locations
>> ;***************************************
>> res_mark = True
>> res_mark@gsMarkerIndex <mailto:res_mark@gsMarkerIndex> =
>> 1 ; polymarker style
>> res_mark@gsMarkerSizeF <mailto:res_mark@gsMarkerSizeF> =
>> 0.012 ; polymarker size
>> res_mark@gsMarkerColor <mailto:res_mark@gsMarkerColor> =
>> "Black" ; change marker color
>> duma = new(ncurves,graphic)
>> do ic=bcurve,ncurves-1
>> duma(ic) =
>> gsn_add_polymarker(wks,plot,lon0(ic,:),lat0(ic,:),res_mark)
>> end do
>> ; Now draw white polymarkers at 12z locations
>> res_mark@gsMarkerIndex <mailto:res_mark@gsMarkerIndex> = 1
>> res_mark@gsMarkerSizeF <mailto:res_mark@gsMarkerSizeF> =
>> 0.012 ; polymarker size
>> res_mark@gsMarkerColor <mailto:res_mark@gsMarkerColor> =
>> "White" ; change marker color
>> dumb = new(ncurves,graphic)
>> do ic=bcurve,ncurves-1
>> dumb(ic) =
>> gsn_add_polymarker(wks,plot,lon12(ic,:),lat12(ic,:),res_mark)
>> end do
>> ;***************************
>> ; Plot some text labels *
>> ;***************************
>>
>> txres = True
>> ; Now draw the day labels each 00Z marker
>> txres@txFontHeightF <mailto:txres@txFontHeightF> = 0.0035
>> txres@txJust <mailto:txres@txJust> = "TopCenter"
>> ;
>> ; Count number of text strings we'll be adding. There is probably
>> ; a better way to do this (so you don't have to use a double do loop).
>> ;
>> ntext = 0
>> do i=bcurve,ncurves-1
>> do k=0,lengths(i)-1
>>
>> if(.not.ismissing(day12(i,k)).and..not.ismissing(lon12(i,k)).and.\
>> .not.ismissing(lat12(i,k)))
>> then
>> ntext = ntext + 1
>> end if
>> end do
>> end do
>> dumt1 = new(ntext,graphic)
>> dumt2 = new(ncurves-bcurve,graphic)
>> dumt3 = new(ncurves-bcurve,graphic)
>> ii = 0
>> do i=bcurve,ncurves-1
>> do k=0,lengths(i)-1
>>
>> if(.not.ismissing(day12(i,k)).and..not.ismissing(lon12(i,k)).and.\
>> .not.ismissing(lat12(i,k)))
>> then
>> dumt1(ii) =
>> gsn_add_text(wks,plot,day12(i,k),lon12(i,k),lat12(i,k)-0.45,txres)
>> ii = ii + 1
>> end if
>> end do
>> end do ; Draw storm number (actually these are strings) at
>> beginning of track txres@txFontHeightF
>> <mailto:txres@txFontHeightF> = 0.0044
>> txres@txJust <mailto:txres@txJust> = "CenterLeft"
>> txres@txPerimOn <mailto:txres@txPerimOn> = True
>> txres@txPerimColor <mailto:txres@txPerimColor> = "Black"
>> txres@txPerimThicknessF <mailto:txres@txPerimThicknessF> = 1.0
>> txres@txPerimSpaceF <mailto:txres@txPerimSpaceF> = 0.4
>> txres@txBackgroundFillColor <mailto:txres@txBackgroundFillColor> =
>> "White"
>> do i=bcurve,ncurves-1
>> if(.not.ismissing(ssn(i)).and..not.ismissing(new_lon(i,0)).and.\
>> .not.ismissing(new_lat(i,0))) then
>> dumt2(i-bcurve) =
>> gsn_add_text(wks,plot,ssn(i),new_lon(i,0)+0.6, \
>>
>> new_lat(i,0),txres)
>> end if
>> end do
>> ; Now draw them at the end
>> txres@txJust <mailto:txres@txJust> = "BottomRight"
>> do i=bcurve,ncurves-1
>> if(.not.ismissing(ssn(i)).and. \
>> .not.ismissing(new_lon(i,lengths(i)-1)).and.\
>> .not.ismissing(new_lat(i,lengths(i)-1))) then
>> dumt3(i-bcurve) = gsn_add_text(wks,plot,ssn(i), \
>> new_lon(i,lengths(i)-1), \
>> new_lat(i,lengths(i)-1),txres)
>> end if
>> end do
>> txres@txFontHeightF <mailto:txres@txFontHeightF> = 0.007
>> txres@txJust <mailto:txres@txJust> = "CenterCenter"
>> txres@txPerimSpaceF <mailto:txres@txPerimSpaceF> = 1.0
>> txres@txPerimThicknessF <mailto:txres@txPerimThicknessF> = 1.5
>> txres@txConstantSpacingF <mailto:txres@txConstantSpacingF> = 1.0
>> txres@txFontAspectF <mailto:txres@txFontAspectF> = 1.5
>> txres@txFontThicknessF <mailto:txres@txFontThicknessF> = 0.4
>> txres@gsnDraw <mailto:txres@gsnDraw> = False
>> ;
>> ; Note: the X and Y positions in this case don't matter, because the
>> ; text will get repositioned in the "gsn_add_anotation" function.
>> ;
>> lambert_text = gsn_create_text(wks,"~F02~ Lambert Conformal Conic
>> ~C~ True at 20~0557~ and 40~0557~ North ",txres)
>>
>> if (.not. TypeOn) then
>> txres@txFontHeightF <mailto:txres@txFontHeightF> = 0.006
>> txres@txJust <mailto:txres@txJust> = "CenterCenter"
>> txres@txPerimSpaceF <mailto:txres@txPerimSpaceF> = 0.7
>> txres@txPerimThicknessF <mailto:txres@txPerimThicknessF> = 1.5
>> txres@txConstantSpacingF <mailto:txres@txConstantSpacingF> = 1.0
>> txres@txFontAspectF <mailto:txres@txFontAspectF> = 1.5
>> txres@txFontThicknessF <mailto:txres@txFontThicknessF> = 0.8
>> txres@gsnDraw <mailto:txres@gsnDraw> = True
>> gsn_text_ndc(wks,"~F02~ Remnant low, tropical wave, and ~C~
>> extratropical stages are not shown. ~C~~C~ Subtropical stages are
>> dashed.",0.715,0.680,txres)
>> end if
>> txres@txFontHeightF <mailto:txres@txFontHeightF> = 0.012
>> txres@txPerimThicknessF <mailto:txres@txPerimThicknessF> = 1.5
>> txres@txPerimSpaceF <mailto:txres@txPerimSpaceF> = 0.5
>> txres@txConstantSpacingF <mailto:txres@txConstantSpacingF> = 1.0
>> txres@txFontAspectF <mailto:txres@txFontAspectF> = 1.5
>> txres@txFontThicknessF <mailto:txres@txFontThicknessF> = 1.6
>> txres@gsnDraw <mailto:txres@gsnDraw> = False
>> ;
>> ; Note: the X and Y positions in this case don't matter, because the
>> ; text will get repositioned in the "gsn_add_anotation" function.
>> ;
>> atlantic_text = gsn_create_text(wks,"~F02~ " + yyyy + " Atlantic
>> Tropical Cyclones",txres)
>> txres@txFontHeightF <mailto:txres@txFontHeightF> = 0.005
>> txres@txPerimThicknessF <mailto:txres@txPerimThicknessF> = 1.5
>> txres@txPerimSpaceF <mailto:txres@txPerimSpaceF> = 1.0
>> txres@txConstantSpacingF <mailto:txres@txConstantSpacingF> = 1.0
>> txres@txFontAspectF <mailto:txres@txFontAspectF> = 1.5
>> txres@txFontThicknessF <mailto:txres@txFontThicknessF> = 0.8
>> if (yyyy .eq. 2001) then
>> txres@gsnDraw <mailto:txres@gsnDraw> = True
>> gsn_text_ndc(wks,"~F02~ 1 T Allison 05-17 Jun. ~C~ 2
>> Two 11-12 Jul. ~C~ 3 T Barry 02-07 Aug. ~C~ 4 T
>> Chantal 14-22 Aug. ~C~ 5 T Dean 22-28 Aug. ~C~ 6 H
>> Erin 01-15 Sep. ~C~ 7 H Felix 06-18
>> Sep.~C~",0.263,0.650,txres) gsn_text_ndc(wks,"~F02~ 8 H
>> Gabrielle 11-19 Sep. ~C~ 9 Nine 19-20 Sep. ~C~10 H
>> Humberto 21-27 Sep. ~C~11 H Iris 04-09 Oct. ~C~12 T
>> Jerry 06-08 Oct. ~C~13 H Karen 12-15 Oct. ~C~14 T
>> Lorenzo 27-31 Oct.~C~",0.263,0.355,txres)
>> gsn_text_ndc(wks,"~F02~15 H Michelle 29 Oct.-05 Nov.~C~16 H
>> Noel 04-06 Nov. ~C~17 H Olga 24 Nov.-04
>> Dec.~C~"
>> ,0.263,0.310,txres)
>> end if if (yyyy .eq. 2002) then
>> txres@gsnDraw <mailto:txres@gsnDraw> = True
>> gsn_text_ndc(wks,"~F02~ 1 T Arthur 14-16 Jul. ~C~ 2 T
>> Bertha 04-09 Aug. ~C~ 3 T Cristobal 05-08 Aug. ~C~ 4 T
>> Dolly 29 Aug.-04 Sep.~C~ 5 T Edouard 01-06 Sep. ~C~ 6 T
>> Fay 05-08 Sep. ~C~ 7 Seven 07-08
>> Sep.~C~",0.263,0.650,txres)
>> gsn_text_ndc(wks,"~F02~ 8 H Gustav 08-12 Sep. ~C~ 9 T
>> Hanna 11-14 Sep. ~C~10 H Isidore 14-26 Sep. ~C~11 T
>> Josephine 17-19 Sep. ~C~12 H Kyle 20 Sep.-12 Oct.~C~13 H
>> Lili 21 Sep.-04 Oct.~C~14 Fourteen 14-16
>> Oct.~C~",0.263,0.360,txres)
>> end if
>> if(yyyy .eq. 2003) then
>> txres@txFontHeightF <mailto:txres@txFontHeightF> = 0.0075
>> txres@gsnDraw <mailto:txres@gsnDraw> = False
>> ana_text = gsn_create_text(wks,"~F02~ 1 T Ana 20-24
>> Apr. ~C~ 2 Two 10-11 Jun. ~C~ 3 T Bill 29
>> Jun.-02 Jul.~C~ 4 H Claudette 08-17 Jul. ~C~ 5 H Danny
>> 16-21 Jul. ~C~ 6 Six 19-21 Jul. ~C~ 7 Seven
>> 25-27 Jul.~C~",txres)
>> erika_text = gsn_create_text(wks,"~F02~ 8 H Erika 14-17
>> Aug. ~C~ 9 Nine 21-22 Aug. ~C~10 H Fabian 27
>> Aug.-08 Sep.~C~11 T Grace 30-02 Sep. ~C~12 T Henri
>> 03-08 Sep. ~C~13 H Isabel 06-19 Sep. ~C~14 Fourteen
>> 08-10 Sep.~C~",txres)
>> juan_text = gsn_create_text(wks,"~F02~15 H Juan 24-29
>> Sep. ~C~16 H Kate 25 Sep.-07 Oct.~C~17 T Larry 01-06
>> Oct. ~C~18 T Mindy 10-14 Oct. ~C~19 T Nicholas 13-23
>> Oct. ~C~20 T Odette 04-07 Dec. ~C~21 T Peter 07-11
>> Dec.~C~",txres)
>> amres = True
>> amres@amParallelPosF <mailto:amres@amParallelPosF> = -0.49
>> amres@amOrthogonalPosF <mailto:amres@amOrthogonalPosF> = -0.43
>> amres@amJust <mailto:amres@amJust> = "TopLeft"
>> txid1 = gsn_add_annotation(plot,ana_text,amres)
>> amres@amParallelPosF <mailto:amres@amParallelPosF> = -0.49
>> amres@amOrthogonalPosF <mailto:amres@amOrthogonalPosF> = 0..35
>> amres@amJust <mailto:amres@amJust> = "BottomLeft"
>> txid2 = gsn_add_annotation(plot,erika_text,amres)
>> amres@amParallelPosF <mailto:amres@amParallelPosF> = -0.49
>> amres@amOrthogonalPosF <mailto:amres@amOrthogonalPosF> = 0..35
>> amres@amJust <mailto:amres@amJust> = "TopLeft"
>> txid3 = gsn_add_annotation(plot,juan_text,amres)
>> end if
>> ;******************
>> ; Plot a legend *
>> ;******************
>> lgres = True
>>
>> lgres@lgAutoManage <mailto:lgres@lgAutoManage> = False
>>
>> lgres@vpWidthF <mailto:lgres@vpWidthF> = 0.1 ; was
>> 0.08 ; width of legend (NDC)
>> lgres@vpHeightF <mailto:lgres@vpHeightF> = 0.1 ; was
>> 0.08 ; height of legend (NDC)
>> ; lgres@lgBottomMarginF <mailto:lgres@lgBottomMarginF> = 0.17
>> ; was 0.25
>> lgres@lgPerimFill <mailto:lgres@lgPerimFill> =
>> 0 ; Use solid fill (0) instead of the default
>> hollow fill
>> lgres@lgPerimFillColor <mailto:lgres@lgPerimFillColor> = "Background"
>> ; lgres@lgBoxMajorExtentF <mailto:lgres@lgBoxMajorExtentF> = 0.4
>> lgres@lgBoxMinorExtentF <mailto:lgres@lgBoxMinorExtentF> = 0.2 ;
>> controls how wide the box holding the legend items (lines and
>> markers) can be in relation to legend
>>
>> ; lgres@lgBoxBackground <mailto:lgres@lgBoxBackground> =
>> "PaleTurquoise3"
>>
>> lgres@lgMonoItemType <mailto:lgres@lgMonoItemType> =
>> False ; indicates that we wish to set the item types
>> individually
>> lgres@lgMonoMarkerIndex <mailto:lgres@lgMonoMarkerIndex> = False
>> lgres@lgMonoLineThickness <mailto:lgres@lgMonoLineThickness> = False
>> lgres@lgMonoMarkerThickness <mailto:lgres@lgMonoMarkerThickness> =
>> False
>> lgres@lgMonoMarkerSize <mailto:lgres@lgMonoMarkerSize> = False
>> ; Position fine elements of legend relative to some positional values:
>> if (yyyy .eq. 2002) then
>> xlegend = 0.710
>> ylegend = 0.350
>> else
>> xlegend = 0.680
>> ylegend = 0.390
>> end if
>> if(TypeOn) then
>> lgres@lgLabelFont <mailto:lgres@lgLabelFont> = 0
>> lgres@lgLabelFontHeightF <mailto:lgres@lgLabelFontHeightF> =
>> 0.04
>> lgres@lgLabelFontAspectF <mailto:lgres@lgLabelFontAspectF> = 1.2
>> lgres@lgLabelConstantSpacingF
>> <mailto:lgres@lgLabelConstantSpacingF> = 0.0
>> lgres@lgItemCount <mailto:lgres@lgItemCount> = 11
>> lgres@lgLineDashSegLenF <mailto:lgres@lgLineDashSegLenF> = 0..1
>> lgres@lgItemTypes <mailto:lgres@lgItemTypes> =
>> (/"Markers","Markers","Markers","Lines","Lines","Lines","Lines","Lines","Lines","Lines","Lines"/)
>>
>> lgres@lgMarkerIndexes <mailto:lgres@lgMarkerIndexes> =
>> (/ 1, 4, 16, 0, 0, 0,
>> 0, 0, 0, 0, 0/)
>> lgres@lgLineThicknesses <mailto:lgres@lgLineThicknesses> =
>> (/ 0.1, 0.1, 0.1, 4.0, 4.0, 4.0, 4.0,
>> 4.0, 4.0, 4.0, 4.0/)
>> lgres@lgMarkerColors <mailto:lgres@lgMarkerColors> = (/
>> "White", "Black", "Black"/)
>> lgres@lgMarkerSizes <mailto:lgres@lgMarkerSizes> = (/
>> 0.0001, 0.004, 0.004/)
>> lgres@lgLineColors <mailto:lgres@lgLineColors> = (/
>> "White", "Black", "Black",\
>> "SlateBlue1", "DarkGreen",
>> "Black", "Blue1", "Dark Orange",
>> "DarkGreen", "Yellow", "Red" /) ; colors for
>> legend lines
>> lgres@lgDashIndexes <mailto:lgres@lgDashIndexes> = (/
>> 0, 0, 0,\
>> 2, 2,
>> 2, 0, 0,
>> 0, 0, 0 /) ; dash indexes
>> legend_labels = (/"Tropical Cyclone No.","1200 UTC Position/Date", \
>> "0000 UTC Position","Remnant Low","Tropical
>> Wave", \
>> "Extratropical","Subtropical Dep.","Subtropical
>> Storm",\
>> "Tropical Dep.","Tropical Storm (T)","Hurricane
>> (H)"/)
>> legend = gsn_create_legend(wks,10,legend_labels,lgres)
>> yoffset_day = -0.0858
>> yoffset_storm = -0.0910
>> else
>>
>> lgres@lgLabelFont <mailto:lgres@lgLabelFont> = 0
>> lgres@lgLabelFontHeightF <mailto:lgres@lgLabelFontHeightF> =
>> 0.004
>> lgres@lgLabelFontAspectF <mailto:lgres@lgLabelFontAspectF> = 1.2
>> lgres@lgLabelConstantSpacingF
>> <mailto:lgres@lgLabelConstantSpacingF> = 0.0
>> lgres@lgItemCount <mailto:lgres@lgItemCount> = 6
>> lgres@lgItemTypes <mailto:lgres@lgItemTypes> =
>> (/"Markers","Markers","Markers","Lines" ,"Lines" ,"Lines"/)
>> lgres@lgLineColors <mailto:lgres@lgLineColors> = (/"White",
>> "Black" ,"Black" ,"DarkGreen","Yellow","Red" /) ; colors for
>> legend lines
>> lgres@lgLineThicknesses <mailto:lgres@lgLineThicknesses> = (/
>> 0.1, 0.1, 0.1, 4.0, 4.0, 4.0/)
>> lgres@lgDashIndexes <mailto:lgres@lgDashIndexes> = (/
>> 0, 0, 0, 0, 0, 0/)
>> lgres@lgMarkerIndexes <mailto:lgres@lgMarkerIndexes> = (/
>> 0, 4, 16, 0, 0, 0/)
>> lgres@lgMarkerColors <mailto:lgres@lgMarkerColors> = (/"White",
>> "Black" , "Black"/)
>> lgres@lgMarkerSizes <mailto:lgres@lgMarkerSizes> = (/
>> 0.0001, 0.004, 0.004/)
>> gsn_legend_ndc(wks,5,(/"Tropical Cyclone No.","1200 UTC
>> Position/Date","0000 UTC Position",\
>> "Tropical Dep.","Tropical Storm
>> (T)","Hurricane (H)"/),xlegend,ylegend,lgres) yoffset_day =
>> -0.0750 ; offsets for the case where we don't plot all the extra cases
>> yoffset_storm = -0.0875
>> end if
>>
>> ; Now draw a day label on the legend
>> txres@txPerimOn <mailto:txres@txPerimOn> = False
>> txres@txFontHeightF <mailto:txres@txFontHeightF> = 0.0022
>> txres@txPerimSpaceF <mailto:txres@txPerimSpaceF> = 0.0
>> txres@txJust <mailto:txres@txJust> = "CenterCenter"
>> txres@gsnDraw <mailto:txres@gsnDraw> = False
>> ;
>> ; Note: the X and Y positions in this case don't matter, because the
>> ; text will get repositioned in the "gsn_add_anotation" function.
>> ;
>> number_text = gsn_create_text(wks,"21",txres)
>> ; Draw storm number on the legend txres@txFontHeightF
>> <mailto:txres@txFontHeightF> = 0.0028
>> txres@txPerimOn <mailto:txres@txPerimOn> = True
>> txres@txPerimColor <mailto:txres@txPerimColor> = "Black"
>> txres@txPerimThicknessF <mailto:txres@txPerimThicknessF> = 1.0
>> txres@txPerimSpaceF <mailto:txres@txPerimSpaceF> = 0.4
>> txres@txBackgroundFillColor <mailto:txres@txBackgroundFillColor> =
>> "White"
>> three_text = gsn_create_text(wks,"3",txres) ;
>> ; Add the various text and legend annotations to the plot.
>> ;
>> amres@amParallelPosF <mailto:amres@amParallelPosF> = -0.13
>> amres@amOrthogonalPosF <mailto:amres@amOrthogonalPosF> = -0.48
>> amres@amJust <mailto:amres@amJust> = "TopCenter"
>> txid4 = gsn_add_annotation(plot,atlantic_text,amres)
>> amres@amParallelPosF <mailto:amres@amParallelPosF> = 0.383
>> amres@amOrthogonalPosF <mailto:amres@amOrthogonalPosF> = 0.470
>> amres@amJust <mailto:amres@amJust> = "BottomRight"
>> txid5 = gsn_add_annotation(plot,number_text,amres)
>> amres@amParallelPosF <mailto:amres@amParallelPosF> = 0.3815
>> amres@amOrthogonalPosF <mailto:amres@amOrthogonalPosF> = 0.479
>> amres@amJust <mailto:amres@amJust> = "BottomRight"
>> txid6 = gsn_add_annotation(plot,three_text,amres)
>> amres@amParallelPosF <mailto:amres@amParallelPosF> = 0.49
>> amres@amOrthogonalPosF <mailto:amres@amOrthogonalPosF> = 0.49
>> amres@amJust <mailto:amres@amJust> = "BottomRight"
>> annoid1 = gsn_add_annotation(plot,legend,amres)
>> amres@amJust <mailto:amres@amJust> = "BottomCenter"
>> amres@amParallelPosF <mailto:amres@amParallelPosF> = 0.00
>> amres@amOrthogonalPosF <mailto:amres@amOrthogonalPosF> = 0.49
>> annoid2 = gsn_add_annotation(plot,lambert_text,amres)
>> draw(plot)
>> frame(wks)
>>
>> end
>>
>>
>> ------------------------------------------------------------------------
>> Yahoo!香港提供網上安全攻略,教你如何防範黑客!*了解更多*
>> <http://hk.promo.yahoo.com/security/>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

;********************************************************
; track_one.ncl
;
; Author: Jonathan Vigh (with assistance from Mary Haley)
; Location: Colorado State University
;
;
; The purpose of this script is to plot the best track
; for jut one storm including all data (subtropical
; storms, depressions, extrtropical lows, etc.)
;
; For future work - fix up annotations with new NCL annotation functionality.
; ALSO, see about controlling the lat/lon tickmark spacing using
; a resource like gsnMajorLatSpacing.
;
;********************************************************
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/shea_util.ncl"

begin

   fili = "BAL131998.DAT"
   name = "Mitch"
   ssn = "13"

; Next, set the plotting parameters (which cases to plot)
   TypeOn = True ; If you just want the legend to have the basic (H, TS, and TD) designators (* and S), set TypeOn to False
                                      ; NOTE -- this will cause the program to grab a different input file -- one in which all the
                                      ; extratropical (E), remnant low (L), and wave cases (W) have been taken out; additionally,
                                      ; there will not be a distinction between the S and * cases (they will just be plotted according to
                                      ; intensity

   PlotSubTropicalSegments = True ; If you wish to exclude all subtropical line segments, set to False
   
; Note: if TypeOn is set to False, the following (W, L, E) cases won't be plotted regardless of their value
   PlotWaveSegments = True ; If you wish to exclude all wave segments, set to False
   PlotLowSegments = True ; If you wish to exclude all remnant low segments, set to False
   PlotExtraTropicalSegments = True ; If you wish to exclude all extratropical line sements, set to False

  
;********************************
; get data
;********************************
  tStr = asciiread(fili, -1,"string") ; Info includes type so cases can be weeded out

  tChr = stringtochar(tStr)
 
  nrows = dimsizes(tStr)
  
  
  sn = stringtoint( chartostring(tChr(:,0:1)) )
  year = stringtoint( chartostring(tChr(:,2:3)) )
  month = stringtoint( chartostring(tChr(:,4:5)) )
  day = stringtoint( chartostring(tChr(:,6:7)) )
  hour = stringtoint( chartostring(tChr(:,8:9)) )
  
  lat = stringtofloat( chartostring(tChr(:,10:13)) )/10.0
  lon = -stringtofloat( chartostring(tChr(:,15:18)) )/10.0
  vmax = stringtoint( chartostring(tChr(:,21:23)) )
  
  type = chartostring(tChr(:,30:30))

; Now create arrays that only hold the points for the 00z locations
  lat0 = mask(lat,hour,0)
  lon0 = mask(lon,hour,0)
  
  lat12 = mask(lat,hour,12)
  lon12 = mask(lon,hour,12)
  day12 = mask(day,hour,12)
  

;********************************
; select sub-regions
;********************************
     minlat = 5.0 ;min(lat) ; 0.0 ; deg N ; was 0
     maxlat = 30.0 ;max(lat) ; 57.0 ; deg N ; was 57
     minlon = -95.0 ; min(lon) -.;-100.0 ; - deg E = deg W ; was -100
     maxlon = -70.0 ; max(lon) +10.; -10.0 ; - deg E = deg W ; was -20, then -15

;***** Define some NICE color maps to use.
   colors_8 = (/"White","Black","Black","MediumPurple1","MediumPurple3","Blue1",\
          "CadetBlue3","Aquamarine2", \
          "Gold","Tan1","Sienna1","Tomato","VioletRed1", \
          "Yellow","LimeGreen","Grey37","Red","Orange","GoldenRod1", \
          "DarkOrange","SteelBlue1","SlateBlue1","SlateGray1", \
          "LightSlateBlue","Magenta","DodgerBlue", \
          "LightSteelBlue1","Moccasin","LightYellow","LemonChiffon1", \
          "CornSilk","LightGoldenrodYellow","Tan","PaleTurquoise3"/)

   
;********************************
; create plot
;********************************
   wks = gsn_open_wks("eps",name)

   gsn_define_colormap(wks,colors_8)
   
   res = True

; res@gsnMaximize = True
   res@gsnDraw = False ; so we can add poly stuff
   res@gsnFrame = False ; do not advance frame

   res@gsnMaximize = True

; res@gsnPaperOrientation = "portrait"

   res@mpDataBaseVersion = "Ncarg4_1" ; Alias 'MediumRes'
   res@mpDataSetName = "Earth..1"
; res@mpProjection = "LambertConformal"
      
   res@mpLambertParallel1F = 20.0
   res@mpLambertParallel2F = 40.0
   res@mpLambertMeridianF = -60.0
   
   res@mpLimitMode = "LatLon"

   res@mpMinLatF = minlat
   res@mpMaxLatF = maxlat
   res@mpMinLonF = minlon
   res@mpMaxLonF = maxlon
  
   res@mpFillOn = True ; False to turn off gray continents
   res@mpOutlineOn = True ; turn on continental outline
   res@mpOutlineBoundarySets = "AllBoundaries"

   res@mpLandFillColor = "Tan" ; was "GoldenRod1"
   res@mpInlandWaterFillColor = "PaleTurquoise3" ; was "LightBlue1" ; was "PaleTurquoise3"
   res@mpOceanFillColor = "PaleTurquoise3" ; was "LightBlue1"

   res@mpGeophysicalLineColor = "Grey37"
   res@mpGeophysicalLineThicknessF = 0.5
   
   res@mpUSStateLineColor = "Grey37"
   res@mpUSStateLineThicknessF = 0.5
   
   res@mpNationalLineColor = "Grey37"
   res@mpNationalLineThicknessF = 0.5
   
   res@mpGridAndLimbOn = "True"
   res@mpGridAndLimbDrawOrder = "Draw"
   res@mpGridMaskMode = "MaskLand"
   res@mpGridSpacingF = 5.0
   res@mpGridLineColor = "Grey37"

   res@tmXBLabelFontHeightF = 0.012 ; 0.005
   res@tmXBMajorLengthF = -0.001

   res@pmTickMarkDisplayMode = "Always"
   
 ; res@tiMainString = "Hurricane Wilma (2005)"
    
;***************************************
; plot base map *
;***************************************

    plot = gsn_csm_map(wks,res) ; draw one of eight map projections

   
;***************************************
; Draw best track history as polylines *
;***************************************
   res_poly = True ; polyline mods desired
 
; create array of dummy graphic variables. This is required, b/c each line
; must be associated with a unique dummy variable.

  dum = new(dimsizes(hour),graphic)

  ic = 0
  do k=0,nrows-2

        if(.not.ismissing(lat(k)))

           res_poly@gsLineDashPattern = 0
           res_poly@gsLineThicknessF = 4

if(.not. TypeOn) then

; Plot hurricane segments
           if((vmax(k).gt.64).and.(type(k).eq."*")) then
              res_poly@gsLineColor = "Red"
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

; Plot tropical storm segments
           if((vmax(k).lt.64).and.(vmax(k).gt.34).and.(type(k).eq."*")) then
              res_poly@gsLineColor = "Yellow"
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

; Plot tropical depression segments
           if((vmax(k).lt.34).and.(type(k).eq."*")) then
              res_poly@gsLineColor = "LimeGreen"
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

; Now plot the subtropical segments with dashed lines

; Plot hurricane segments of subtropical systems with dashed red lines
           if((vmax(k).gt.64).and.(type(k).eq."S")) then
              res_poly@gsLineColor = "Red"
              res_poly@gsLineDashPattern = 2
              res_poly@gsLineDashSegLenF = 0.1
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

; Plot tropical storm segments of subtropical systems with dashed yellow lines
           if((vmax(k).lt.64).and.(vmax(k).gt.34).and.(type(k).eq."S")) then
              res_poly@gsLineColor = "Yellow"
              res_poly@gsLineDashPattern = 2
              res_poly@gsLineDashSegLenF = 0.1
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

; Plot tropical depression segments of subtropical systems with dashed dark LimeGreen lines
           if((vmax(k).lt.34).and.(type(k).eq."S")) then
              res_poly@gsLineColor = "LimeGreen"
              res_poly@gsLineDashPattern = 2
              res_poly@gsLineDashSegLenF = 0.1
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

else ; if(TypeOn) -- plot pure tropical segments as solid lines (red for hurricane, etc.).

; Plot hurricane segments
           if((vmax(k).gt.64).and.(type(k).eq."*")) then
              res_poly@gsLineColor = "Red"
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

; Plot tropical storm segments
           if((vmax(k).lt.64).and.(vmax(k).gt.34).and.(type(k).eq."*")) then
              res_poly@gsLineColor = "Yellow"
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

; Plot tropical depression segments
           if((vmax(k).lt.34).and.(type(k).eq."*")) then
              res_poly@gsLineColor = "LimeGreen"
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

   if(PlotWaveSegments) then

; Plot tropical wave segments
           if(type(k).eq."W") then
              res_poly@gsLineColor = "LimeGreen"
              res_poly@gsLineDashPattern = 2
              res_poly@gsLineDashSegLenF = 0.1
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if
   end if

   if(PlotLowSegments) then

; Plot remanant low segments
           if(type(k).eq."L") then
              res_poly@gsLineColor = "SlateBlue"
              res_poly@gsLineDashPattern = 2
              res_poly@gsLineDashSegLenF = 0.1
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if
   end if
   

   if(PlotSubTropicalSegments) then
        
; Plot subtropical storm segments
           if((vmax(k).gt.34).and.(type(k).eq."S")) then
              res_poly@gsLineColor = "DarkOrange"
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

; Plot subtropical depression segments
           if((vmax(k).lt.34).and.(type(k).eq."S")) then
              res_poly@gsLineColor = "Blue1"
              dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
              ic = ic + 1
           end if

   end if

   if(PlotExtraTropicalSegments) then

; Plot extratropical segments
      if(type(k).eq."E") then
        res_poly@gsLineColor = "Black"
        res_poly@gsLineDashPattern = 2
        res_poly@gsLineDashSegLenF = 0.1
        dum(ic) = gsn_add_polyline(wks,plot,lon(k:k+1),lat(k:k+1),res_poly)
        ic = ic + 1
      end if
   end if
end if
        
        end if

   end do

;***************************************
; Draw black dots at lat/lon itersections
;***************************************
   

;***************************************
; Draw black polymarkers at 00Z locations
;***************************************
   res_mark = True

   res_mark@gsMarkerIndex = 1 ; polymarker style
   res_mark@gsMarkerSizeF = 0.02 ; polymarker size - was 0.012
   res_mark@gsMarkerColor = "Black" ; change marker color

   duma = new(1,graphic)
   duma = gsn_add_polymarker(wks,plot,lon0,lat0,res_mark)

   
; Now draw white polymarkers at 12z locations
   res_mark@gsMarkerIndex = 1
   res_mark@gsMarkerSizeF = 0.02 ; polymarker size - was 0.012
   res_mark@gsMarkerColor = "White" ; change marker color
      
   
   dumb = new(1,graphic)
   dumb = gsn_add_polymarker(wks,plot,lon12,lat12,res_mark)

;***************************
; Plot some text labels *
;***************************
   txres = True

; Now draw the day labels at each 00Z marker
   txres@txFontHeightF = 0.015 ; 0.008
   txres@txJust = "TopCenter"
   
   dumz = new(nrows,graphic)
  
   do k=0,nrows-1
      dumz(k) = gsn_add_text(wks,plot,day12(k),lon12(k),lat12(k)-0.25,txres)
   end do

   draw(wks)

; Draw storm number (actually these are strings) at beginning of track
   txres@txFontHeightF = 0.02 ; 0.0044
   txres@txJust = "CenterLeft"
   
   txres@txPerimOn = True
   txres@txPerimColor = "Black"
   txres@txPerimThicknessF = 1.0
   txres@txPerimSpaceF = 0.4
   txres@txBackgroundFillColor = "White"

; gsn_text(wks,plot,ssn,lon(0)+0.6,lat(0),txres)

; Now draw them at the end
   txres@txJust = "BottomRight"
; gsn_text(wks,plot,ssn,lon(nrows-1),lat(nrows-1),txres)

if (.not. TypeOn) then
   txres@txFontHeightF = 0.02 ; 0.006
   txres@txJust = "CenterCenter"
   txres@txPerimSpaceF = 0.7
   txres@txPerimThicknessF = 1.5
   txres@txConstantSpacingF = 1.0
   txres@txFontAspectF = 1.5
   txres@txFontThicknessF = 0.8
   gsn_text_ndc(wks,"~F02~ Remnant low, tropical wave, and ~C~ extratropical stages are not shown. ~C~~C~ Subtropical stages are dashed.",0.715,0.680,txres)
end if

   txres@txFontHeightF = 0.005
   txres@txPerimThicknessF = 1.5
   txres@txPerimSpaceF = 1.0
   txres@txConstantSpacingF = 1.0
   txres@txFontAspectF = 1.5
   txres@txFontThicknessF = 0.8

;******************
; Plot a legend *
;******************
 lgres = False
 
 lgres@lgAutoManage = False
  
 lgres@vpWidthF = 0.2 ; was 0.1 ; width of legend (NDC)
 lgres@vpHeightF = 0.2 ; was 0.1 ; height of legend (NDC)
; lgres@lgBottomMarginF = 0.17 ; was 0.25

 lgres@lgPerimFill = 0 ; Use solid fill (0) instead of the default hollow fill
 lgres@lgPerimFillColor = "Background"

; lgres@lgBoxMajorExtentF = 0.4
 lgres@lgBoxMinorExtentF = 0.2 ; controls how wide the box holding the legend items (lines and markers) can be in relation to legend
 
; lgres@lgBoxBackground = "PaleTurquoise3"
 
 lgres@lgMonoItemType = False ; indicates that we wish to set the item types individually
 lgres@lgMonoMarkerIndex = False
 lgres@lgMonoLineThickness = False
 lgres@lgMonoMarkerThickness = False
 lgres@lgMonoMarkerSize = False

; position fine elements of legend relative to some positional values:
   xlegend = 0.66 ; 0.820
   ylegend = 0.35 ; 0.290

if(TypeOn) then

   lgres@lgLabelFont = 0
   lgres@lgLabelFontHeightF = 0.012 ; 0.004
   lgres@lgLabelFontAspectF = 1.2
   lgres@lgLabelConstantSpacingF = 0.0

   lgres@lgItemCount = 11
   lgres@lgLineDashSegLenF = 0.1
   lgres@lgItemTypes = (/"Markers","Markers","Markers","Lines","Lines","Lines","Lines","Lines","Lines","Lines","Lines"/)
   lgres@lgMarkerIndexes = (/ 1, 4, 16, 0, 0, 0, 0, 0, 0, 0, 0/)
   lgres@lgLineThicknesses = (/ 0.1, 0.1, 0.1, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0/)
   lgres@lgMarkerColors = (/ "White", "Black", "Black"/)
   lgres@lgMarkerSizes = (/ 0.0001, 0.004, 0.004/)
   lgres@lgLineColors = (/ "White", "Black", "Black",\
                                "SlateBlue1", "LimeGreen", "Black", "Blue1", "Dark Orange", "LimeGreen", "Yellow", "Red" /) ; colors for legend lines
   lgres@lgDashIndexes = (/ 0, 0, 0,\
                                     2, 2, 2, 0, 0, 0, 0, 0 /) ; dash indexes

; gsn_legend_ndc(wks,10, (/"Tropical Cyclone No.","1200 UTC Position/Date","0000 UTC Position",\
; "Remnant Low","Tropical Wave","Extratropical","Subtropical Dep.","Subtropical Storm","Tropical Dep.","Tropical Storm (T)","Hurricane (H)"/),xlegend,ylegend,lgres)

   yoffset_day = -0.0858
   yoffset_storm = -0.0910

else
 
   lgres@lgLabelFont = 0
   lgres@lgLabelFontHeightF = 0.004
   lgres@lgLabelFontAspectF = 1.2
   lgres@lgLabelConstantSpacingF = 0.0

   lgres@lgItemCount = 6
   lgres@lgItemTypes = (/"Markers","Markers","Markers","Lines" ,"Lines" ,"Lines"/)
   lgres@lgLineColors = (/"White", "Black" ,"Black" ,"LimeGreen","Yellow","Red" /) ; colors for legend lines
   lgres@lgLineThicknesses = (/ 0.1, 0.1, 0.1, 4.0, 4.0, 4.0/)
   lgres@lgDashIndexes = (/ 0, 0, 0, 0, 0, 0/)
   lgres@lgMarkerIndexes = (/ 0, 4, 16, 0, 0, 0/)
   lgres@lgMarkerColors = (/"White", "Black" , "Black"/)
   lgres@lgMarkerSizes = (/ 0.0001, 0.004, 0.004/)

; gsn_legend_ndc(wks,5,(/"Tropical Cyclone No.","1200 UTC Position/Date","0000 UTC Position",\
; "Tropical Dep.","Tropical Storm (T)","Hurricane (H)"/),xlegend,ylegend,lgres)

   yoffset_day = -0.0750 ; offsets for the case where we don't plot all the extra cases
   yoffset_storm = -0.0875

end if
 
; Now draw a day label on the legend

   txres@txPerimOn = False
   txres@txFontHeightF = 0.01
   txres@txPerimSpaceF = 0.0
   txres@txJust = "CenterCenter"

; gsn_text_ndc(wks,"21",xlegend + 0.0183, ylegend + yoffset_day,txres)

; Draw storm number on the legend
   txres@txFontHeightF = 0.004
   
   txres@txPerimOn = True
   txres@txPerimColor = "Black"
   txres@txPerimThicknessF = 1.0
   txres@txPerimSpaceF = 0.4
   txres@txBackgroundFillColor = "White"

; gsn_text_ndc(wks,"3",xlegend + 0.0142, ylegend + yoffset_storm,txres)
; drawNDCGrid(wks) ; Use to put on a grid for fine-tuning placement
   
   frame(wks)
  
end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 20 10:15:36 2009

This archive was generated by hypermail 2.1.8 : Mon Nov 23 2009 - 12:24:02 MST