
# JStrack:  copyright 1997/2010 by Jim Graham, N5IAL, all rights reserved.
#

proc get_st_type   {name timestamp} { return [get_st_root $name $timestamp 0] }
proc get_st_name   {name timestamp} { return [get_st_root $name $timestamp 1] }
proc get_st_ts     {name timestamp} { return [get_st_root $name $timestamp 2] }
proc get_st_latt   {name timestamp} { return [get_st_root $name $timestamp 3] }
proc get_st_long   {name timestamp} { return [get_st_root $name $timestamp 4] }
proc get_st_course {name timestamp} { return [get_st_root $name $timestamp 5] }
proc get_st_speed  {name timestamp} { return [get_st_root $name $timestamp 6] }
proc get_st_press  {name timestamp} { return [get_st_root $name $timestamp 7] }
proc get_st_winds  {name timestamp} { return [get_st_root $name $timestamp 8] }
proc get_st_cat    {nm ts} {
   if {[string compare [get_st_type $nm $ts] "HR"] == 0} {
      return "CAT [st_cat [get_st_winds $nm $ts]]"
   } else {
      return ""
   }
}
proc get_st_gusts  {name timestamp} { return [get_st_root $name $timestamp 9] }
proc get_st_eye    {name timestamp} { return [get_st_root $name $timestamp 10] }

proc get_st_root {name timestamp lidx} {
   global stinfo
   set idx "$name$timestamp"
   if {[array get stinfo $idx] == ""} { return -1 }
   set retval [lindex $stinfo($idx) $lidx]
}


proc get_st_radii {name timestamp winds} {
   global stradii
   set idx $name$timestamp$winds
   if {[array get stradii $idx] == ""} { return [list] }
   set retval [split $stradii($idx)]
}


proc get_fc_latt  {nm ts fcts} { return [get_fc_root $nm $ts $fcts 0] }
proc get_fc_long  {nm ts fcts} { return [get_fc_root $nm $ts $fcts 1] }
proc get_fc_winds {nm ts fcts} { return [get_fc_root $nm $ts $fcts 2] }
proc get_fc_gusts {nm ts fcts} { return [get_fc_root $nm $ts $fcts 3] }

proc get_fc_root {name timestamp fcts lidx} {
   global forecasts
   set idx "$name $timestamp $fcts"
   if {[array get forecasts $idx] == ""} { return -1 }
   set retval [lindex $forecasts($idx) $lidx]
}


proc get_fc_radii {name timestamp fcts winds} {
   global fc_stradii
   set idx $name$timestamp$fcts$winds
   if {[array get fc_stradii $idx] == ""} { return [list] }
   set retval [split $fc_stradii($idx)]
}



