openair (version 1.6.7)

importADMS: CERC Atmospheric Dispersion Modelling System (ADMS) data import function(s) for openair

Description

Function(s) to import various ADMS file types into openair. Currently handles ".met", ".bgd", ".mop" and ".pst" file structures. Uses read.csv (in utils) to read in data, format for R and openair and apply some file structure testing.

Usage

importADMS(file = file.choose(), file.type = "unknown", drop.case = TRUE,
  drop.input.dates = TRUE, keep.units = TRUE, simplify.names = TRUE,
  test.file.structure = TRUE, drop.delim = TRUE, add.prefixes = TRUE,
  names = NULL, ...)

Arguments

file
The ADMS file to be imported. Default, file.choose() opens browser. Use of read.csv (in utils) also allows this to be a readable text-mode connection or url (although these options are currently not fully tested).
file.type
Type of ADMS file to be imported. With default, "unknown", the import uses the file extension to identify the file type and, where recognised, uses this to identify the file structure and import method to be applied. Where file extension is not recogni
drop.case
Option to convert all data names to lower case. Default, TRUE. Alternative, FALSE, returns data with name cases as defined in file.
drop.input.dates
Option to remove ADMS "hour", "day", and "year" data columns after generating openair "date" timeseries. Default, TRUE. Alternative, FALSE, returns both "date" and the associated ADMS data columns as part of openair data frame
keep.units
Option to retain ADMS data units. Default, TRUE, retains units (if recoverable) as character vector in data frame comment if defined in file. Alternative, FALSE, discards units. (NOTE: currently, only .bgd<
simplify.names
Option to simplify data names in accordance with common openair practices. Default, TRUE. Alternative, FALSE, returns data with names as interpreted by standard R. (NOTE: Some ADMS file data names include symbols
test.file.structure
Option to test file structure before trying to import. Default, TRUE, tests for expected file structure and halts import operation if this is not found. Alternative, FALSE, attempts import regardless of structure.
drop.delim
Option to remove delim columns from the data frame. ADMS .mop files include two columns, "INPUT_DATA:" and "PROCESSED_DATA:", to separate model input and output types. Default, TRUE, removes these. Alternative, FALSE, retains
add.prefixes
Option to add prefixes to data names. ADMS .mop files include a number of input and process data types with shared names. Prefixes can be automatically added to these so individual data can be readily identified in the R/openair environment. Default, <
names
Option applied by simplifyNamesADMS when simplify.names is enabled. All names are simplified for the default setting, NULL.
...
Additional arguments, passed to read.csv as part of import operation.

Value

  • In standard use importADMS() returns a data frame for use in openair. By comparison to the original file, the resulting data frame is modified as follows: Time and date information will combined in a single column "date", formatted as a conventional timeseries (as.POSIX*). If drop.input.dates is enabled data series combined to generated the new "date" data series will also be removed. If simplify.names is enabled common chemical names may be simplified, and some other parameters may be reset to openair standards (e.g. "ws", "wd" and "temp") according to operations defined in simplifyNamesADMS. A summary of simplfication operations can be obtained using, e.g., the call importADMS(simplify.names). If drop.case is enabled all upper case characters in names will be converted to lower case. If keep.units is enabled data units information may also be retained as part of the data frame comment if available. With .mop files, input and processed data series names may also been modified on the basis of drop.delim and add.prefixes settings

Details

The importADMS function were developed to help import various ADMS file types into openair. In most cases the parent import function should work in default configuration, e.g. mydata <- importADMS(). The function currently recognises four file formats: .bgd, .met, .mop and .pst. Where other file extensions have been set but the file structure is known, the import call can be forced by, e.g, mydata <- importADMS(file.type="bgd"). Other options can be adjusted to provide fine control of the data structuring and renaming.

See Also

Generic import function import, for possible alternative import methods. Other dedicated import functions available for other file types, including importKCL, importAURN, etc.

Examples

Run this code
##########
#example 1
##########
#To be confirmed


#all current simplify.names operations
importADMS(simplify.names)

#to see what simplify.names does to adms data series name PHI
new.name <- importADMS(simplify.names, names="PHI")
new.name

Run the code above in your browser using DataLab