Read Soil Moisture Integration and Prediction System (SMIPS) Cloud Optimised Geotiff (COG) files from TERN in your R session.
Usage
read_smips(
collection = "totalbucket",
day,
api_key = get_key(),
max_tries = 3L,
initial_delay = 1L
)
Arguments
- collection
A character vector of the “SMIPS” data collection to be queried:
SMindex
bucket1
bucket2
deepD
runoff
totalbucket Defaults to “totalbucket”. Multiple
collections
are supported, e.g.,collection = c("SMindex", "totalbucket")
.
- day
A date to query, e.g.,
day = "2017-12-31"
orday = as.Date("2017-12-01")
, bothCharacter
andDate
classes are accepted.- api_key
A
character
string containing your API key, a random string provided to you by TERN, for the request. Defaults to automatically detecting your key from your local .Renviron, .Rprofile or similar. Alternatively, you may directly provide your key as a string here or use functionality like that from keyring. If nothing is provided, you will be prompted on how to set up your R session so that it is auto-detected and a browser window will open at the TERN website for you to request a key.- max_tries
An integer
Integer
with the number of times to retry a failed download before emitting an error message. Defaults to 3.- initial_delay
An
Integer
with the number of seconds to delay before retrying the download. This increases as the tries increment. Defaults to 1.
Value
A terra::rast object
Examples
if (FALSE) { # interactive()
r <- read_smips(day = "2024-01-01")
# terra::plot() is re-exported for convenience
plot(r)
}