A1128551.DLY {climate.plot}R Documentation

MSC daily climate data file (DLY archive format) and instructions for Canadian Daily Climate Data CD-ROMs for analysis

Description

Meteorological Survey 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 climate.plot.

Usage

data(mscdata)

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 for use in climate.plot 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 run ‘CDEX.EXE’ (or double-click it)
  2. Select a ‘district’; press ‘enter’
  3. Select a ‘station’; press ‘enter’
  4. Select ‘Elements to Convert’, and select the desired fields using the ‘space bar’; press ‘enter’
  5. Change ‘Drive/directory of output files’ to a convenient location, for example ‘C:\TEMP
  6. Press ‘F10’ to extract the data (the name of the file is the 7-digit alphanumeric station number, followed by a ‘.ALL’ extension)
  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 R workspace by only using one object to refer to several stations. Stations can be referred to functions in climate.plot using their IDs.

To import the archive file into R:

  1. Start R; type library(climate.plot)
  2. 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 in a more convenient format for other programs, type 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)

M.W. Toews

Source

Data provided by the Meteorological Survey 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/).

References

MSC archive format described at http://climate.weatheroffice.ec.gc.ca/prods_servs/documentation_index_e.html

CDCD CD-ROMs can be downloaded from http://www.climate.weatheroffice.ec.gc.ca/prods_servs/cdcd_iso_e.html

DOS can be emulated for non-Microsoft platforms using DOSBox http://dosbox.sourceforge.net

Data from the CDCD CD-ROMs can alternatively be extracted using a Python module by Bernhard Reiter (http://www.intevation.de/~bernhard/archiv/uwm/canadian_climate_cdformat/)

See Also

read.msc

Examples

data(mscstn)

file <- system.file("data/A1128551.DLY",package="climate.plot")
print(file)
dat <- read.msc(file)
print(head(dat))

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

[Package climate.plot version 0.1-2 Index]