The Averager

When TRIM simulations become large, they produce large text files that are slow and cumbersome to manipulate and view on most PC's.  The Averager allows you to average data in time and to select out certain columns for processing. It is a command line tool that you use from a DOS prompt to manipulate files.

To use it, type:

java gov.epa.trim.util.TimeWeightedAverager

followed by a series of options. There are examples of how to use the averager at the bottom of the page.

Options

You must place a space between the flags (-i, -o, etc.) and the option.

-i <filename> : Required. This is a string that is the input file to process.

-o <filename> : Required. This is a string that is the output file to write.

-a <integer or "monthly" or "annual"> : Required. This is the number of steps over which to average. If you have hourly data and want to see a 12 hour average, this would be 12. If you have daily data and want to see a 30 day average, you would use 30.  For monthly averages, used the "monthly" keyword.  For annual averages, use the "annual" keyword.

-d <character> : Optional. This specifies the delimiter between columns and must be placed in double-quotes. The default is a semicolon. Most TRIM results files are semi-colon delimited.

-s <MM/dd/yyyy hh:mm:ss z> : Optional. The date and time when averaging should start. If you only wish to process part of the TRIM results file, you can remove the data before this time and only average data after this time.

-e <MM/dd/yyyy hh:mm:ss z> : Optional. The date and time when averaging should start. If you only wish to process part of the TRIM results file, you can remove the data after this time and only average data before this time.

-wdr <integer> : Optional (but must be used with the -wsp option) The column number (first column is column 1) that contains wind direction data. If you have wind data in your file, it cannot be averaged as a scalar value. It must be averaged as a vector. You can tell the averager where the wind direction and speed columns are and it will average them using a vector averaging scheme.

-wsp <integer> : Optioal (but must be used with -wdr option) The column number (first column is column 1) that contains the wind speed data. (See -wdr option above)

-col <integer-integer> : Optional. If you wish to select only a subset of columns, you can specify a range of columns to process with this option. If your results file has 600 columns and you only want to use columns 1 through 200, you would use -col 1-200 to process only those columns.

-incl <string> : Optional. Include only columns that contain this string. This is another way to process only a subset of columns. If you are only interested in seeing the Groundwater compartments, you would use -incl Groundwater.

-excl <string> : Optional. Exclude columns that contain this string. This allows you to exclude all columns of a certain type. If you wanted to remove all of the sinks from your output, you would use -excl Sink.

-numdec - (Optional) The number of decimal places to display in the output (integer)

Examples

Average over 12 time steps:

java gov.epa.trim.util.TimeWeightedAverager -i input_file.txt -o output_file.txt -a 12

Average over 24 time steps with a semi-colon delimiter between columns:

java gov.epa.trim.util.TimeWeightedAverager -i input_file.txt -o output_file.txt -a 24 -d ";"

Average over 2 time steps with wind data in colums 5 and 7:

java gov.epa.trim.util.TimeWeightedAverager -i input_file.txt -o output_file.txt -a 2 -wdr 5, -wsp 7

Average over 6 time steps and only process data from 1/1/1999 to 1/1/2000:

java gov.epa.trim.util.TimeWeightedAverager -i input_file.txt -o output_file.txt -a 6 -s 01/01/1999 00:00:00 EST -e 01/01/2000 00:00:00 EST

Average over 6 time steps and only process columns 50 through 100:

java gov.epa.trim.util.TimeWeightedAverager -i input_file.txt -o output_file.txt -a 6 -col 50-100

Average over 30 time steps and only process columns that contain "fish":

java gov.epa.trim.util.TimeWeightedAverager -i input_file.txt -o output_file.txt -a 30 -incl "fish"

Average over 30 time steps and only process columns that do not contain "fish":

java gov.epa.trim.util.TimeWeightedAverager -i input_file.txt -o output_file.txt -a 30 -excl "fish"

Average over annual time steps and only process columns that do not contain "chickadee":

java gov.epa.trim.util.TimeWeightedAverager -i input_file.txt -o output_file.txt -a "annual" -excl "chickadee"

Average over monthly time steps and only process columns that contain "deer":

java gov.epa.trim.util.TimeWeightedAverager -i input_file.txt -o output_file.txt -a "monthly" -incl "deer"