Scripting for Automated Operations

Previous Page

HOME

Next Page
    HIGHLIGHTS
  • Scripting HYSPLIT executions

Both the /trajmdl and /concmdl directories contain example TCL scripts that can be used to automate computations.  Familiarity with the command line options is essential in modifying and writing new scripts.  Script syntax is very similar to the “C” language.  All scripts work in the same manner by writing a new CONTROL file for each simulation, running the model, and then renaming the output.  In the example shown below, trajectories are computed at four locations. The key statements are shown in red.  As an exercise, this script can be modified to run a new trajectory each day, from the 23th through the 27th, but at only one location.

	# Auto_traj.tcl
	# the next line restarts using wish \
	# exec wish "$0" "$@"
 		set Start_hgt "10.0"
		set Traj_path  "/hysplit4/exec"
		set Start_time "00 00 00 00"
		set Run_hours  "24"
		set Vert_coord "0"
		set Top_model  "10000.0"
		set Meteo_path "./"
		set Meteo_file "FNLDUST.bin"
		set Output_path "./"
		set Output_base "tdump"
		set Output_numb 1
		foreach {Start_lat Start_lon} {29.0 -22.0  30.0 -22.0  \
		                               31.0 -22.0  32.0 -22.0} {
		   set Start_loc "$Start_lat $Start_lon $Start_hgt"
		   file delete Control
		   set f [open Control w]
		   puts $f "$Start_time"
		   puts $f "1"
		   puts $f "$Start_loc"
		   puts $f "$Run_hours"
		   puts $f "$Vert_coord"
		   puts $f "$Top_model"
		   puts $f "1"
		   puts $f "Meteo_path"
		   puts $f "$Meteo_file"
		   puts $f "$Output_path"
		   puts $f "$Output_base"
		   close $f
		   exec $Traj_path/hymodelt.exe
		   exec $Traj_path/trajplot.exe $Output_base
		   file rename tdump tdump${Output_numb}
		   file rename trajplot.ps plot${Output_numb}.ps
		   incr Output_numb
		}
		destroy
		

Previous Page
Previous

HOME

Next Page
Next