R: Read a Met File

read.met {oce} | R Documentation

## Read a Met File

### Description

Reads a comma-separated value file in the format used by the Meteorological Service of Canada (MSC). The agency does not publish a format for these files, so this function was based on a study of a few sample files, and it may fail for other files, if MSC changes the format.

### Usage

    read.met(file, type = NULL, skip, tz = getOption("oceTz"),
      debug = getOption("oceDebug"), processingLog, ...)

### Arguments

`file` | a connection or a character string giving the name of the file to load.
`type` | if `NULL`, then the first line is studied, in order to determine the file type. If `type="msc"`, then a file as formatted by the Meteorological Service of Canada is assumed.
`skip` | optional number of lines of header that occur before the actual data. If this is not supplied, `read.met` scans the file until it finds a line starting with `"Date/Time"`, and considers all lines above that to be header.
`tz` | timezone assumed for time data
`debug` | a flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, or to 2 to get more.
`processingLog` | if provided, the action item to be stored in the log. (Typically only provided for internal calls; the default that it provides is better for normal calls by a user.)
`...` | additional arguments, passed to called routines.

### Value

An object of `class` `"met"`, of which the `data` slot contains vectors `time`, `temperature`, `pressure`, `u`, and `v`. The velocity components have units m/s and are the components of the vector of wind direction. In other words, the oceanographic convention on velocity is employed, not the meteorological one; the weather forecaster's "North wind" has positive `v` and zero `u`. In addition to these things, `data` also contains items called `wind` (in km/h) and `direction` (in tenths of a degree), taken straight from the data file.

### Note

There seem to be several similar formats in use, so this function may not work in all cases.

### Author(s)

Dan Kelley

### See Also

Other things related to `met` data: `[[,met-method`, `[[<-,met-method`, `as.met`, `met-class`, `met`, `plot,met-method`, `subset,met-method`, `summary,met-method`

### Examples

    ## Not run:
    library(oce)
    met <- read.met("ile-rouge-eng-hourly-06012008-06302008.csv")
    plot(met, which=3:4)

    ## End(Not run)

[Package oce version 0.9-20 Index]