TRIM.FaTE File 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 comma. 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.

-echoFirstLine: Optional. If this option is found on the command line, the first line of data in the input file is echoed to the output file. Averaging commences with the second line of the input file (e.g. data lines 2-5 of the input file if the averaging period is set to 4, whereas it would be data lines 1-4 without this option). Note that the time stamp for the averages are the end of the time step when this option is used, but the beginning of the time step when it is not used. Typically, this option would be used for output data, but not for input data.

-wdr <integer> : Optional (but must be used with the -wsp option) The column number (the date 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. The averager will compute the new wind directions using a unitized vector average of the directions input to it (i.e. it ignores the wind speed in this average and considers only the directions).

-wsp <integer> : Optional (but must be used with -wdr option) The column number (the date 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 <string1>,<string2>,<string3>,... : Optional. Include only columns that contain string1, string2, string3, etc. 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. Note that the delimiter between the strings should be the same delimiter as what is used for the files.

-excl <string1>,<string2>,<string3>,... : Optional. Exclude columns that contain string1, string2, string3, etc. Note that the delimiter between the strings should be the same as the delimiter used for the files. 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 with names that contain "soil" or "sediment;":

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