Learn R Programming

seas (version 0.3-3)

A1128551.DLY: 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.

Usage

data(mscdata)

Arguments

format

MSC DLY archive format (4-digit year).

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:

  1. Insert CD-ROM, and runCDEX.EXE(or double-click it)
  2. Select adistrict; pressenter
  3. Select astation; pressenter
  4. SelectElements to Convert, and select the desired fields using thespace bar; pressenter
  5. ChangeDrive/directory of output filesto a convenient location, for exampleC:\TEMP
  6. PressF10to extract the data (the name of the file is the 7-digit alphanumeric station number, followed by a.ALLextension)
  7. 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 Rworkspace 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:

  1. StartR; typelibrary(seas)
  2. Import usingdat <- read.msc("/temp/C1161661.ALL")(note thatRuses forward slashes for directories, but you could alternatively type "C:\\\\TEMP\\\\C1161661.ALL" on a Microsoft-based platform toescapethe back slash characters)

To export the data from Rin 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 recognised by Excel, so modify the expression to write.csv(dat,"out.csv",na="#N/A").

source

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/).

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.

References

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

See Also

read.msc

Examples

Run this code
file <- system.file("data/A1128551.DLY",package="seas")
print(file)
dat <- read.msc(file)
print(head(dat))

plot.seas.temp(dat)
plot.year(dat)

Run the code above in your browser using DataLab