scan_postfile: Scan POST file

Description Usage Arguments Details Value

View source: R/scan_postfile.R

Description

Reads Fortran unformatted I/O POSTFILE and conver to matrix. Hours are not written individually, nor are source groups as they are saved as attributes of the matrix.

Usage

1

Arguments

f

path to an unformatted Fortran I/O binary POST file generated by AERMOD.

...

arguments passed thru to readBin. Primary use is to specify endianness in case POST file was generated on a machine with different endianness from your own.

Details

The AERMOD user's guide (3-186–3-187) describes the format of the file as follows:

“... the resulting unformatted file includes a constant-length record for each of the selected averaging periods calculated during the model run. The first variable of each record is an integer variable (4 bytes) containing the ending date (YYMMDDHH) for the averages on that record. The second variable for each record is an integer variable (4 bytes) for the number of hours in the averaging period. The third variable for each record is a character variable of length eight containing the source group ID. The remaining variables of each record contain the calculated average concentration values for all receptors, in the order in which they were defined in the input runstream.”

The records themselves are delimited by 4 byte integers (at the start and end of each record) giving the size (in bytes of the record). There is some predictability in the data: As generated by AERMOD, all records have an equal number of bytes. Additionally, the hours are numbered sequentially, without gaps, and the source group and averaging time are the same for each record. Therefore, the only information that needs to be stored at the record level is the ordered tuple of concentrations at each receptor for the particular hour and source group. scan_postfile stores this information as a matrix, and stores the starting hour, averaging period, and source group name as attributes of the matrix, rather than repeating the information with each row.

Value

An impact matrix with attributes srcgrp and hrbaseline (first hour). The number of hours and number of receptors can be accessed by calling the built-in dim function on the matrix.


jlovegren0/aermod documentation built on Jan. 14, 2022, 8:06 a.m.