View source: R/GHCN_FUNCTIONS.R
get_ghcn_daily | R Documentation |
get_ghcn_daily
returns a named list of length 2:
'spatial': A SpatialPointsDataFrame
of the locations of GHCN weather stations
in the template, and
'tabular': A named list of data.frames
with the daily weather data for each station.
The name of each list item is the station ID.
get_ghcn_daily( template = NULL, label = NULL, elements = NULL, years = NULL, raw.dir = paste0(tempdir(), "/FedData/raw/ghcn"), extraction.dir = paste0(tempdir(), "/FedData/extractions/ghcn/", label, "/"), standardize = F, force.redo = F )
template |
A Raster* or Spatial* object to serve as a template for cropping. Alternatively, a character vector providing GHCN station IDs. If missing, all stations will be downloaded! |
label |
A character string naming the study area. |
elements |
A character vector of elements to extract. ACMC = Average cloudiness midnight to midnight from 30-second
ceilometer data (percent) |
years |
A numeric vector indicating which years to get. |
raw.dir |
A character string indicating where raw downloaded files should be put. The directory will be created if missing. Defaults to './RAW/GHCN/'. |
extraction.dir |
A character string indicating where the extracted and cropped GHCN shapefiles should be put. The directory will be created if missing. Defaults to './EXTRACTIONS/GHCN/'. |
standardize |
Select only common year/month/day? Defaults to FALSE. |
force.redo |
If an extraction for this template and label already exists, should a new one be created? Defaults to FALSE. |
A named list containing the 'spatial' and 'tabular' data.
## Not run: # Get the daily GHCN data (GLOBAL) # Returns a list: the first element is the spatial locations of stations, # and the second is a list of the stations and their daily data GHCN.prcp <- get_ghcn_daily( template = FedData::meve, label = "meve", elements = c("prcp") ) # Plot the VEP polygon plot(meve$geometry) # Plot the spatial locations plot(GHCN.prcp$spatial, pch = 1, add = T) legend("bottomleft", pch = 1, legend = "GHCN Precipitation Records") # Elements for which you require the same data # (i.e., minimum and maximum temperature for the same days) # can be standardized using standardize==T GHCN.temp <- get_ghcn_daily( template = FedData::meve, label = "meve", elements = c("tmin", "tmax"), standardize = T ) # Plot the VEP polygon plot(meve$geometry) # Plot the spatial locations plot(GHCN.temp$spatial, pch = 1, add = T) legend("bottomleft", pch = 1, legend = "GHCN Temperature Records") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.