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:
LOCATION—A scalar string, the location tag 'SS-CCC-IIII' where SS = State, CCC = County, IIII = SiteID.
DATE—An array of date values.
PARAMS—A string array of the parameter tags found.
UNITS—A 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
Exclude—Hours of the day to exclude. (Default = 24 (i.e., none))
actionCode—The string in column 80. (Default = 'I')
Ignore—A string array. This is the data values to ignore. (Default = ' '.)
addCode—A long array of parameter codes to also check for.
addDesc—A string array of parameter names associated with the codes enumerated with addCode.
Nosort—If 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