read.met {oce} | R Documentation |
Reads a comma-separated value file in the format used by the Environment Canada [1]. 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 Environment Canada changes the format.
read.met(file, type = NULL, skip, tz = getOption("oceTz"), debug = getOption("oceDebug"))
file |
a connection or a character string giving the name of the file to load. |
type |
if |
skip |
optional number of lines of header that occur before the actual
data. If this is not supplied, |
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. |
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
wind
(in km/h), taken straight from the data file.
There seem to be several similar formats in use, so this function may not work in all cases.
Dan Kelley
1. Environment Canada website for Historical Climate Data http://climate.weather.gc.ca/index_e.html
Other things related to met
data: [[,met-method
,
[[<-,met-method
, as.met
,
download.met
, met-class
,
met
, plot,met-method
,
subset,met-method
,
summary,met-method
## Not run: library(oce) # Recreate data(met) and plot u(t) and v(t) metFile <- download.met(id=6358, year=2003, month=9, destdir=".") met <- read.met(metFile) met <- oceSetData(met, "time", met[["time"]]+4*3600, note="add 4h to local time to get UTC time") plot(met, which=3:4) ## End(Not run)