#!/opt/local/bin/perl #=============================================== # Marc 11 Sep 2008 # Create the links for web template #=============================================== # Set environment variables #----------------------------------- $menu_file="/home/storms/menu.def"; #----------------------------------- # Read the menu file #----------------------------------- &read_menu($menu_file, $ENV{'DOCUMENT_URI'}, *l_read, *home_link, *current_link, *links); if (! $l_read) { print "ERROR: failed to read file \n"; } #----------------------------------- # Decide which link to focus on #----------------------------------- if ( ($links{$current_link}{'nchildren'}) || ($links{$current_link}{'ancestors'} < 2) ) { #----------------------------------- # There's either links below this one to display or not links # above it so focus on this link #----------------------------------- $focus_link=$current_link; } else { #----------------------------------- # No links below to show this link as a link below parent #----------------------------------- $focus_link=$links{$current_link}{'parent'}; } #----------------------------------- # Display the buttons #----------------------------------- &display_buttons($focus_link, $current_link, $home_link, *links); #----------------------------------- # Exit script #----------------------------------- exit(0); #=============================================== # Read the menu file #=============================================== sub read_menu { #----------------------------------- # passed variables #----------------------------------- local ($menu_file, $document_uri, *l_read, *home_link, *current_link, *links)=@_; #----------------------------------- # local variables #----------------------------------- local ($generation); local ($menu_item); local ($nparts); local ($link); local ($parent); local ($child); local ($child2); local ($document_uri2); #----------------------------------- # Read the menu #----------------------------------- $l_read=0; open (MENU, "<" . $menu_file) || return; $l_read=1; @menu_raw = ; close (MENU); $tot_menu_raw=@menu_raw; #----------------------------------- # The first item is the home page #----------------------------------- (@parts)=split(/:/, $menu_raw[0]); $home_link=$parts[2]; $home_link =~ s/[\n ]*//g; $links{$home_link}{'full_uri'}=$home_link; $links{$home_link}{'name'}=$parts[1]; $generation=1; #----------------------------------- # Decode the other information #----------------------------------- for ($i=1; $i<$tot_menu_raw; $i++) { #----------------------------------- # See if we've changed generation #----------------------------------- if ($menu_raw[$i] =~ /{/) { $generation++; } elsif ($menu_raw[$i] =~ /}/) { $generation--; } else { #----------------------------------- # Split information into parts #----------------------------------- (@parts)=split(/:/, $menu_raw[$i]); $nparts=@parts; #----------------------------------- # If it has 4 parts the item must finish with a http URI #----------------------------------- if ($nparts > 3) { $link=$parts[2] . ":" . $parts[3]; } else { $link=$parts[2]; } $link =~ s/[\n ]*//g; #----------------------------------- # Work out the parent #----------------------------------- if ($parts[0] eq "all") { $parent=$home_link; } else { $parent=$parts[0]; } $links{$link}{'parent'}=$parent; #----------------------------------- # Store other information #----------------------------------- $links{$link}{'name'}=$parts[1]; $links{$link}{'ancestors'}=$generation; if ($nparts > 3) { $links{$link}{'full_uri'}=$link; } else { if ($generation == 1) { $links{$link}{'full_uri'}=$home_link . $link; } else { $links{$link}{'full_uri'}=$links{$parent}{'full_uri'} . "/" . $link; } } #----------------------------------- # Update parent information #----------------------------------- $links{$parent}{'nchildren'}++; $child="child" . $links{$parent}{'nchildren'}; $links{$parent}{$child}=$link; #----------------------------------- # See if this is the current link #----------------------------------- $link2=$links{$link}{'full_uri'}; $link2 =~ s/[A-Za-z0-9_.-]*\/\.\.\///g; $link2 =~ s/\/index.html//; $document_uri2=$document_uri; $document_uri2 =~ s/\/index.html//; if ($link2 eq $document_uri2) { $current_link=$link; } } } #----------------------------------- # Check generations make sense #----------------------------------- if ($generation != 1) { print "
ERROR: brackets are not closed \n"; } #----------------------------------- # If link isn't found take the home page #----------------------------------- if (! $current_link) { $current_link=$home_link; } } #=============================================== # Display the buttons #=============================================== sub display_buttons { #----------------------------------- # passed variables #----------------------------------- local ($focus_link, $current_link, $home_link, *links)=@_; #----------------------------------- # local variables #----------------------------------- local ($parent); local ($i); local ($child); local ($link); #----------------------------------- # Put in Met Department button #----------------------------------- print "Content-type: text/html\n\n"; print "
\n"; print " \n"; #----------------------------------- # Put in links of the same level #----------------------------------- print " \n"; print "
\n"; }

References

  • Ahrens, C. D. (2000). Meteorology today: An introduction to weather, climate, and the environment. Pacific Grove, CA: Brooks/Cole Pub.

  • Bengtsson, L., Hodges, K. I., Esch, M., Keenlyside, N., Kornblueh, L., Luo, J.-J., and Yamagats, T. 92007). How may tropical cyclones change in a warmer climate? Tellus, V59A, 539-561.

  • Bjerknes, J., and Solberg, H. (1922). Life cycle of cyclones and the polar front theory of atmospheric circulation. Geofys. Publ., 3, 1-18.

  • Browning, K. A., and Roberts, N. M. (1994). Structure of a frontal cyclone. Q. J. R. Meteorol. Soc., 120, 1535-1557.

  • Browning, K. A. (1990). Extratropical Cyclones; The Erik Palmen memorial volume. Organisation of clouds and precipitation in extratropical cyclones, chapter 8. Amer. Meteorol. Soc.

  • Carlson, T. N. (1980). Airflow through midlatitude cyclones and the comma cloud pattern. Mon. Wea. Rev., 108, 1498-1509.

  • Catto, J. L., Shaffrey, L. C., and Hodges, K. L. (2010). Can climate models capture the structure of extratropical cyclones? J. Climate, 23, 1621-1635.

  • Dacre, H. F., M. K. Hawcroft, M. A. Stringer and K. I. Hodges (2012). An extratropical cyclone Atlas: A tool for illustrating cyclone structure and evolution, Bull. Amer. Meteorol. Soc. doi: http://dx.doi.org/10.1175/BAMS-D-11-00164.1

  • Dacre, H. F., and Gray, S. L. (2009). The spatial distribution and evolution characteristics of north Atlantic cyclones. Mon. Wea. Rev., 137, 99-115.

  • Dee, D. P. et al. (2011), The ERA-Interim reanalysis: configuration and performance of the data assimilation system. Q.J.R. Meteorol. Soc., 137: 553–597. doi: 10.1002/qj.828.

  • Harrold, T. W. (1973). Mechanisms influencing the distribution of precipitation within baroclinic disturbances. Q. J. R. Meteorol. Soc., 99, 232-251.

  • Hodges, K. I. (1994). A general method for tracking analysis and its application to meteorological data. Mon. Wea. Rev., 122, 2573-2586.

  • Hodges, K. I. (1995). Feature tracking on the unit sphere. Mon. Wea. Rev., 123, 3458-3465.

  • Hodges, K. I. (1999). Adaptive constraints for feature tracking. Mon. Wea. Rev., 127, 1362-1373.

  • Petterssen, S., and Smebye, S. J. (1971). On the development of extratropical cyclones. Q. J. R. Meteorol. Soc., 97, 457-482.

  • Rudeva, I.A., and Gulev, S. K., (2011). Composite analysis of Composite analysis of the North Atlantic extratropical cyclones in NCEP/NCAR reanalysis. Mon. Wea. Rev., 139, 1419-1436.

  • Schultz, D. M., Keyser, D., and Bosart, L. F. (1998). The effect of large-scale flow on low-level frontal structure and evolution in midlatitude cyclones. Mon. Wea. Rev., 126, 1767-1791.

  • Semple, A. T. (2003). A review and unification of conceptual models of cyclogenesis. Meteorol. Appl., 10, 39-59.

  • Shapiro, M. A., and Keyser, D. (1990). Extratropical Cyclones: The Erik Palmen memorial volume, chapter 10. Amer. Meteorol. Soc.

  • Sinclair, M. R., and Revell, M. J. (2000). Classification and composite diagnosis of extratropical cyclogenesis in the southwest Pacific. Mon. Wea. Rev., 128, 1089-1105.

  • Ulbrich, U., Leckebusch, G. C. and Pinto, J. G. (2009). Extra-tropical cyclones in the present and future climate: A review. Theor. Appl. Climatol., 96, 117-131, doi:10.1007/s00704-008-0083-8.

  • Young, M. V., Monk, G. A., and Browning, K. A. (1987). Interpretation of satellite imagery of a rapidly deepening cyclone. Q. J. R. Meteorol. Soc., 113, 1089-1115.