Prepare L4A GEDI above ground biomass (AGB) data for the state data assimilation (SDA) workflow.
Source:R/GEDI_AGB_prep.R
GEDI_AGB_prep.RdPrepare L4A GEDI above ground biomass (AGB) data for the state data assimilation (SDA) workflow.
Usage
GEDI_AGB_prep(
site_info,
time_points,
outdir = file.path(getwd(), "GEDI_AGB"),
buffer = 0.005,
search_window = "6 month",
bbox = NULL,
batch = FALSE,
prerun = NULL,
num.folder = NULL,
cores = parallel::detectCores(),
credential_path = "~/.netrc"
)Arguments
- site_info
List: A list including site_id, longitude, and latitude.
- time_points
Character: A vector of date contains target dates (in YYYY-MM-DD).
- outdir
Character: Directory where the final CSV file will be stored.
- buffer
Numeric: buffer distance (in degrees) for locate GEDI AGB searching box (default is 0.005 [~ 500 m]).
- search_window
Character: search window (any length of time. e.g., 6 month) for locate available GEDI AGB values.
- bbox
Numeric: the vector (in xmin, xmax, ymin, and ymax) that covers all the sites in the site_info object (default is NULL).
- batch
Boolean: determine if we want to submit jobs to the queue or not (default is FALSE).
- prerun
Character: series of pre-launch shell command before running the shell job (default is NULL).
- num.folder
Numeric: the number of batch folders to be created when submitting jobs to the queue.
- cores
Numeric: numbers of core to be used for the parallel computation. The default is the maximum current CPU number.
- credential_path
Character: the physical path to the credential file. (.netrc).
Details
During the first use, users will need to create the `.nasadaacapirc` file in the out folder where the first and second lines are the username and password on the NASA Earth Explore server. If you don't have an account, register at https://urs.earthdata.nasa.gov/users/new.
Examples
if (FALSE) { # \dontrun{
settings <- PEcAn.settings::read.settings("pecan.xml")
site_info <- settings %>%
purrr::map(~.x[['run']] ) %>%
purrr::map('site')%>%
purrr::map(function(site.list){
#conversion from string to number
site.list$lat <- as.numeric(site.list$lat)
site.list$lon <- as.numeric(site.list$lon)
list(site_id=site.list$id, lat=site.list$lat, lon=site.list$lon, site_name=site.list$name)
}) %>%
dplyr::bind_rows() %>%
as.list()
time_points <- seq(start.date, end.date, by = time.step)
buffer <- 0.005
outdir <- getwd()
GEDI_AGB <- GEDI_AGB_prep(site_info, time_points, outdir, buffer)
} # }