Home

Awesome

daymetr <a href='https://bluegreen-labs.github.io/daymetr/'><img src='https://raw.githubusercontent.com/bluegreen-labs/daymetr/master/logo.png' align="right" height="139" /></a>

R-CMD-check codecov CRAN_Status_Badge CRAN_Downloads

A programmatic interface to the Daymet web services. Allows for easy downloads of Daymet climate data directly to your R workspace or your computer. Routines for both single pixel data downloads and gridded (netCDF) data are provided. Please use the below citation when using the package.

How to cite this package

Hufkens K., Basler J. D., Milliman T. Melaas E., Richardson A.D. 2018 An integrated phenology modelling framework in R: Phenology modelling with phenor. Methods in Ecology & Evolution, 9: 1-10. https://doi.org/10.1111/2041-210X.12970

Installation

stable release

To install the current stable release use a CRAN repository:

install.packages("daymetr")
library("daymetr")

development release

To install the development releases of the package run the following commands:

if(!require(remotes)){install.packages("remotes")}
remotes::install_github("bluegreen-labs/daymetr")
library("daymetr")

Vignettes are not rendered by default, if you want to include additional documentation please use:

if(!require(remotes)){install.packages("remotes")}
remotes::install_github("bluegreen-labs/daymetr", build_vignettes = TRUE)
library("daymetr")

Use

Single pixel location download

For a single site use the following format

download_daymet(site = "Oak Ridge National Laboratories",
                lat = 36.0133,
                lon = -84.2625,
                start = 1980,
                end = 2010,
                internal = TRUE)
ParameterDescription
sitesite name
latlatitude of the site
lonlongitude of the site
startstart year of the time series (data start in 1980)
endend year of the time series (current year - 2 years, use force = TRUE to override)
internallogical, TRUE or FALSE, if true data is imported into R workspace otherwise it is downloaded into the current working directory
pathpath where to store the data when not used internally, defaults to tempdir()
forceforce “out of temporal range” downloads
silentsuppress the verbose output

Batch mode uses similar parameters but you provide a comma separated file with site names and latitude longitude which are sequentially downloaded. The format of the comma separated file is: site name, latitude, longitude.

download_daymet_batch(file_location = 'my_sites.csv',
                      start = 1980,
                      end = 2010,
                      internal = TRUE)

Gridded data downloads

For gridded data use either download_daymet_tiles() for individual tiles or download_daymet_ncss() for a netCDF subset which is not bound by tile limits (but restricted to a 6GB query size).

Tiled data

download_daymet_tiles(location = c(36.0133,-84.2625),
                      tiles = NULL,
                      start = 1980,
                      end = 2012,
                      param = "ALL")
ParameterDescription
locationvector with a point location c(lat,lon) or top left / bottom right pair c(lat,lon,lat,lon)
tilesvector with tile numbers if location point or top left / bottom right pair is not provided
startstart year of the time series (data start in 1980)
endend year of the time series (current year - 2 years, use force = TRUE to override)
paramclimate variable you want to download vapour pressure (vp), minimum and maximum temperature (tmin,tmax), snow water equivalent (swe), solar radiation (srad), precipitation (prcp) , day length (dayl). The default setting is ALL, this will download all the previously mentioned climate variables.
pathpath where to store the data, defaults to tempdir()
silentsuppress the verbose output

If only the first set of coordinates is provided the tile in which these reside is downloaded. If your region of interest falls outside the scope of the DAYMET data coverage a warning is issued. If both top left and bottom right coordinates are provided all tiles covering the region of interst are downloaded. I would caution against downloading too much data, as file sizes do add up. So be careful how you specify your region of interest.

netCDF subset (ncss) data

download_daymet_ncss(location = c(36.61,-85.37,33.57,-81.29),
                     start = 1980,
                     end = 1980,
                     param = "tmin")
ParameterDescription
locationbounding box extent defined as top left / bottom right pair c(lat,lon,lat,lon)
startstart year of the time series (data start in 1980)
endend year of the time series (current year - 2 years, use force = TRUE to override)
paramclimate variable you want to download vapour pressure (vp), minimum and maximum temperature (tmin,tmax), snow water equivalent (swe), solar radiation (srad), precipitation (prcp) , day length (dayl). The default setting is ALL, this will download all the previously mentioned climate variables.
mosaictile mosaic to use, defaults to “na” for North America (use “pr” for Puerto Rico and “hi” for Hawaii)
pathpath where to store the data, defaults to tempdir()
silentsuppress the verbose output

Keep in mind that the bounding box is defined by the minimum (square) bounding box in a Lambert Conformal Conic (LCC) projection as defined by the provided geographic coordinates. In general the query area will be larger than the requested location. For more information I refer to Daymet documentation on the web service.

Acknowledgements

This project was supported by the National Science Foundation’s Macro-system Biology Program (awards EF-1065029 and EF-1702697) and the Marie Skłodowska-Curie Action (H2020 grant 797668). Logo design elements are taken from the FontAwesome library according to these terms, where the globe element was inverted and intersected.