File Processor Agent Example – In-Situ-4

<< Click to Display Table of Contents >>

Live > Agents > File Agents > File Processor > Examples >

File Processor Agent Example – In-Situ-4

This example uses an older Win-Situ version 4 file that has a multiline header, and separate date and time columns. (The *.config file also contains a processor for version 5 files, named In-Situ-5.)

 

1.Add In-Situ-4 to the *.config file's processors setting, and ensure the following In-Situ-4 settings:

 

Setting

Value

Description

In-Situ-4.dateTimeColumnHeaderRegex

Date

DT_LOGGER_DATUM.DATUM_UTC_DT date; column header text contains Date.

In-Situ-4.dateTimeFormats

M/d/y

Resolve ambiguity; if not, the date and time can have a double meaning— day/month/year or month/day/year.

In-Situ-4.delimiters

&#09;

The fields are separated by tabs.

In-Situ-4.folderWatcherPath

C:\EarthSoft\Live\In-Situ-4


In-Situ-4.headerLinesRegex

.*\nDate.*Time\n.*

The header has 3 lines that look like this:

1.anything (.*)

2.contains Date + anything (.*) + Time

3.anything (.*)

In-Situ-4.loggerCodeHeaderLinesRegexGroups

^Test name\s*:\s*(?'a'[^\t]*)

DT_LOGGER.LOGGER_CODE

In-Situ-4.loggerDescPrefix

In-Situ


In-Situ-4.seriesNameColumnHeaderRegexGroups

(?(?=^\n)\n(?'a'.*)\(.*\).*\n|^(?'b'.*)\n)

DT_LOGGER_SERIES.SERIES_NAME;

e.g., 'Temperature\nCelsius\n---------------' => 'Temperature', or '\nET (min)\n------------' => 'ET'

In-Situ-4.seriesUnitColumnHeaderRegexGroups

(?(?=^\n)\n.*\((?'a'.*)\).*\n|\n(?'b'.*)\n)

DT_LOGGER_SERIES.SERIES_UNIT;

e.g., 'Temperature\nCelsius\n---------------' => 'Celsius', or '\nET (min)\n------------' => 'min'

In-Situ-4.timeColumnHeaderRegex

Time

DT_LOGGER_DATUM.DATUM_UTC_DT time; column header text contains Time.

 

And default (non-In-Situ-4) settings (or add In-Situ-4.utcOffsetHrs setting):

 

Setting

Value

Description

utcOffsetHrs

-5

DT_LOGGER.UTC_OFFSET_HRS

 

2.Start the agent, and copy the following file to folder C:\EarthSoft\Live\In-Situ-4.

 

 

In-Situ Inc.        Troll

 

Report generated:        10/22/14        16:11:39

Report from file:        ...\SN11026 2012-03-27 120000 SHP-02-0841_3-12.bin

Win-Situ Version        4.533

 

Serial number:        00011026

Firmware Version        6.24

Unit name:        AB-CDE-01

 

Test name:                B-31

 

Test defined on:        03/27/12        10:22:13

Test scheduled for:        03/27/12        12:00:00

Test started on:        03/27/12        12:00:00

Test stopped on:        N/A        N/A

 

Data gathered using Linear testing

  Time between data points:      14400.0        Seconds.

  Number of data samples:        5498

 

TOTAL DATA SAMPLES        5498

 

Channel number [1]

 Measurement type:        Temperature

 Channel name:        OnBoard Temp

 

Channel number [2]

 Measurement type:        Pressure

 Channel name:        Water level

 Sensor Range:         15 PSIG.

 Sensor Offset:        0.000 psi

 Specific gravity:           1.000

 Mode:        TOC

 User-defined reference:          45.150        Feet H2O

 Referenced on:        test start

 Pressure head at reference:           3.015        Feet H2O

 

                 Chan[1]        Chan[2]

                 Temperature        Pressure

Date         Time         ET (sec)        Fahrenheit        Feet H2O

--------        --------        ------------        ---------------        ---------------

03/27/12        12:00:00                 0.0             60.91            45.150

03/27/12        16:00:00             14400.0             60.92            45.127

03/27/12        20:00:00             28800.0             60.91            45.127

 

 

3.The file's Unit name line contains the DT_LOGGER.LOGGER_CODE. Find/add the logger row, for example:

 

LOGGER_CODE

LOGGER_DESC

LIVE_DATA_SOURCE

UTC_OFFSET_HRS

B-31

In-Situ B-31 (= In-Situ-4.loggerDescPrefix + LOGGER_CODE)

folder://COMPUTER_NAME/
C:/EarthSoft/Live/In-Situ-4

-5 (= utcOffsetHrs)

 

4.The line that contains Date and Time is the second header line, and the line before and after it is also a part of the header. It contains the DT_LOGGER_DATUM.DATUM_UTC_DT columns, and the other columns are the series; they contain DT_LOGGER_SERIES.SERIES_NAMEs and DT_LOGGER_SERIES.SERIES_UNITs.

 

5.For each subsequent line:

a.For each series (each column, excluding Date and Time columns):

i.Find/add the series row for the SERIES_NAME and SERIES_UNIT.

ii.Add the datum row, e.g., for the first data line:

 

SERIES_NAME

DATUM_UTC_DT

DATUM_VALUE

SERIES_UNIT

ET

2012-03-27 17:00:00 (= 2012-03-27 12:00:00 - UTC_OFFSET_HRS)

0.0

sec

Temperature

2012-03-27 17:00:00

60.91

Fahrenheit

Pressure

2012-03-27 17:00:00

45.150

Feet H2O