Skip to contents

The ‘WES’ package contains a number of functions that will add important metadata (e.g. climate variables, elevation, topography, etc) to your environmental sampling observations. This assumes that you have constructed a data frame that matches the template_WES_data data object. A detailed description of the template data can be found HERE.

To retrieve metadata for the location and dates in your data frame, the functions listed in the table below will download them from open source APIs using wrappers of functions from other R packages. These methods should generalized to most locations and dates assuming that the data are available (e.g. very recent dates may not be uploaded to climate APIs yet). The list of metadata functions are:

‘WES’ wrapper Description Package Function API
get_precip_data Cumulative daily millimeters of rainfall openmeteo weather_history Open-Meteo Historical Weather API
get_temp_data Accumulated Thermal Units (ATUs) openmeteo weather_history Open-Meteo Historical Weather API
get_esi_data Evapoartive Stress Index (ESI) chirps get_esi SERVIR ClimateSERV API
get_river_discharge_data Daily river discharge of the nearest river in cubic meters per second (\(m^3/s\)) openmeteo river_discharge Open-Meteo Global Flood API
download_elevation_data, get_elevation_data Digital Elevation Model (DEM) giving the height in meters above sea level, spatial resolution is ~100m elevatr get_elev_raster, get_elev_point Amazon Web Services Terrain Tiles
get_hydro_data slope, aspect, TWI, flow accumulation, distance to streams elevatr, WhiteboxTools R frontend get_elev_raster, wbt_d_inf_flow_accumulation, wbt_wetness_index DEM from Amazon Web Services Terrain Tiles
download_admin_data, get_admin_data Names of all administrative areas for each sampling site NA NA GeoJSON files from the geoBoundaries API (saved as ESRI Shapefiles)
download_worldpop_data WorldPop raster data giving estimated population per grid cell NA NA GeoTIFF files from the WorldPop FTP server
get_population_catchment Area of drainage catchments (sq km) and total population within each WhiteboxTools R frontend wbt_d_inf_flow_accumulation, wbt_watershed User supplied elevation and population rasters.
get_population_radius Total population within a given radius raster, exactextractr buffer, exactextractr User supplied population raster.