READ_AIRS Function

Reads in hourly data from a file in the AIRS (Aerometric Information Retrieval System) format.

Usage

data = READ_AIRS(filename) 

Input Parameters

filename—A string, the AIRS data file to read.

Returned Value

data—An associative array of associative arrays. At the top level, it has a key for each location; the name is a scalar string in the form: 'SS-CCC-IIII' where SS = State, CCC = County, IIII = SiteID. It also has a 'LOCATION' key, which is a string array of all locations found.

Each location key has an associative array that contains the following keys:

LOCATIONA scalar string, the location tag 'SS-CCC-IIII' where SS = State, CCC = County, IIII = SiteID.

DATEAn array of date values.

PARAMSA string array of the parameter tags found.

UNITSA string array of units for each parameter.

Other keys will exist when their parameter tags are found. For example, if the file contains concentration values for lead, there will be a “PB” key that contains a double array of values. If an error occurs, –1 is returned.

Keywords

ExcludeHours of the day to exclude. (Default = 24 (i.e., none))

actionCodeThe string in column 80. (Default = 'I')

IgnoreA string array. This is the data values to ignore. (Default = ' '.)

addCodeA long array of parameter codes to also check for.

addDescA string array of parameter names associated with the codes enumerated with addCode.

NosortIf set, the arrays are not sorted by DATE and will be returned in the row/column order of the source file.

Discussion

An AIRS file containing several sites can be quite complicated to understand. Briefly, to extract the first location to its own associative array, use this syntax: L0 = DATA((DATA('LOCATIONS'))(0))

Then an INFO, L0, /Full will show that is an associative array with the keys DATE, PARAMS, etc. To address a parameter at a single location, using this syntax: p = DATA('06-073-1001','R D') for example.

Example

data = READ_AIRS(!Dir + '/demo/gallery3/data/wd_demo35.dat')
s = STR_TO_DT('1/1/99', Date_fmt=1)
e = STR_TO_DT('12/31/99', Date_fmt=1)
TEK_COLOR
l = (data('LOCATIONS'))(0)
PLOT_WINDROSE, s, e, data(l, 'DATE'), data(l, 'R S'), data(l, 'R D'), $
   data(l, 'LOCATION'), /Legend, /Titles, Charsize=1.2