Description Usage Arguments Details Value Examples
Downloads climate normals from Environment and Climate Change Canada (ECCC)
for one or more stations (defined by climate_id
s). For details and units,
see the glossary_normals
data frame or the glossary_normals
vignette:
vignette("glossary_normals", package = "weathercan")
1 2 3 4 5 6 7 8 |
climate_ids |
Character. A vector containing the Climate ID(s) of the
station(s) you wish to download data from. See the |
normals_years |
Character. The year range for which you want climate normals. Default "1981-2010". |
format |
Logical. If TRUE (default) formats measurements to numeric and
date accordingly. Unlike |
stn |
DEFUNCT. Now use |
verbose |
Logical. Include progress messages |
quiet |
Logical. Suppress all messages (including messages regarding missing data, etc.) |
Climate normals from ECCC include two types of data, averages by
month for a variety of measurements as well as data relating to the
frost-free period. Because these two data sources are quite different, we
return them as nested data so the user can extract them as they wish. See
examples for how to use the unnest()
function from the
tidyr
package to extract the two different datasets.
The data also returns a column called meets_wmo
this reflects whether or
not the climate normals for this station met the WMO standards for
temperature and precipitation (i.e. both have code >= A). Each measurement
column has a corresponding _code
column which reflects the data quality
of that measurement (see the 1981-2010 ECCC calculations document
or the 1971-2000 ECCC calculations document
for more details)
Climate normals are downloaded from the url stored in option
weathercan.urls.normals
. To change this location use:
options(weathercan.urls.normals = "your_new_url")
.
tibble with nested normals and first/last frost data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # Find the climate_id
stations_search("Brandon A", normals_years = "current")
# Download climate normals 1981-2010
n <- normals_dl(climate_ids = "5010480")
n
# Pull out last frost data
library(tidyr)
f <- unnest(n, frost)
f
# Pull out normals
nm <- unnest(n, normals)
nm
# Download climate normals 1971-2000
n <- normals_dl(climate_ids = "5010480", normals_years = "1971-2000")
n
# Note that some do not have last frost dates
n$frost
# Download multiple stations for 1981-2010,
n <- normals_dl(climate_ids = c("301C3D4", "301FFNJ", "301N49A"))
n
# Note, putting both into the same data set can be done but makes for
# a very unweildly dataset (there is lots of repetition)
nm <- unnest(n, normals)
f <- unnest(n, frost)
both <- dplyr::full_join(nm, f)
both
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.