ws_subset: Subset ORNL DAAC HWSD data

Description Usage Arguments Value Examples

View source: R/ws_subset.R

Description

Subset function to query pixel or spatial data from the ORNL DAAC HWSD THREDDS server. Returns a tidy data frame for point locations or raster data to the workspace or disk.

Usage

1
2
3
4
5
6
7
8
ws_subset(
  location = c(32, -81, 34, -80),
  site = "HWSD",
  param = "ALL",
  path = tempdir(),
  internal = TRUE,
  rate = 0.1
)

Arguments

location

location of a bounding box c(lat, lon, lat, lon) defined by a bottom-left and top-right coordinates, a single location (lat, lon) or a data frame with various locations listed (site, lat, lon)

site

sitename for the extracted location

param

soil parameters to provide, the default setting is ALL, this will download all available soil parameters.Check https://daac.ornl.gov/SOILS/guides/HWSD.html for parameter descriptions.

path

path where to download the data to (only applicable to spatial data)

internal

do not store the data on disk

rate

request rate in seconds, determines how long to wait between queries to avoid bouncing because of rate limitations

Value

Local geotiff data, or a data frame with HWSD soil information

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
 # extract sand fraction values
 # for a point location
 values <- ws_subset(
    site = "HWSD",
    location = c(34, -81),
    param = "T_SAND"
   )
   
 print(values)
 
 # Download a soil fraction map
 # of sand for a given bounding box
 t_sand <- ws_subset(
    site = "HWSD",
    location = c(32, -81, 34, -80),
    param = "T_SAND",
    path = tempdir(),
    internal = TRUE
   )
   
 raster::plot(t_sand)

## End(Not run)

hwsdr documentation built on June 30, 2021, 9:06 a.m.