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")
)

## Arguments

file a character string naming a file that holds met data. if NULL, which is the default, then an attempt is made to infer the type from the file contents. If this fails, it will be necessary for the user to provide a value for the type argument. The permitted choices are: (a) "csv" or "csv1" for an old CSV format no longer provided as of October 2019, (b) "csv2" for a CSV format noticed on the Environment Canada website in October 2019 (but note that the paired metadata file is ignored), and (c) "xml2" for an XML format that was noticed on the Environment Canada website in October 2019. number of lines of header that occur before the actual data. This is ignored unless type is "csv" or "csv1", in which case a non-NULL value of skip is taken as the number of lines preceding the columnar data ... and this is only needed if read.met() cannot find a line starting with "Date/Time". timezone assumed for time data 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.

## References

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, test_met_csv1.csv, test_met_csv2.csv, test_met_xml2.xml

## Examples

# The old csv format (no longer supplied by Environment Canada as of Oct 2019)

# The new "csv2" format (provided by Environment Canada as of Oct 2019)

# "xml2" format
if (requireNamespace("XML", quietly=TRUE))
}