A1128551.DLY {seas} | R Documentation |
MSC daily climate data file (DLY archive format) and instructions for Canadian Daily Climate Data CD-ROMs for analysis
Description
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.
Format
MSC DLY archive format (4-digit year).
Details
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’.
How to obtain Canadian Daily Climate Data
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:
Insert CD-ROM, and run ‘CDEX.EXE’ (or double-click it)
Select a ‘district’; press ‘enter’
Select a ‘station’; press ‘enter’
Select ‘Elements to Convert’, and select the desired fields using the ‘space bar’; press ‘enter’
Change ‘Drive/directory of output files’ to a convenient location, for example ‘C:\TEMP’
Press ‘F10’ to extract the data (the name of the file is the 7-digit alphanumeric station number, followed by a ‘.ALL’ extension)
Repeat these steps for each meteorological station desired (if there are more).
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:
Start R; type
library(seas)
Import using
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")
.
Author(s)
Mike Toews
Source
Data provided by the Meteorological Service of Canada, with permission.
This data may only be reproduced for personal use; any other reproduction is permitted only with the written consent of Environment Canada (https://weather.gc.ca/mainmenu/contact_us_e.html).
References
https://web.archive.org/web/20130625230337/http://climate.weatheroffice.gc.ca/prods_servs/documentation_index_e.html (archived) Technical Documentation - Documentation for the Digital Archive of Canadian Climatological Data (Surface) Identified By Element
http://climate.weatheroffice.gc.ca/prods_servs/index_e.html#cdcd
(dead link) CDCD CD-ROM download location
https://www.dosbox.com for emulating DOS on non-Microsoft platforms
https://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
See Also
Examples
fname <- system.file("extdata", "A1128551.DLY", package="seas")
print(fname)
dat <- read.msc(fname)
head(dat)
str(dat)
seas.temp.plot(dat)
year.plot(dat)