getEDEN: Downloads and imports EDEN data

View source: R/getEDEN.R

getEDENR Documentation

Downloads and imports EDEN data

Description

Downloads GeoTiff files from https://sofia.usgs.gov/eden/models/real-time.php , unzips and loads them into the workspace. Zip files are deleted after loading. This function makes 'fireHydro' able to operate with complete independence from Department of Interior servers. This code generates a water depth map using the USGS water surface data and the USGS EDEN digital elevation map (present in this R package as raster layer "edenDEM").

Usage

getEDEN(
  EDEN_date = Sys.Date(),
  exact = FALSE,
  quarterly = FALSE,
  returnType = "sf",
  DEM = terra::rast(system.file("extdata/edenDEM.grd", package = "fireHydro")),
  download.method = "curl"
)

Arguments

EDEN_date

The date(s) for which water levels are desired. Format should be a numeric or character string with the format "20181018" or "2018-10-18", or a Date object in any format. By default, today's date is used; if "exact = FALSE" this returns the most recent EDEN data available.

exact

logical; if TRUE, output is only returned if the requested date is available. If exact = FALSE, the function responds to an invalid EDEN_date input by returning data from the most recent available date

quarterly

logical; if set to TRUE, entire quarter is downloaded and returned as a SpatRaster.

returnType

character; class of object returned. Acceptable options: "sf" or "terra"

DEM

raster digital elevation model for south Florida. Used to subtract land elevations from water surface to get water depths in centimeters relative to soil surface. The default DEM is a USGS/EDEN product in meters NAVD88. If an alternate DEM is used, units should be meters. The DEM is multiplied by 100 internally in 'getEDEN()' before being subtracted from the water surface. If 'DEM = NULL', output will be water surface in centimeters NAVD88. If a DEM is supplies and projection differs from the water surface, water surface is re-projected to match the DEM.

download.method

Method to be used for downloading files. See options in utils::download.file

Value

eden getEDEN returns an 'eden' object, which is a list with two elements: (1) the date(s) used, and (2) a spatial object with water levels (centimeters relative to soil surface) in the EDEN grid.

Examples


## Not run: 
### default behavior is to return data from the most recent date
a <- getEDEN(EDEN_date = Sys.Date(), returnType = 'terra')

### only the most recent data are available as individual geotiffs.
### Use 'exact = TRUE' to return NULL if an exact date match isn't found
edenDat.false <- getEDEN(EDEN_date = "20180101", exact = FALSE)
edenDat.true  <- getEDEN(EDEN_date = "20180101", exact = TRUE)

edenDat.false
edenDat.true 

## End(Not run)


troyhill/fireHydro documentation built on Feb. 2, 2023, 12:09 p.m.