l4_getmulti: Get AGBD data from a list of GEDI Level 4 file path

View source: R/l4_getmulti.R

l4_getmultiR Documentation

Get AGBD data from a list of GEDI Level 4 file path

Description

Get GEDI L4 data from h5 file format. See here for more documentation on GEDI L4 data. The function use the snowfall package to get data in parallel. There could be memory allocation problems for an high number of file path. This is the core function of l4_process, that manage the whole workflow of reading, clipping and converting a list of h5 GEDI file path.

Usage

l4_getmulti(
  gediL4_path,
  just_colnames = F,
  add_col = NULL,
  tct = NULL,
  ncore = parallel::detectCores() - 1,
  merge = T,
  catch = T,
  source = F
)

Arguments

gediL4_path

List or vector of character path to GEDI level4A h5 file.

just_colnames

Logical: if TRUE, the function return the dataset names in the h5 file. Useful to get names for the argument add_col.

add_col

Character vector of extra datasets names to cbind to the default output. Names already present will be dropped.

tct

Numeric: tree cover threshold to filter GEDI data.

ncore

Numeric: numbers of core to be used if the maximum core available is less than the length of gediL4_path Default to the number of cores available minus one.

merge

Logical: if TRUE (default) the resulted list will be merged with rbind. Ignored if length(gediL4_path)==1

catch

Logical: if TRUE (default) files that would throw an error don't interrupt the processing of subsequent files. For this file the function will return NULL.Ignored if length(gediL4_path)==1

source

Logical: if TRUE and merge=TRUE add a column with the source path of each observation.Ignored if length(gediL4_path)==1, and if merge=FALSE

Details

Columns specification: Flag indicate likely invalid waveform (1=valid,0=invalid).

  • date: Date of acquisition in yyyy-mm-dd hh:mm:ss

  • beam: Beam identifier

  • shot_number: Shot number

  • degrade_flag : Flag indicating degraded state of pointing and/or positioning information

  • l4_quality_flag: Flag identifying the most useful L4 data for biomass predictions

  • l2_quality_flag: Flag identifying the most useful L2 data for biomass predictions

  • algorithm_run_flag: The L4A algorithm is run if this flag is set to 1. This flag selects data that have sufficient waveform fidelity for AGBD estimation.

  • sensitivity: Maxmimum canopy cover that can be penetrated considering the SNR of the waveform

  • lat_lowestmode: Latitude of center of lowest mode

  • lon_lowestmode: Longitude of center of lowest mode

  • elev_lowestmode: Elevation of center of lowest mode relative to reference ellipsoid

  • tree_cover: Tree cover in the year 2010, defined as canopy closure for all vegetation taller than 5 m in height (Hansen et al., 2013) and encoded as a percentage per output grid cell.

  • pft_class: Plant Functional Type (PFT) derived from the MODIS MCD12Q1 V006 product. Values follow the Land Cover Type 5 Classification scheme.

  • agbd_se: Aboveground biomass density (Mg/ha) prediction standard error

  • agbd: Aboveground biomass density (Mg/ha)

For DOWNLOADING more detailed information on GEDI Level 4A data (version 2.1) see the user guide and product data dictionary Note that by default the function will dropp all footprint in which agbd<0. These observations are considered sensor errors.

Value

A list of S4 object of class data.table or a single object of class data.table if merge=TRUE.

See Also

l4_process

Examples


Specifying the path to GEDI level4A data (zip file)
outdir = tempdir()
l4_zip <- system.file("extdata",
                      c("GEDI04_A_2020036151358_O06515_02_T00198_02_002_01_V002.zip",
                        "GEDI04_A_2021150031254_O13948_03_T06447_02_002_01_V002.zip"
                      ),
                      package="GEDI4R")
#Unzipping GEDI level4A data
l4 <- lapply(l4_zip,unzip,exdir = outdir)
#list all dataset in h5 file
l4_getmulti(l4[[1]],just_colnames=T)
#read and merge all file
l4_data <- l4_getmulti(l4,merge = T)
#return individual files as list
l4_data <- l4_getmulti(l4,merge = F)
#add user-defined dataset
col_name <- "delta_time"
l4_data <- l4_getmulti(l4,add_col = col_name,merge = T)
file.remove(list.files(outdir,full.names = T))

VangiElia/GEDI4R documentation built on April 8, 2023, 6:13 p.m.