ibt_map_all_storms.ncl 3.97 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ibt_map_all_storms.ncl
; Carl Schreck (carl@cicsnc.org)
; October 2011
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

undef (  "ibt_map_all_storms" )
procedure ibt_map_all_storms( \
  io_wks        [1] : graphic, \
  io_plot       [1] : graphic, \
  i_inPath      [1] : string , \
  i_minTime     [1] : numeric, \
13
14
  i_maxTime     [1] : numeric, \
  i_tcRes       [1] : logical \ ; ibtFullTrack, lgLegendOn, ibtAddGenesis,  \
15
                                ; ibtStartName, ibtEndName, ibtBasin
16
17
18
19
20
21
22
23
24
25
26
27
)
begin ; ibt_map_all_storms
  ; These are some parameters that could be useful to have up top
  fontHeightF = 0.02

  thresh = (/ 35, 64, 83, 96, 113, 137 /)
  colors = (/ "gray50", "gray25", "cyan", "blue", "orange", "red", "magenta" /)
  labels = "   " \
      + (/ "TD",     "TS",     "Cat-1", "Cat-2", "Cat-3", "Cat-4", "Cat-5" /) \
      + "  "

  print_clock( "Reading TC data" )
28
  if( i_inPath.eq."" ) then
29
    inPath = IBT_DEFAULT_PATH
30
31
32
33
  else
    inPath = i_inPath
  end if
  inFile = addfile( inPath, "r" )
34
35
36
  name = tostring( inFile->name )
  id   = tostring( inFile->storm_sn )
  time = inFile->time_wmo
37
38
39
40
41
42
43
44
45
46
  if( getfilevartypes( inFile, "lat_wmo" ).eq."short" ) then
    lon = short2flt( inFile->lon_wmo )
    lat = short2flt( inFile->lat_wmo )
    wind = short2flt( inFile->wind_wmo )
  else
    lon =          ( inFile->lon_wmo )
    lat =          ( inFile->lat_wmo )
    wind =         ( inFile->wind_wmo )
  end if
  if( isfilevar( inFile, "genesis_basin" ) ) then
47
48
;   basin = inFile->genesis_basin
    basin = inFile->basin
49
50
51
52
53
54
55
56
57
  else
    basin = new( dimsizes(lon), integer )
    basin = -1
  end if
  if( isatt( i_tcRes, "ibtBasin" ) ) then
    targetBasin = i_tcRes@ibtBasin
  else
    targetBasin = -1
  end if
58
59
60
61
62
  if( isatt( i_tcRes, "thresh" ) ) then
    minWind = i_tcRes@thresh
  else
    minWind = -1
  end if
63
64
65
66

  minTime = cd_convert( i_minTime, time@units )
  maxTime = cd_convert( i_maxTime, time@units )

67
68
  i_tcRes@ibtMinTime = minTime
  i_tcRes@ibtMaxTime = maxTime
69
70
  lon = where( lon.lt.0, lon+360, lon )

71
  inBasin = ibt_check_basin( targetBasin, basin, lat, lon )
72
73
74
75
76
  lmi = dim_max_n( wind, 1 )
  aboveMinWind = lmi.ge.minWind
  if( minWind.lt.0 ) then
    aboveMinWind = True
  end if
77
78
79
80
81
82
83
84
85
86
87
88

  if( isatt( i_tcRes, "ibtAddGenesis" ) ) then
    if( .not.isatt( i_tcRes, "ibtStartName" ) ) then
      i_tcRes@ibtStartName = False
    end if
    if( .not.isatt( i_tcRes, "ibtEndName" ) ) then
      i_tcRes@ibtEndName = False
    end if
    ibt_genesis_map( io_wks, io_plot, i_inPath, i_minTime, i_maxTime,  \
        targetBasin, i_tcRes )
  end if

89
  do stormCounter = 0, dimsizes(name)-1
90
91
    inTime = any( ( time(stormCounter,:).ge.minTime ) \
        .and.( time(stormCounter,:).le.maxTime ) )
92
93
    if( any( inBasin(stormCounter,:) ).and.inTime \
        .and.( aboveMinWind(stormCounter) ) ) then
94
;print( name(stormCounter) + " " + minWind + " " + aboveMinWind(stormCounter) + " " + lmi(stormCounter) )
95
96
      ibt_map_one_storm( io_wks, io_plot, thresh, colors, \
          name(stormCounter), time(stormCounter,:), lat(stormCounter,:), \
97
          lon(stormCounter,:), wind(stormCounter,:), i_tcRes )
98
99
100
    end if
  end do

101

102

103
104
105
106
107
108
  lgRes = True
  lgRes@lgLabelFontHeightF = 0.07
  lgRes@lgLineColors = colors
  lgRes@vpWidthF = 0.08
  lgRes@vpHeightF = 0.10
  lgRes@lgPerimFill = 0
109
110
111
112
113
114
115
  lgRes@lgMonoDashIndex = True
  if( isatt( i_tcRes, "gsLineThicknessF" ) ) then
    lgRes@lgLineThicknessF = i_tcRes@gsLineThicknessF
  else
    lgRes@lgMonoLineThickness = False
    lgRes@lgLineThicknesses = 1 + ispan( 0, dimsizes(colors)-1, 1 )*0.33
  end if
116
  
117
  io_plot@lgId = gsn_create_legend( io_wks, dimsizes(labels), labels, lgRes )
118

119
120
121
122
123
124
125
126
127
  if( ( .not.isatt( i_tcRes, "lgLegendOn" ) ).or.i_tcRes@lgLegendOn ) then
    amRes = True
    amRes@amParallelPosF   = 1.0
    amRes@amOrthogonalPosF = 0.0
    amRes@amJust = "BottomRight"
    amRes@amZone = 1
    io_plot@legend = gsn_add_annotation( io_plot, io_plot@lgId, amRes )
  end if

128
129
130

end; ibt_map_all_storms