| read.met {oce} | R Documentation |
Reads some meteorological file formats used by the Environment
Canada (see reference 1). Since the agency does not publish the
data formats, this function had to be based on some sample files, and it
is likely to fail if Environment Canada changes their file format. For
example, a change was required in October 2019, to accommodate changes
to the file format noticed at that time (see the notes on the type argument).
read.met(
file,
type = NULL,
skip = NULL,
tz = getOption("oceTz"),
debug = getOption("oceDebug")
)
file |
a character string naming a file that holds met data. |
type |
if |
skip |
number of lines of header that occur before the actual
data. This is ignored unless |
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. |
A met object.
Dan Kelley
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,
test_met_csv1.csv,
test_met_csv2.csv,
test_met_xml2.xml
# The old csv format (no longer supplied by Environment Canada as of Oct 2019)
csv1 <- read.met(system.file("extdata", "test_met_vsn1.csv", package="oce"))
# The new "csv2" format (provided by Environment Canada as of Oct 2019)
csv2 <- read.met(system.file("extdata", "test_met_vsn2.csv", package="oce"))
# "xml2" format
if (requireNamespace("XML", quietly=TRUE))
xml2 <- read.met(system.file("extdata", "test_met_xml2.xml", package="oce"))
## 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)
## End(Not run)