A1128551.DLY {seas} | R Documentation |
Meteorological Service of Canada daily climate data (DLY archive format) from Vernon. This document also describes how to obtain data from the Canadian Daily Climate Data CD-ROMs for analysis in seas.
MSC DLY archive format (4-digit year).
The sample file name is ‘A1128551.DLY’, which contains daily
climate data from Vernon, British Columbia. Load this file using
read.msc
.
This file was created using the instructions below, with the addition of renaming the file extension from ‘*.ALL’ to ‘*.DLY’.
Two CDCD CD-ROMs are currently available for free download, which have data from 11,216 locations throughout Canada.
This procedure shows how to extract the data using ‘CDEX.EXE’,
which requires a DOS environment. There is, however, an alternative
Python module, which can batch extract data from the CD-ROMs. If you
are using a non-Microsoft platform, you could try ‘DOSBox’ to
emulate the DOS environment (tested on Debian and Mac OS X; hint:
mount the CD-ROM drive by using -t cdrom
option).
To extract data from the CD-ROM:
Multiple stations can be imported and combined before or after
importing into R. Multiple files can be concatenated into one from
the system shell (e.g. DOS: COPY *.ALL new.dly
, or UNIX:
cat *.ALL > new.dly
). This cleans up the R workspace by only
using one object to refer to several stations. Stations can be
referred to functions in seas using their IDs.
To import the archive file into R:
library(seas)
dat <- read.msc("/temp/C1161661.ALL")
(note that R uses forward slashes for directories, but you could
alternatively type "C:\\TEMP\\C1161661.ALL" on a Microsoft-based
platform to ‘escape’ the back slash characters)
To export the data from R in a more convenient format for other programs,
use write.csv(dat,"out.csv")
; MS Excel users may want to turn
NA
values into the format recognized by Excel, so modify the
expression to write.csv(dat,"out.csv",na="#N/A")
.
M.W. Toews
Data provided by the Meteorological Service of Canada (http://www.msc.ec.gc.ca/), with permission.
This data may only be reproduced for personal use; any other reproduction is permitted only with the written consent of Environment Canada (http://climate.weatheroffice.ec.gc.ca/contacts/).
http://climate.weatheroffice.ec.gc.ca/prods_servs/documentation_index_e.html MSC archive format description
http://www.climate.weatheroffice.ec.gc.ca/prods_servs/cdcd_iso_e.html CDCD CD-ROM download location
http://dosbox.sourceforge.net for emulating DOS on non-Microsoft platforms
http://www.intevation.de/~bernhard/archiv/uwm/canadian_climate_cdformat/ an alternative method of extracting data from the CDCD CD-ROMs using a Python module by Bernhard Reiter
file <- system.file("data/A1128551.DLY",package="seas") print(file) dat <- read.msc(file) head(dat) str(dat) plot.seas.temp(dat) plot.year(dat)