| Title: | NASA's Global Ecosystem Dynamics Investigation (GEDI) Data Visualization and Processing |
|---|---|
| Description: | Tools for finding, downloading, reading, visualizing, sampling, modeling, and processing NASA Global Ecosystem Dynamics Investigation (GEDI) Level 1B, Level 2A, Level 2B, Level 3, Level 4A, and Level 4B data. Supports local files, NASA Earthdata Cloud access, and optional Google Earth Engine workflows for ancillary-data extraction and wall-to-wall mapping. |
| Authors: | Carlos Alberto Silva [aut, cph, cre], Caio Hamamura [aut, cph], Ruben Valbuena [aut, ctb], Steven Hancock [aut, ctb], Adrian Cardil [aut, ctb], Eben North Broadbent [aut, ctb], Danilo Roberti Alves de Almeida [aut, ctb], Celso H. L. Silva Junior [aut, ctb], Carine Klauberg [aut, ctb] |
| Maintainer: | Carlos Alberto Silva <[email protected]> |
| License: | GPL-3 |
| Version: | 0.6.0 |
| Built: | 2026-10-10 18:50:06 UTC |
| Source: | https://github.com/carlos-alberto-silva/rGEDI |
The rGEDI package provides functions for i) downloading, ii) visualizing, iii) clipping, iv) gridding, iv) simulating and v) exporting GEDI data.
See more details about GEDI data in https://gedi.umd.edu/dataproducts/products/.
Carlos A. Silva, Caio Hamamura, Ruben Valbuena, Steve Hancock, Adrian Cardil, Eben N. Broadbent, Danilo R. A. de Almeida, Celso H. L. Silva Junior and Carine Klauberg
For comprehensive examples refer to https://github.com/carlos-alberto-silva/rGEDI/blob/master/README.md
Add an Earth Engine image to a Leaflet map
addEEImage( map, image, bands = NULL, min = 0, max = 1, palette = NULL, group = NULL, ... )addEEImage( map, image, bands = NULL, min = 0, max = 1, palette = NULL, group = NULL, ... )
map |
A Leaflet widget. |
image |
Earth Engine image. |
bands |
One or three bands. |
min, max
|
Visualization limits. |
palette |
Optional palette. |
group |
Layer group. |
... |
Passed to |
A Leaflet widget.
Aggregate a GEDI Level 3 raster
aggregateLevel3(x, fact, fun = mean, ...)aggregateLevel3(x, fact, fun = mean, ...)
x |
A raster path or |
fact |
Aggregation factor. |
fun |
Aggregation function. |
... |
Passed to |
Aggregate a GEDI Level 4B raster
aggregateLevel4B(x, fact, fun = mean, ...)aggregateLevel4B(x, fact, fun = mean, ...)
x |
A raster path or |
fact |
Aggregation factor. |
fun |
Aggregation function. |
... |
Passed to |
Earth Engine terrain aspect
aspect(x)aspect(x)
x |
Earth Engine elevation image. |
An Earth Engine image.
Train a regression forest in Earth Engine
build_ee_forest(training, response, predictors, trees = 500L, seed = 1L)build_ee_forest(training, response, predictors, trees = 500L, seed = 1L)
training |
Earth Engine |
response |
Response property name, such as |
predictors |
Predictor property names. |
trees |
Number of trees. |
seed |
Random seed. |
A trained Earth Engine classifier configured for regression.
clip() provides one clipping interface for open GEDI HDF5 products,
extracted footprint tables, and GEDI Level 3 or Level 4B rasters. It follows
the workflow used by ICESat2VegR while retaining rGEDI's coordinate order.
clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level1b,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level1b,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level1b,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2a,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2a,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2a,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2b,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2b,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2b,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level4a,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level4a,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level4a,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'data.frame,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'data.frame,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'data.frame,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'SpatRaster,ANY' clip(x, clip_obj, ...)clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level1b,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level1b,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level1b,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2a,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2a,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2a,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2b,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2b,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level2b,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level4a,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level4a,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'gedi.level4a,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'data.frame,numeric' clip(x, clip_obj, ...) ## S4 method for signature 'data.frame,SpatExtent' clip(x, clip_obj, ...) ## S4 method for signature 'data.frame,ANY' clip(x, clip_obj, ...) ## S4 method for signature 'SpatRaster,ANY' clip(x, clip_obj, ...)
x |
A |
clip_obj |
A numeric extent in the order
|
... |
Arguments used by the selected method. HDF5 methods accept
|
Extracted tables are recognized from standard GEDI coordinates:
longitude_bin0/latitude_bin0, lon_lowestmode/lat_lowestmode, or
longitude/latitude. When the corresponding longitude_lastbin and
latitude_lastbin fields exist, both waveform endpoints must fall inside a
numeric extent.
This function masks graphics::clip(). Use graphics::clip() explicitly
when changing a base graphics clipping region.
The return type follows x. Open Level 1B, 2A, 2B, and 4A HDF5
inputs return clipped open GEDI objects; footprint tables return a
data.table::data.table; and Level 3/4B rasters return a
terra::SpatRaster. Geometry clipping with split_by returns a
named list of HDF5-backed GEDI objects, one per polygon ID.
footprints <- data.frame( shot_number = 1:3, lon_lowestmode = c(-44.13, -44.12, -44.10), lat_lowestmode = c(-13.74, -13.73, -13.70) ) clip(footprints, c(-44.14, -44.11, -13.75, -13.72))footprints <- data.frame( shot_number = 1:3, lon_lowestmode = c(-44.13, -44.12, -44.10), lat_lowestmode = c(-13.74, -13.73, -13.70) ) clip(footprints, c(-44.14, -44.11, -13.75, -13.72))
This function clips GEDI Level1B data (geolocated waveforms) within a given bounding coordinates
clipLevel1B(level1b, xmin, xmax, ymin, ymax, output)clipLevel1B(level1b, xmin, xmax, ymin, ymax, output)
level1b |
A |
xmin |
Numeric. West longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
xmax |
Numeric. East longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
ymin |
Numeric. South latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
ymax |
Numeric. North latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
output |
Optional character path where to save the new hdf5file. The default stores a temporary file only. |
Returns a list of S4 objects of class gedi.level1b containing
clipped GEDI Level1B data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi01-b-002
## Not run: # Specifying the path to GEDI level1B data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Bounding rectangle coordinates xmin <- -44.13 xmax <- -44.12 ymin <- -13.74 ymax <- -13.73 # Specifying output file and path output <- file.path(outdir, "GEDI01_B_2019108080338_O01964_T05337_02_003_01_clip") # Clipping GEDI Level1B data by extent boundary box level1b_clip <- clipLevel1B(level1b, xmin, xmax, ymin, ymax, output) close(level1b) close(level1b_clip) ## End(Not run)## Not run: # Specifying the path to GEDI level1B data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Bounding rectangle coordinates xmin <- -44.13 xmax <- -44.12 ymin <- -13.74 ymax <- -13.73 # Specifying output file and path output <- file.path(outdir, "GEDI01_B_2019108080338_O01964_T05337_02_003_01_clip") # Clipping GEDI Level1B data by extent boundary box level1b_clip <- clipLevel1B(level1b, xmin, xmax, ymin, ymax, output) close(level1b) close(level1b_clip) ## End(Not run)
This function clips GEDI level1B extracted geolocation (getLevel1BGeo())
data a within given bounding coordinates
clipLevel1BGeo(level1BGeo, xmin, xmax, ymin, ymax)clipLevel1BGeo(level1BGeo, xmin, xmax, ymin, ymax)
level1BGeo |
A |
xmin |
Numeric. West longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
xmax |
Numeric. East longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
ymin |
Numeric. South latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
ymax |
Numeric. North latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
Returns an S4 object of class data.table::data.table.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi01-b-002
# Specifying the path to GEDI level1B data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Extracting GEDI Full Waveform Geolocations level1bGeo <- getLevel1BGeo(level1b) # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping GEDI Full Waveform Geolocations by boundary box extent level1bGeo_clip <- clipLevel1BGeo(level1bGeo, xmin, xmax, ymin, ymax) if (interactive() && requireNamespace("leaflet", quietly = TRUE)) { library(leaflet) leaflet() %>% addCircleMarkers(level1bGeo_clip$longitude_bin0, level1bGeo_clip$latitude_bin0, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level1b)# Specifying the path to GEDI level1B data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Extracting GEDI Full Waveform Geolocations level1bGeo <- getLevel1BGeo(level1b) # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping GEDI Full Waveform Geolocations by boundary box extent level1bGeo_clip <- clipLevel1BGeo(level1bGeo, xmin, xmax, ymin, ymax) if (interactive() && requireNamespace("leaflet", quietly = TRUE)) { library(leaflet) leaflet() %>% addCircleMarkers(level1bGeo_clip$longitude_bin0, level1bGeo_clip$latitude_bin0, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level1b)
This function clips level1BGeo extracted geolocation (level1BGeo) data within a given geometry
clipLevel1BGeoGeometry(level1BGeo, polygon, split_by = "id")clipLevel1BGeoGeometry(level1BGeo, polygon, split_by = "id")
level1BGeo |
A |
polygon |
Polygon. An object of class |
split_by |
Polygon id. If defined, GEDI data will be clipped by each polygon using the polygon id from table of attribute defined by the user. |
Returns an S4 object of class data.table::data.table containing the
clipped GEDI level1B extracted geolocations.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi01-b-002
# Specifying the path to GEDI level1B data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Extracting GEDI Full Waveform Geolocations level1BGeo <- getLevel1BGeo(level1b, beams = "BEAM0001") # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping GEDI Full Waveform Geolocations by Geometry level1BGeo_clip <- clipLevel1BGeoGeometry(level1BGeo, polygon, split_by = "id") if (interactive() && requireNamespace("leaflet", quietly = TRUE)) { library(leaflet) leaflet() %>% addCircleMarkers(level1BGeo_clip$longitude_bin0, level1BGeo_clip$latitude_bin0, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addPolygons( data = polygon, weight = 1, col = "white", opacity = 1, fillOpacity = 0 ) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level1b)# Specifying the path to GEDI level1B data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Extracting GEDI Full Waveform Geolocations level1BGeo <- getLevel1BGeo(level1b, beams = "BEAM0001") # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping GEDI Full Waveform Geolocations by Geometry level1BGeo_clip <- clipLevel1BGeoGeometry(level1BGeo, polygon, split_by = "id") if (interactive() && requireNamespace("leaflet", quietly = TRUE)) { library(leaflet) leaflet() %>% addCircleMarkers(level1BGeo_clip$longitude_bin0, level1BGeo_clip$latitude_bin0, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addPolygons( data = polygon, weight = 1, col = "white", opacity = 1, fillOpacity = 0 ) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level1b)
This function clips GEDI Level1B (geolocated waveforms) data within a given bounding geometry
clipLevel1BGeometry(level1b, polygon, output = "", split_by = NULL)clipLevel1BGeometry(level1b, polygon, output = "", split_by = NULL)
level1b |
A |
polygon |
Polygon or Multipolygon. An object opened with |
output |
Optional character path where to save the new
|
split_by |
Polygon id. If defined, GEDI data will be clipped by each polygon using
the attribute specified by |
Returns a list of S4 object of class gedi.level1b containing clipped
GEDI Level1B data.
## Not run: outdir <- tempdir() # Specifying the path to GEDI level1B data (zip file) level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Spepecifing output file and path output <- file.path(outdir, "GEDI01_B_2019108080338_O01964_T05337_02_003_01_clip") # clipping GEDI Level1B data by extent boundary box level1b_clip <- clipLevel1BGeometry(level1b, polygon = polygon, output = output, split_by = "id" ) close(level1b) lapply(level1b_clip, close) ## End(Not run)## Not run: outdir <- tempdir() # Specifying the path to GEDI level1B data (zip file) level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Spepecifing output file and path output <- file.path(outdir, "GEDI01_B_2019108080338_O01964_T05337_02_003_01_clip") # clipping GEDI Level1B data by extent boundary box level1b_clip <- clipLevel1BGeometry(level1b, polygon = polygon, output = output, split_by = "id" ) close(level1b) lapply(level1b_clip, close) ## End(Not run)
This function clips GEDI Level2A data within a given bounding coordinates
clipLevel2A(level2a, xmin, xmax, ymin, ymax, output)clipLevel2A(level2a, xmin, xmax, ymin, ymax, output)
level2a |
A GEDI Level2A object (output of |
xmin |
Numeric. West longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
xmax |
Numeric. East longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
ymin |
Numeric. South latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
ymax |
Numeric. North latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
output |
Optional character path where to save the new hdf5file. The default stores a temporary file only. |
Returns a list of S4 objects of class "gedi.level2a" containing clipped GEDI Level2A data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-a-002
## Not run: outdir <- tempdir() # Specifying the path to GEDI level2A data (zip file) level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Bounding rectangle coordinates xmin <- -44.13 xmax <- -44.12 ymin <- -13.74 ymax <- -13.73 print(level2a) # Specifying output file and path output <- file.path(outdir, "GEDI02_A_2019108080338_O01964_T05337_02_001_01_clip.h5") # Clipping GEDI Level2A data by boundary box extent level2a_clip <- clipLevel2A(level2a, xmin, xmax, ymin, ymax, output) close(level2a) close(level2a_clip) ## End(Not run)## Not run: outdir <- tempdir() # Specifying the path to GEDI level2A data (zip file) level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Bounding rectangle coordinates xmin <- -44.13 xmax <- -44.12 ymin <- -13.74 ymax <- -13.73 print(level2a) # Specifying output file and path output <- file.path(outdir, "GEDI02_A_2019108080338_O01964_T05337_02_001_01_clip.h5") # Clipping GEDI Level2A data by boundary box extent level2a_clip <- clipLevel2A(level2a, xmin, xmax, ymin, ymax, output) close(level2a) close(level2a_clip) ## End(Not run)
This function clips GEDI Level2A data within a given geometry
clipLevel2AGeometry(level2a, polygon, output = "", split_by = NULL)clipLevel2AGeometry(level2a, polygon, output = "", split_by = NULL)
level2a |
A GEDI Level2A object (output of |
polygon |
Polygon. An object of class |
output |
optional character path where to save the new h5file. Default "" (temporary file). |
split_by |
Polygon id. If defined, GEDI data will be clipped by each polygon using the
attribute specified by |
Returns a list of S4 object of class "gedi.level2a" containing clipped GEDI Level2A data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-a-002
## Not run: outdir <- tempdir() # Specifying the path to GEDI level2A data (zip file) level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Specifying output file and path output <- file.path(outdir, "GEDI02_A_2019108080338_O01964_T05337_02_001_01_clip") # Clipping GEDI Level2A data by geometry level2a_clip <- clipLevel2AGeometry(level2a, polygon = polygon, output = output, split_by = "id" ) close(level2a) lapply(level2a_clip, close) ## End(Not run)## Not run: outdir <- tempdir() # Specifying the path to GEDI level2A data (zip file) level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Specifying output file and path output <- file.path(outdir, "GEDI02_A_2019108080338_O01964_T05337_02_001_01_clip") # Clipping GEDI Level2A data by geometry level2a_clip <- clipLevel2AGeometry(level2a, polygon = polygon, output = output, split_by = "id" ) close(level2a) lapply(level2a_clip, close) ## End(Not run)
This function clips GEDI Level2A extracted Elevation and Height Metrics (Level2AM) within a given bounding coordinates
clipLevel2AM(level2AM, xmin, xmax, ymin, ymax)clipLevel2AM(level2AM, xmin, xmax, ymin, ymax)
level2AM |
A GEDI Level2A object (output of |
xmin |
Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees. |
xmax |
Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees. |
ymin |
Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees. |
ymax |
Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees. |
Returns an S4 object of class data.table::data.table containing the clipped elevation and relative heights metrics.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-a-002
# Specifying the path to GEDI level2A data (zip file) outdir <- tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Extracting GEDI Elevation and Height Metrics level2AM <- getLevel2AM(level2a, beams = "BEAM0001") # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping GEDI data by boundary box extent level2AM_clip <- clipLevel2AM(level2AM, xmin, xmax, ymin, ymax) close(level2a)# Specifying the path to GEDI level2A data (zip file) outdir <- tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Extracting GEDI Elevation and Height Metrics level2AM <- getLevel2AM(level2a, beams = "BEAM0001") # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping GEDI data by boundary box extent level2AM_clip <- clipLevel2AM(level2AM, xmin, xmax, ymin, ymax) close(level2a)
This function clips GEDI Level2A extracted Elevation and Height Metrics (Level2AM) within a given bounding coordinates
clipLevel2AMGeometry(level2AM, polygon, split_by = "id")clipLevel2AMGeometry(level2AM, polygon, split_by = "id")
level2AM |
A GEDI Level2A object (output of |
polygon |
Polygon. An object of class |
split_by |
Polygon id. If defined, GEDI data will be clipped by each polygon using the polygon id from table of attribute defined by the user |
Returns an S4 object of class data.table::data.table containing the clipped elevation and relative heights metrics.
# Specifying the path to GEDI level2A data (zip file) outdir <- tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Extracting GEDI Elevation and Height Metrics level2AM <- getLevel2AM(level2a, beams = "BEAM0001") # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping GEDI data by Geometry level2AM_clip <- clipLevel2AMGeometry(level2AM, polygon, split_by = "id") hasLeaflet <- require(leaflet) if (hasLeaflet) { leaflet() %>% addCircleMarkers(level2AM_clip$lat_lowestmode, level2AM_clip$lon_lowestmode, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addPolygons( data = polygon, weight = 1, col = "white", opacity = 1, fillOpacity = 0 ) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level2a)# Specifying the path to GEDI level2A data (zip file) outdir <- tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Extracting GEDI Elevation and Height Metrics level2AM <- getLevel2AM(level2a, beams = "BEAM0001") # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping GEDI data by Geometry level2AM_clip <- clipLevel2AMGeometry(level2AM, polygon, split_by = "id") hasLeaflet <- require(leaflet) if (hasLeaflet) { leaflet() %>% addCircleMarkers(level2AM_clip$lat_lowestmode, level2AM_clip$lon_lowestmode, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addPolygons( data = polygon, weight = 1, col = "white", opacity = 1, fillOpacity = 0 ) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level2a)
This function extracts GEDI Level1B data a within given bounding coordinates
clipLevel2B(level2b, xmin, xmax, ymin, ymax, output = "")clipLevel2B(level2b, xmin, xmax, ymin, ymax, output = "")
level2b |
A GEDI Level2B object (output of |
xmin |
Numeric. West longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
xmax |
Numeric. East longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
ymin |
Numeric. South latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
ymax |
Numeric. North latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
output |
Optional character path where to save the new hdf5 file. The default stores a temporary file only. |
Returns a list of S4 object of class "gedi.level2b" containing clipped GEDI Level2B data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi01-b-002
## Not run: outdir <- tempdir() # Specifying the path to GEDI level2B data (zip file) level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Bounding rectangle coordinates xmin <- -44.13 xmax <- -44.12 ymin <- -13.74 ymax <- -13.73 # Specifying output file and path output <- file.path(outdir, "GEDI02_B_2019108080338_O01964_T05337_02_001_01_clip") # Clipping GEDI data by extent boundary box level2b_clip <- clipLevel2B(level2b, xmin, xmax, ymin, ymax) close(level2b) close(level2b_clip) ## End(Not run)## Not run: outdir <- tempdir() # Specifying the path to GEDI level2B data (zip file) level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Bounding rectangle coordinates xmin <- -44.13 xmax <- -44.12 ymin <- -13.74 ymax <- -13.73 # Specifying output file and path output <- file.path(outdir, "GEDI02_B_2019108080338_O01964_T05337_02_001_01_clip") # Clipping GEDI data by extent boundary box level2b_clip <- clipLevel2B(level2b, xmin, xmax, ymin, ymax) close(level2b) close(level2b_clip) ## End(Not run)
This function extracts GEDI Level1B data within a given geometry
clipLevel2BGeometry(level2b, polygon, output = "", split_by = NULL)clipLevel2BGeometry(level2b, polygon, output = "", split_by = NULL)
level2b |
A GEDI Level2B object (output of |
polygon |
Polygon. An object of class |
output |
optional character path where to save the new h5file. Default "" (temporary file). |
split_by |
Polygon id. If defined, GEDI data will be clipped by each polygon using the attribute specified by |
Returns a list of S4 objects of class "gedi.level2b" containing clipped GEDI Level2B data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi01-b-002
## Not run: outdir <- tempdir() # Specifying the path to GEDI level2B data (zip file) level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Specifying output file and path output <- file.path(outdir, "GEDI02_B_2019108080338_O01964_T05337_02_001_01_clip") # Clipping GEDI data by extent boundary box level2b_clip <- clipLevel2BGeometry(level2b, polygon = polygon, output = output, split_by = "id" ) close(level2b) lapply(level2b_clip, close) ## End(Not run)## Not run: outdir <- tempdir() # Specifying the path to GEDI level2B data (zip file) level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Specifying output file and path output <- file.path(outdir, "GEDI02_B_2019108080338_O01964_T05337_02_001_01_clip") # Clipping GEDI data by extent boundary box level2b_clip <- clipLevel2BGeometry(level2b, polygon = polygon, output = output, split_by = "id" ) close(level2b) lapply(level2b_clip, close) ## End(Not run)
This function clips GEDI level2B derived Plant Area Index profile a within given bounding coordinates
clipLevel2BPAIProfile(level2BPAIProfile, xmin, xmax, ymin, ymax)clipLevel2BPAIProfile(level2BPAIProfile, xmin, xmax, ymin, ymax)
level2BPAIProfile |
A GEDI Level2B object (output of |
xmin |
Numeric. West longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
xmax |
Numeric. East longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
ymin |
Numeric. South latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
ymax |
Numeric. North latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
Returns an S4 object of class data.table::data.table containing the Plant Area Index profile data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting GEDI Plant Area Index profile level2BPAIProfile <- getLevel2BPAIProfile(level2b) # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping GEDI Plant Area Index profile by extent boundary box level2b_clip <- clipLevel2BPAIProfile(level2BPAIProfile, xmin, xmax, ymin, ymax) close(level2b)# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting GEDI Plant Area Index profile level2BPAIProfile <- getLevel2BPAIProfile(level2b) # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping GEDI Plant Area Index profile by extent boundary box level2b_clip <- clipLevel2BPAIProfile(level2BPAIProfile, xmin, xmax, ymin, ymax) close(level2b)
This function clips GEDI level2B derived Plant Area Index profile within a given geometry
clipLevel2BPAIProfileGeometry(level2BPAIProfile, polygon, split_by = NULL)clipLevel2BPAIProfileGeometry(level2BPAIProfile, polygon, split_by = NULL)
level2BPAIProfile |
A GEDI Level2B object (output of |
polygon |
Polygon. An object of class |
split_by |
Polygon id. If defined, GEDI data will be clipped by each polygon using the
attribute specified by |
Returns an S4 object of class data.table::data.table containing the Plant Area Index profile data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting GEDI Plant Area Index profile level2BPAIProfile <- getLevel2BPAIProfile(level2b) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping GEDI Plant Area Index profile by geometry level2b_clip_geometry <- clipLevel2BPAIProfileGeometry( level2BPAIProfile, polygon, split_by = "id" ) close(level2b)# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting GEDI Plant Area Index profile level2BPAIProfile <- getLevel2BPAIProfile(level2b) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping GEDI Plant Area Index profile by geometry level2b_clip_geometry <- clipLevel2BPAIProfileGeometry( level2BPAIProfile, polygon, split_by = "id" ) close(level2b)
This function clips GEDI level2B derived Plant Area Volume Density profile within a given bounding coordinates
clipLevel2BPAVDProfile(level2BPAVDProfile, xmin, xmax, ymin, ymax)clipLevel2BPAVDProfile(level2BPAVDProfile, xmin, xmax, ymin, ymax)
level2BPAVDProfile |
A GEDI Level2B object (output of |
xmin |
Numeric. West longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
xmax |
Numeric. East longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
ymin |
Numeric. South latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
ymax |
Numeric. North latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
Returns an S4 object of class data.table::data.table containing the Plant Area Volume Density profile data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# specify the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting GEDI Plant Area Volume Density profile level2BPAVDProfile <- getLevel2BPAVDProfile(level2b) # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping GEDI Plant Area Volume Density profile by boundary box extent level2BPAVDProfile_clip <- clipLevel2BPAVDProfile(level2BPAVDProfile, xmin, xmax, ymin, ymax) close(level2b)# specify the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting GEDI Plant Area Volume Density profile level2BPAVDProfile <- getLevel2BPAVDProfile(level2b) # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping GEDI Plant Area Volume Density profile by boundary box extent level2BPAVDProfile_clip <- clipLevel2BPAVDProfile(level2BPAVDProfile, xmin, xmax, ymin, ymax) close(level2b)
This function clips GEDI level2B derived Plant Area Index profile within a given geometry
clipLevel2BPAVDProfileGeometry(level2BPAVDProfile, polygon, split_by = NULL)clipLevel2BPAVDProfileGeometry(level2BPAVDProfile, polygon, split_by = NULL)
level2BPAVDProfile |
A GEDI Level2B object (output of |
polygon |
Polygon. An object of class |
split_by |
Polygon id. If defined, GEDI data will be clipped by each polygon using the attribute specified by |
Returns an S4 object of class data.table::data.table containing the Plant Area Volume Density profile data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting GEDI Plant Area Volume Density profile level2BPAVDProfile <- getLevel2BPAVDProfile(level2b) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping GEDI Plant Area Volume Density profile by geometry level2BPAVDProfile_clip <- clipLevel2BPAVDProfileGeometry( level2BPAVDProfile, polygon, split_by = "id" ) close(level2b)# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting GEDI Plant Area Volume Density profile level2BPAVDProfile <- getLevel2BPAVDProfile(level2b) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping GEDI Plant Area Volume Density profile by geometry level2BPAVDProfile_clip <- clipLevel2BPAVDProfileGeometry( level2BPAVDProfile, polygon, split_by = "id" ) close(level2b)
This function clips GEDI level2B derived Canopy Cover and Vertical Profile metrics a within given bounding coordinates
clipLevel2BVPM(level2BVPM, xmin, xmax, ymin, ymax)clipLevel2BVPM(level2BVPM, xmin, xmax, ymin, ymax)
level2BVPM |
A GEDI Level2B object (output of |
xmin |
Numeric. West longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
xmax |
Numeric. East longitude (x) coordinate of the bounding rectangle, in decimal degrees. |
ymin |
Numeric. South latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
ymax |
Numeric. North latitude (y) coordinate of the bounding rectangle, in decimal degrees. |
Returns an S4 object of class data.table::data.table containing the Canopy Cover and Vertical Profile metrics.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting canopy cover and vertical profile metrics beam <- grep("^BEAM", (level2b@h5)$ls(recursive = FALSE)$name, value = TRUE)[1] level2BVPM <- getLevel2BVPM(level2b, beams = beam) # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping level2BVPM by extent boundary box level2b_clip <- clipLevel2BVPM(level2BVPM, xmin, xmax, ymin, ymax) hasLeaflet <- require(leaflet) if (hasLeaflet) { leaflet() %>% addCircleMarkers(level2b_clip$longitude_bin0, level2b_clip$latitude_bin0, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level2b)# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting canopy cover and vertical profile metrics beam <- grep("^BEAM", (level2b@h5)$ls(recursive = FALSE)$name, value = TRUE)[1] level2BVPM <- getLevel2BVPM(level2b, beams = beam) # Bounding rectangle coordinates xmin <- -44.15036 xmax <- -44.10066 ymin <- -13.75831 ymax <- -13.71244 # Clipping level2BVPM by extent boundary box level2b_clip <- clipLevel2BVPM(level2BVPM, xmin, xmax, ymin, ymax) hasLeaflet <- require(leaflet) if (hasLeaflet) { leaflet() %>% addCircleMarkers(level2b_clip$longitude_bin0, level2b_clip$latitude_bin0, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level2b)
This function clips GEDI level2B derived Canopy Cover and Vertical Profile metrics within a given geometry
clipLevel2BVPMGeometry(level2BVPM, polygon, split_by = NULL)clipLevel2BVPMGeometry(level2BVPM, polygon, split_by = NULL)
level2BVPM |
A GEDI Level2B object (output of |
polygon |
Polygon. An object of class |
split_by |
Polygon id. If defined, GEDI data will be clipped by each polygon using the attribute specified by |
Returns an S4 object of class data.table::data.table containing the Canopy Cover and Vertical Profile metrics.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting canopy cover and vertical profile metrics beam <- grep("^BEAM", (level2b@h5)$ls(recursive = FALSE)$name, value = TRUE)[1] level2BVPM <- getLevel2BVPM(level2b, beams = beam) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping level2BVPM by geometry level2b_clip_geometry <- clipLevel2BVPMGeometry(level2BVPM, polygon, split_by = "id") hasLeaflet <- require(leaflet) if (hasLeaflet) { leaflet() %>% addCircleMarkers(level2b_clip_geometry$longitude_bin0, level2b_clip_geometry$latitude_bin0, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addPolygons( data = polygon, weight = 1, col = "white", opacity = 1, fillOpacity = 0 ) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level2b)# Specifying the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Extracting canopy cover and vertical profile metrics beam <- grep("^BEAM", (level2b@h5)$ls(recursive = FALSE)$name, value = TRUE)[1] level2BVPM <- getLevel2BVPM(level2b, beams = beam) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Clipping level2BVPM by geometry level2b_clip_geometry <- clipLevel2BVPMGeometry(level2BVPM, polygon, split_by = "id") hasLeaflet <- require(leaflet) if (hasLeaflet) { leaflet() %>% addCircleMarkers(level2b_clip_geometry$longitude_bin0, level2b_clip_geometry$latitude_bin0, radius = 1, opacity = 1, color = "red" ) %>% addScaleBar(options = list(imperial = FALSE)) %>% addPolygons( data = polygon, weight = 1, col = "white", opacity = 1, fillOpacity = 0 ) %>% addProviderTiles(providers$Esri.WorldImagery) } close(level2b)
Clip a GEDI Level 3 raster
clipLevel3(x, y, filename = "", overwrite = FALSE)clipLevel3(x, y, filename = "", overwrite = FALSE)
x |
A raster path or |
y |
An extent |
filename |
Optional output filename. |
overwrite |
Logical. |
Clip GEDI Level 4A data by an extent
clipLevel4A(level4A, xmin, xmax, ymin, ymax, output = "")clipLevel4A(level4A, xmin, xmax, ymin, ymax, output = "")
level4A |
A |
xmin, xmax, ymin, ymax
|
Bounding coordinates in longitude/latitude. |
output |
Optional output HDF5 path when |
A clipped gedi.level4a object for HDF5 input, or a
data.table::data.table for table input.
Clip GEDI Level 4A data by polygons
clipLevel4AGeometry(level4A, polygon, split_by = NULL, output = "")clipLevel4AGeometry(level4A, polygon, split_by = NULL, output = "")
level4A |
A |
polygon |
An |
split_by |
Optional polygon attribute. For HDF5 input, one clipped
file is returned per unique value. For table input, the value is copied
to |
output |
Optional output HDF5 path when |
A clipped gedi.level4a object (or a named list when
split_by is used) for HDF5 input, or a data.table::data.table for
table input.
Clip a GEDI Level 4B raster
clipLevel4B(x, y, filename = "", overwrite = FALSE)clipLevel4B(x, y, filename = "", overwrite = FALSE)
x |
A raster path or |
y |
An extent |
filename |
Optional output filename. |
overwrite |
Logical. |
gedi.level1b
Closing files will avoid locking HDF5 GEDI files.
Closing files will avoid locking HDF5 GEDI files.
Closing files will avoid locking HDF5 GEDI files.
## S4 method for signature 'gedi.level1b' close(con, ...) ## S4 method for signature 'gedi.level2a' close(con, ...) ## S4 method for signature 'gedi.level2b' close(con, ...) ## S4 method for signature 'gedi.level4a' close(con, ...)## S4 method for signature 'gedi.level1b' close(con, ...) ## S4 method for signature 'gedi.level2a' close(con, ...) ## S4 method for signature 'gedi.level2b' close(con, ...) ## S4 method for signature 'gedi.level4a' close(con, ...)
con |
An object of class |
... |
Inherited from base |
Close a cloud HDF5 connection
## S3 method for class 'gedi.cloud_h5' close(con, ...)## S3 method for class 'gedi.cloud_h5' close(con, ...)
con |
A |
... |
Reserved for compatibility with |
Invisibly returns NULL.
Uses an existing bearer token, environment credentials, or .netrc file.
earthdata_login(persist = TRUE, netrc = Sys.getenv("NETRC", unset = ""))earthdata_login(persist = TRUE, netrc = Sys.getenv("NETRC", unset = ""))
persist |
Logical; allow Earthaccess to persist an interactive login. |
netrc |
Path to an Earthdata |
Invisibly returns TRUE after successful authentication.
Requests short-lived AWS credentials from Earthaccess and exports them for
GDAL/terra. Direct S3 access to GEDI is available from AWS us-west-2.
earthdata_s3_credentials(daac = "ORNL")earthdata_s3_credentials(daac = "ORNL")
daac |
NASA DAAC short name. GEDI products are hosted by ORNL DAAC. |
Invisibly returns the credential list.
Build an AlphaEarth and terrain predictor stack
ee_build_AlphaEarth_embedding_terrain_stack( geom, start_year, end_year, add_lonlat = TRUE )ee_build_AlphaEarth_embedding_terrain_stack( geom, start_year, end_year, add_lonlat = TRUE )
geom |
Area of interest. |
start_year, end_year
|
Inclusive year range. |
add_lonlat |
Add coordinate bands. |
An Earth Engine image.
Build an HLS and terrain predictor stack in Earth Engine
ee_build_hls_s1c_terrain_stack( x, start_date, end_date, cloud_max = 20, buffer_m = 30 )ee_build_hls_s1c_terrain_stack( x, start_date, end_date, cloud_max = 20, buffer_m = 30 )
x |
Area of interest. |
start_date, end_date
|
Date range. |
cloud_max |
Maximum HLS cloud cover. |
buffer_m |
AOI buffer in meters. |
An Earth Engine image.
Check an Earth Engine task
ee_check_task_status(task, quiet = TRUE)ee_check_task_status(task, quiet = TRUE)
task |
Earth Engine batch task. |
quiet |
Logical. |
Task status list.
Creates a Google Earth Engine batch export task for a GeoTIFF in Google Drive. This is useful for images that exceed the direct download limit.
ee_image_to_drive( image, description = "rGEDI_export", folder = "EE_Exports", file_name_prefix = description, region, scale = 30, crs = "EPSG:4326", max_pixels = 1e+13, start = TRUE, ... )ee_image_to_drive( image, description = "rGEDI_export", folder = "EE_Exports", file_name_prefix = description, region, scale = 30, crs = "EPSG:4326", max_pixels = 1e+13, start = TRUE, ... )
image |
Earth Engine image. |
description |
Task description shown in Earth Engine. |
folder |
Google Drive folder. |
file_name_prefix |
Output file prefix. |
region |
Area of interest accepted by |
scale |
Pixel size in meters. |
crs |
Output CRS. |
max_pixels |
Maximum number of pixels allowed by Earth Engine. |
start |
Start the task immediately. |
... |
Additional arguments passed to Earth Engine's |
An Earth Engine batch task. Use ee_check_task_status() to monitor it.
Initialize Google Earth Engine
ee_initialize( project = Sys.getenv("EE_PROJECT", unset = ""), authenticate = TRUE, quiet = FALSE )ee_initialize( project = Sys.getenv("EE_PROJECT", unset = ""), authenticate = TRUE, quiet = FALSE )
project |
Google Cloud project ID. |
authenticate |
Authenticate when initialization fails. |
quiet |
Logical. |
Invisibly returns the Python Earth Engine module.
sf
Convert an Earth Engine rectangle to sf
ee_rect_to_sf(aoi)ee_rect_to_sf(aoi)
aoi |
Earth Engine geometry. |
An sf polygon.
Convert an extent to an Earth Engine geometry
ext_to_ee(x)ext_to_ee(x)
x |
A |
An Earth Engine geometry.
Extract Earth Engine image values at GEDI footprints
extractEE(stack, geom, scale = 30, chunk_size = 1000L) extractGEDIAncillary(stack, geom, scale = 30, chunk_size = 1000L)extractEE(stack, geom, scale = 30, chunk_size = 1000L) extractGEDIAncillary(stack, geom, scale = 30, chunk_size = 1000L)
stack |
Earth Engine image or list of images. |
geom |
GEDI table, |
scale |
Sampling scale in meters. |
chunk_size |
Number of points per request. |
Extract GEDI Level 3 raster values
extractLevel3(x, y, ...)extractLevel3(x, y, ...)
x |
A raster path or |
y |
Points or polygons accepted by |
... |
Passed to |
A data frame.
Extract GEDI Level 4B raster values
extractLevel4B(x, y, ...)extractLevel4B(x, y, ...)
x |
A raster path or |
y |
Points or polygons accepted by |
... |
Passed to |
A data frame.
Model fit metrics
fit_metrics(observed, predicted, plotstat = FALSE, unit = "", ...)fit_metrics(observed, predicted, plotstat = FALSE, unit = "", ...)
observed, predicted
|
Numeric vectors. |
plotstat |
Draw an observed-versus-predicted plot. |
unit |
Unit label. |
... |
Passed to |
A data frame of accuracy statistics.
Fit a GEDI statistical or random-forest model
fit_model( x, y, method = c("randomForest", "lm"), test = c("none", "split", "kfold", "loocv", "bootstrap"), k = 5L, test_size = 0.3, iterations = 100L, seed = NULL, ... )fit_model( x, y, method = c("randomForest", "lm"), test = c("none", "split", "kfold", "loocv", "bootstrap"), k = 5L, test_size = 0.3, iterations = 100L, seed = NULL, ... )
x |
Predictor data frame. |
y |
Response vector or response column name in |
method |
|
test |
Validation method: |
k |
Number of folds. |
test_size |
Fraction held out for split validation. |
iterations |
Bootstrap iterations. |
seed |
Optional random seed. |
... |
Model arguments. |
An object of class gedi_model.
Class for GEDI level1B Full Waveform
dtObject of class data.table from data.table package containing the extracted GEDI full-waveform elevation and amplitude.
Class for GEDI level1B
h5A local H5File or a cloud-backed GEDI
HDF5 connection containing geolocated waveforms.
H5File in the hdf5r package and
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi01-b-002
Class for GEDI level2A
h5A local H5File or cloud-backed GEDI HDF5 connection containing
ground elevation, canopy top height, and relative heights (RH).
H5File in the hdf5r package and
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-a-002
Class for GEDI level2B
h5A local H5File or cloud-backed GEDI HDF5
connection containing canopy cover, PAI, PAVD, and FHD.
H5File in the hdf5r package and
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
Class for GEDI Level 4A footprint biomass data
h5An open local or cloud-backed HDF5 connection containing a GEDI04_A granule.
https://daac.ornl.gov/GEDI/guides/GEDI_L4A_AGB_Density_V3.html
Download GEDI data from LP DAAC Data Pool. Users will need to enter their Earth Explore login Information for downloading the data.
gediDownload( filepath, outdir = NULL, overwrite = FALSE, buffer_size = 512, timeout = 10, netrc = Sys.getenv("NETRC", unset = "") ) downloadGEDI( filepath, outdir = NULL, overwrite = FALSE, buffer_size = 512, timeout = 10, netrc = Sys.getenv("NETRC", unset = "") )gediDownload( filepath, outdir = NULL, overwrite = FALSE, buffer_size = 512, timeout = 10, netrc = Sys.getenv("NETRC", unset = "") ) downloadGEDI( filepath, outdir = NULL, overwrite = FALSE, buffer_size = 512, timeout = 10, netrc = Sys.getenv("NETRC", unset = "") )
filepath |
Vector object; path to the GEDI data |
outdir |
Vector object, output directory for downloading GEDI data, default |
overwrite |
logical; overwrite file if they already exists in destination, default FALSE |
buffer_size |
integer; the size of download chunk in KB to hold in memory before writing to file, default 512. |
timeout |
integer; connection timeout in seconds. |
netrc |
Optional path to an existing NASA Earthdata |
The normalized paths of the downloaded files, invisibly. On failure the function stops with an error.
Credits to Cole Krehbiel. Code adapted from https://git.earthdata.nasa.gov/projects/LPDUR/repos/daac_data_download_r/browse/DAACDataDownload.R
## Not run: # Set path to GEDI data # herein we will only download xml metedata filepath=c(paste0( "https://e4ftl01.cr.usgs.gov/GEDI/GEDI02_B.001", "/2019.04.18/GEDI02_B_2019108032534_O01961_T03911_02_001_01.h5.xml" ), paste0("https://e4ftl01.cr.usgs.gov/GEDI/GEDI02_B.001", "/2019.04.18/GEDI02_B_2019108045815_O01962_T01066_02_001_01.h5.xml" ) ) # Set dir to download files to outdir=tempdir() # Create .netrc file netrc = file.path(outdir, ".netrc") netrc_conn <- file(netrc) writeLines(c("machine urs.earthdata.nasa.gov", sprintf("login %s", Sys.getenv("NASA_USER")), sprintf("password %s", Sys.getenv("NASA_PASSWORD")) ), netrc_conn) close(netrc_conn) #' Downloading GEDI data gediDownload(filepath,outdir) ## End(Not run)## Not run: # Set path to GEDI data # herein we will only download xml metedata filepath=c(paste0( "https://e4ftl01.cr.usgs.gov/GEDI/GEDI02_B.001", "/2019.04.18/GEDI02_B_2019108032534_O01961_T03911_02_001_01.h5.xml" ), paste0("https://e4ftl01.cr.usgs.gov/GEDI/GEDI02_B.001", "/2019.04.18/GEDI02_B_2019108045815_O01962_T01066_02_001_01.h5.xml" ) ) # Set dir to download files to outdir=tempdir() # Create .netrc file netrc = file.path(outdir, ".netrc") netrc_conn <- file(netrc) writeLines(c("machine urs.earthdata.nasa.gov", sprintf("login %s", Sys.getenv("NASA_USER")), sprintf("password %s", Sys.getenv("NASA_PASSWORD")) ), netrc_conn) close(netrc_conn) #' Downloading GEDI data gediDownload(filepath,outdir) ## End(Not run)
Open a GEDI product in Google Earth Engine
gediEE( product = names(.gedi_ee_catalog), start_date = NULL, end_date = NULL, aoi = NULL, quality = TRUE, max_granules = 200L )gediEE( product = names(.gedi_ee_catalog), start_date = NULL, end_date = NULL, aoi = NULL, quality = TRUE, max_granules = 200L )
product |
GEDI Earth Engine product name. |
start_date, end_date
|
Optional dates for image collections. |
aoi |
Optional spatial filter. |
quality |
Apply available quality masks. |
max_granules |
Maximum number of vector granules to merge. Vector GEDI products are stored as folders of per-granule feature collections in Earth Engine, so use dates and/or an AOI to keep the request focused. |
An Earth Engine image, image collection, or feature collection.
Find GEDI granules through NASA CMR
gedifinder( product, ul_lat = NULL, ul_lon = NULL, lr_lat = NULL, lr_lon = NULL, version = NULL, daterange = NULL, access = c("https", "s3", "opendap", "all"), cloud_hosted = TRUE, return = c("url", "table"), page_size = 2000L, cloud_computing = FALSE, persist = TRUE, orbit = NULL )gedifinder( product, ul_lat = NULL, ul_lon = NULL, lr_lat = NULL, lr_lon = NULL, version = NULL, daterange = NULL, access = c("https", "s3", "opendap", "all"), cloud_hosted = TRUE, return = c("url", "table"), page_size = 2000L, cloud_computing = FALSE, persist = TRUE, orbit = NULL )
product |
One of |
ul_lat, ul_lon, lr_lat, lr_lon
|
Bounding coordinates in decimal degrees. |
version |
Product version. |
daterange |
Optional two-element date or date-time vector. |
access |
Requested link type: |
cloud_hosted |
Logical retained for backward compatibility. The current GEDI collection identifiers resolve to their Earthdata Cloud holdings. |
return |
Return a URL vector or a metadata table. |
page_size |
CMR page size. |
cloud_computing |
Logical. When |
persist |
Logical; allow Earthaccess to persist an interactive login
when |
orbit |
Optional GEDI orbit number, such as |
A character vector or data.table::data.table.
https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html
Compute metrics from GEDI or simulated full waveforms
gediWFMetrics( input, outRoot = NULL, rhRes = 5, ground = TRUE, rhoG = 0.4, rhoC = 0.57, ground_method = c("auto", "truth", "lowest_peak", "quantile"), ... )gediWFMetrics( input, outRoot = NULL, rhRes = 5, ground = TRUE, rhoG = 0.4, rhoC = 0.57, ground_method = c("auto", "truth", "lowest_peak", "quantile"), ... )
input |
A |
outRoot |
Optional output filename root. |
rhRes |
Relative-height percentile spacing. |
ground |
Logical; include the estimated ground elevation. |
rhoG, rhoC
|
Ground and canopy reflectance. |
ground_method |
Ground estimator. |
... |
Compatibility arguments from the original native implementation. |
A data.table::data.table with waveform metrics.
This portable implementation follows the core gediRat algorithm: Gaussian
footprint weighting, optional return-density normalization, vertical
binning, pulse convolution, separation of LAS class 2 ground returns, and
unit-integral normalization. Vectorized binning replaces the original point
loop while avoiding its native GSL/GDAL build stack.
gediWFSimulator( input, output = tempfile(fileext = ".h5"), ground = TRUE, ascii = FALSE, waveID = NULL, coords = NULL, listCoord = NULL, gridBound = NULL, gridStep = 30, pSigma = -1, pFWHM = 15, fSigma = 5.5, res = 0.15, decimate = 1, maxBins = 1024L, countOnly = FALSE, method = c("count", "intensity", "fraction"), normalize = TRUE, density_res = 1, intensity_threshold = 6e-04, noise = 0, keepOld = FALSE, seed = NULL, ... )gediWFSimulator( input, output = tempfile(fileext = ".h5"), ground = TRUE, ascii = FALSE, waveID = NULL, coords = NULL, listCoord = NULL, gridBound = NULL, gridStep = 30, pSigma = -1, pFWHM = 15, fSigma = 5.5, res = 0.15, decimate = 1, maxBins = 1024L, countOnly = FALSE, method = c("count", "intensity", "fraction"), normalize = TRUE, density_res = 1, intensity_threshold = 6e-04, noise = 0, keepOld = FALSE, seed = NULL, ... )
input |
LAS/LAZ paths, a |
output |
Output HDF5 path. |
ground |
Retained for compatibility; ground returns remain in the waveform. |
ascii |
Return/write a simple ASCII waveform instead of HDF5. |
waveID |
Optional waveform identifiers. |
coords |
A coordinate pair or matrix of footprint centers. |
listCoord |
Text file containing footprint centers. |
gridBound |
Optional |
gridStep |
Grid spacing in input coordinate units. |
pSigma |
Pulse sigma in meters. A negative value derives it from |
pFWHM |
Pulse full width at half maximum in nanoseconds. |
fSigma |
Footprint sigma in input coordinate units. |
res |
Vertical waveform resolution. |
decimate |
Probability of retaining an ALS return. |
maxBins |
Maximum number of waveform bins. |
countOnly |
Use count-based returns rather than ALS intensity. Gaussian footprint weights are still applied. |
method |
Waveform contribution: |
normalize |
Correct for local ALS sampling density, as in the original simulator's default behavior. |
density_res |
Cell size used for sampling-density normalization. |
intensity_threshold |
Smallest retained Gaussian footprint weight. |
noise |
Relative Gaussian noise standard deviation. For example,
|
keepOld |
Do not overwrite an existing output file. |
seed |
Optional random seed. |
... |
Compatibility arguments accepted from the original simulator. |
A gedi.level1b object, or a waveform table when ascii=TRUE.
Hancock et al. (2019) doi:10.1029/2018EA000506
GEDI polygon-stratified sampling specification
geomSampling(size, geom, split_id = NULL, lon = NULL, lat = NULL)geomSampling(size, geom, split_id = NULL, lon = NULL, lat = NULL)
size |
Number or fraction per polygon. |
geom |
Polygon object. |
split_id |
Optional polygon ID column. |
lon, lat
|
Optional coordinate column names. |
Return an Earth Engine catalog ID
get_catalog_id(x)get_catalog_id(x)
x |
A GEDI product name, catalog search row, or catalog ID. |
A character catalog ID.
Standardizes footprint coordinates, acquisition order, and beam identifiers
from any open point-level GEDI product or an extracted footprint table. The
result can be plotted directly or passed to plot_gedi_orbit_animation().
getGEDITrack( x, lon = NULL, lat = NULL, time = NULL, track = NULL, beams = NULL, every = 1L, segment_gaps = TRUE )getGEDITrack( x, lon = NULL, lat = NULL, time = NULL, track = NULL, beams = NULL, every = 1L, segment_gaps = TRUE )
x |
A data frame, |
lon, lat
|
Names of longitude and latitude columns. When |
time |
Optional name of a column used to order footprints within each
track. GEDI |
track |
Optional name of a beam or track column. Separate tracks are colored independently. |
beams |
Optional beam names to read from an open GEDI object. |
every |
Keep every nth footprint after ordering. This is useful when plotting a complete orbit. |
segment_gaps |
Append segment numbers to track names when unusually large spatial gaps occur. Animation keeps this disabled so consecutive GEDI production granules remain one beam for a complete orbit. |
A data.table::data.table with longitude, latitude, sequence,
track, and available time and shot identifiers.
shots <- data.frame( lon_lowestmode = seq(-44.2, -44.1, length.out = 10), lat_lowestmode = seq(-13.8, -13.7, length.out = 10), delta_time = seq_len(10), beam = "BEAM0000" ) getGEDITrack(shots, every = 2)shots <- data.frame( lon_lowestmode = seq(-44.2, -44.1, length.out = 10), lat_lowestmode = seq(-13.8, -13.7, length.out = 10), delta_time = seq_len(10), beam = "BEAM0000" ) getGEDITrack(shots, every = 2)
This function extracts Pulse Full Waveform Geolocations from GEDI gedi.level1b data
getLevel1BGeo( level1b, select = c("elevation_bin0", "elevation_lastbin"), beams = NULL )getLevel1BGeo( level1b, select = c("elevation_bin0", "elevation_lastbin"), beams = NULL )
level1b |
A |
select |
A character vector specifying the fields to extract from GEDI Level1B data. If NULL, by default it will extract latitude_bin0, latitude_lastbin, longitude_bin0, longitude_lastbin, and shot_number. See details for more options. |
beams |
Optional beam names. |
Additional fields to be extracted from GEDI level 1B:
all_samples_sum Sum of all values within the 10 km range window.
beam Beam number Number.
channel Channel number.
master_frac Master time, fractional part.
master_int Master time, integer part.
noise_mean_corrected Noise mean.
noise_stddev_corrected Corrected noise standard deviation.
nsemean_even Noise mean of the beam's detector channel from even sub-converter.
nsemean_odd Noise mean of the beam's odd sub-converter.
rx_energy Integrated energy in receive (RX) waveform after subtracting the noise mean.
rx_offset Time interval from first stored sample to first downloaded RX sample.
rx_open Time interval from time 0 to first stored RX sample.
rx_sample_count The number of sample intervals (elements) in each RX waveform.
rx_sample_start_index The index in the rxwaveform dataset of the first element of each RX waveform starting at 1.
selection_stretchers_x Commanded number of samples added to the algorithm section on the left.
selection_stretchers_y Commanded number of samples added to the algorithm section on the right.
shot_number Unique shot identifier.
stale_return_flag Indicates that a "stale" cue point from the coarse search algorithm is being used.
th_left_used Count values for the left threshold used in fine search where two consecutive points at or above this value indicate pulse detection.
tx_egamplitude Amplitude of the extended Gaussian fit to the transmit (TX) waveform.
tx_egamplitude_error Error on tx_egamplitude.
tx_egbias Bias of the extended Gaussian fit to the TX waveform.
tx_egbias_error Error on tx_egbias.
tx_egflag Extended Gaussian fit status flag.
tx_eggamma Gamma value of the extended Gaussian fit to the TX waveform.
tx_eggamma_error Error on tx_eggamma.
tx_egsigma Sigma of the extended Gaussian fit to the TX waveform.
tx_egsigma_error Error on tx_egsigma.
tx_gloc Location (mean) of the Gaussian fit to the TX waveform.
tx_gloc_error Error on tx_gloc.
tx_pulseflag Set to 1 if a pulse is detected in the TX waveform.
tx_sample_count The number of sample intervals (elements) in each transmit waveform.
tx_sample_start_index The index in the rxwaveform dataset of the first element of each RX waveform starting at 1.
altitude_instrument Height of the instrument diffractive optical element (DOE) above the WGS84 ellipsoid.
altitude_instrument_error Error on altitude_instrument.
bounce_time_offset_bin0 The difference between the TX time and the time at the start of the RX window.
bounce_time_offset_bin0_error Error on bounce_time_offset_bin0.
bounce_time_offset_lastbin The difference between the TX time and the time at the end of the RX window.
bounce_time_offset_lastbin_error Error on bounce_time_offset_lastbin.
degrade Greater than zero if the shot occurs during a degrade period, zero otherwise.
delta_time Transmit time of the shot, measured in seconds since 2018-01-01.
digital_elevation_model Digital elevation model height above the WGS84 ellipsoid.
elevation_bin0 Height of the start of the RX window, relative to the WGS-84 ellipsoid.
elevation_bin0_error Error on elevation_bin0.
elevation_lastbin Height of the end of the RX window, relative to the WGS-84 ellipsoid.
elevation_lastbin_error Error on elevation_lastbin.
latitude_bin0 Latitude of the start of the RX window.
latitude_bin0_error Error on latitude_bin0.
latitude_lastbin Latitude of the end of the RX window.
latitude_lastbin_error Error on latitude_lastbin.
latitude_instrument Latitude of the instrument diffractive optical element (DOE) at laser transmit time.
latitude_instrument_error Error on latitude_instrument.
local_beam_azimuth Azimuth of the unit pointing vector for the laser in the local East, North, Up (ENU) frame.
local_beam_azimuth_error Error on local_beam_azimuth.
local_beam_elevation Elevation of the unit pointing vector for the laser in the local ENU frame.
local_beam_elevation_error Error on local_beam_elevation.
longitude_bin0 Longitude of the start of the RX window.
longitude_bin0_error Error on longitude_bin0.
longitude_lastbin Longitude of the end of the RX window.
longitude_lastbin_error Error on longitude_lastbin.
longitude_instrument Longitude of the instrument diffractive optical element (DOE) at laser transmit time.
longitude_instrument_error Error on longitude_instrument.
mean_sea_surface Mean sea surface height above the WGS84 ellipsoid, includes the geoid .
neutat_delay_derivative_bin0 Change in neutral atmospheric delay per height change for the start of the RX window.
neutat_delay_derivative_lastbin Change in neutral atmospheric delay per height change for the end of the RX window.
neutat_delay_total_bin0 Total neutral atmosphere delay correction (wet+dry) from the TX pulse to the start of the RX window.
neutat_delay_total_lastbin Total neutral atmosphere delay correction (wet+dry) from the TX pulse to the end of the RX window.
range_bias_correction The range bias applied to the range measurement.
shot_number Unique shot identifier Number.
solar_azimuth The azimuth of the sun position vector.
solar_elevation The elevation of the sun position vector.
surface_type Flags describing which surface types.
dynamic_atmosphere_correction Dynamic Atmospheric Correction (DAC) includes inverted barometer (IB) effect.
geoid Geoid height above WGS-84 reference ellipsoid.
tide_earth Solid Earth tides.
tide_load Load Tide - Local displacement due to Ocean Loading.
tide_ocean Ocean Tides including diurnal and semi-diurnal, and longerperiod tides.
tide_ocean_pole Oceanic surface rotational deformation due to polar motion.
tide_pole Solid Earth Pole Tide. Rotational deformation due to polar motion.
Returns an S4 object of class data.table::data.table containing the GEDI Full Waveform Geolocations
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi01-b-002
# specify the path to GEDI level1B data (zip file) outdir = tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package="rGEDI") # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip,exdir = outdir) # Reading GEDI level1B data (h5 file) level1b<-readLevel1B(level1Bpath=level1Bpath) # Extracting GEDI level1B geolocations level1bGeo<-getLevel1BGeo(level1b,select=c("elevation_bin0", "elevation_lastbin")) head(level1bGeo) close(level1b)# specify the path to GEDI level1B data (zip file) outdir = tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package="rGEDI") # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip,exdir = outdir) # Reading GEDI level1B data (h5 file) level1b<-readLevel1B(level1Bpath=level1Bpath) # Extracting GEDI level1B geolocations level1bGeo<-getLevel1BGeo(level1b,select=c("elevation_bin0", "elevation_lastbin")) head(level1bGeo) close(level1b)
This function extracts the full waveform of a given pulse from GEDI Level1B data.
getLevel1BWF(level1b, shot_number)getLevel1BWF(level1b, shot_number)
level1b |
A GEDI Level1B object (output of |
shot_number |
Shot number. A scalar representing the shot number of a giving pulse. |
Shot numbers can be extracted using readLevel1B function.
Returns an S4 object of class "gedi.fullwaveform".
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi01-b-002
# Specifying the path to GEDI level1B data (zip file) outdir = tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package="rGEDI") # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip,exdir = outdir) # Reading GEDI level1B data (h5 file) level1b<-readLevel1B(level1Bpath=level1Bpath) # Extracting GEDI full waveform for a giving shotnumber wf <- getLevel1BWF(level1b, shot_number="19640521100108408") # Plotting GEDI Full waveform oldpar<-par() par(mfrow = c(1,2), cex.axis = 1.5) plot(wf, relative=FALSE, polygon=TRUE, type="l", lwd=2, col="forestgreen", xlab="Waveform Amplitude", ylab="Elevation (m)") plot(wf, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="forestgreen", xlab="Waveform Amplitude (%)", ylab="Elevation (m)") par(oldpar) close(level1b)# Specifying the path to GEDI level1B data (zip file) outdir = tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package="rGEDI") # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip,exdir = outdir) # Reading GEDI level1B data (h5 file) level1b<-readLevel1B(level1Bpath=level1Bpath) # Extracting GEDI full waveform for a giving shotnumber wf <- getLevel1BWF(level1b, shot_number="19640521100108408") # Plotting GEDI Full waveform oldpar<-par() par(mfrow = c(1,2), cex.axis = 1.5) plot(wf, relative=FALSE, polygon=TRUE, type="l", lwd=2, col="forestgreen", xlab="Waveform Amplitude", ylab="Elevation (m)") plot(wf, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="forestgreen", xlab="Waveform Amplitude (%)", ylab="Elevation (m)") par(oldpar) close(level1b)
This function extracts Elevation and Relative Height (RH) metrics from GEDI Level2A data.
getLevel2AM(level2a, beams = NULL, include_rh = TRUE)getLevel2AM(level2a, beams = NULL, include_rh = TRUE)
level2a |
A GEDI Level2A object (output of |
beams |
Optional beam names. |
include_rh |
Logical. Include the 101 relative-height columns. Set to
|
Characteristics. Flag indicating likely invalid waveform (1=valid, 0=invalid).
beam Beam identifier
shot_number Shot number
degrade_flag Flag indicating degraded state of pointing and/or positioning information
quality_flag Flag simplifying selection of most useful data
delta_time Transmit time of the shot since Jan 1 00:00 2018
sensitivity Maxmimum canopy cover that can be penetrated
solar_elevation Solar elevation
lat_lowestmode Latitude of center of lowest mode
lon_lowestmode Longitude of center of lowest mode
elev_highestreturn Elevation of highest detected return relative to reference ellipsoid Meters
elev_lowestmode Elevation of center of lowest mode relative to reference ellipsoid
rh Relative height metrics at 1% interval
Returns an S4 object of class data.table::data.table containing the elevation and relative heights metrics.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-a-002
# Specifying the path to GEDI level2A data (zip file) outdir = tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip,exdir = outdir) # Reading GEDI level2A data (h5 file) level2a<-readLevel2A(level2Apath=level2Apath) # Extracting GEDI Elevation and Height Metrics level2AM<-getLevel2AM(level2a) head(level2AM) close(level2a)# Specifying the path to GEDI level2A data (zip file) outdir = tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip,exdir = outdir) # Reading GEDI level2A data (h5 file) level2a<-readLevel2A(level2Apath=level2Apath) # Extracting GEDI Elevation and Height Metrics level2AM<-getLevel2AM(level2a) head(level2AM) close(level2a)
This function extracts the Plant Area Index (PAI) Profile from GEDI Level2B data.
getLevel2BPAIProfile(level2b, beams = NULL)getLevel2BPAIProfile(level2b, beams = NULL)
level2b |
A GEDI Level2B object (output of |
beams |
Optional beam names. |
Characteristics. Flag indicating likely invalid waveform (1=valid, 0=invalid).
beam Beam identifier
shot_number Shot number
algorithmrun_flag The L2B algorithm is run if this flag is set to 1 indicating data have sufficient waveform fidelity for L2B to run
l2b_quality_flag L2B quality flag
delta_time Transmit time of the shot since Jan 1 00:00 2018
lat_lowestmode Latitude of center of lowest mode
lon_lowestmode Longitude of center of lowest mode
elev_highestreturn Elevation of highest detected return relative to reference ellipsoid
elev_lowestmode Elevation of center of lowest mode relative to reference ellipsoid
height_lastbin Height of the last bin of the pgap_theta_z, relative to the ground
pai_z Plant Area Index profile
Returns an S4 object of class data.table::data.table containing the elevation and relative heights.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# Specifying the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Extracting GEDI Plant Area Index (PAI) Profile (GEDI Level2B) level2BPAIProfile<-getLevel2BPAIProfile(level2b) head(level2BPAIProfile) close(level2b)# Specifying the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Extracting GEDI Plant Area Index (PAI) Profile (GEDI Level2B) level2BPAIProfile<-getLevel2BPAIProfile(level2b) head(level2BPAIProfile) close(level2b)
This function extracts the Plant Area Volume Density (PAVD) Profile from GEDI Level2B data.
getLevel2BPAVDProfile(level2b, beams = NULL)getLevel2BPAVDProfile(level2b, beams = NULL)
level2b |
A GEDI Level2B object (output of |
beams |
Optional beam names. |
Characteristics. Flag indicating likely invalid waveform (1=valid, 0=invalid).
beam Beam identifier
shot_number Shot number
algorithmrun_flag The L2B algorithm is run if this flag is set to 1 indicating data have sufficient waveform fidelity for L2B to run
l2b_quality_flag L2B quality flag
delta_time Transmit time of the shot since Jan 1 00:00 2018
lat_lowestmode Latitude of center of lowest mode
lon_lowestmode Longitude of center of lowest mode
elev_highestreturn Elevation of highest detected return relative to reference ellipsoid
elev_lowestmode Elevation of center of lowest mode relative to reference ellipsoid
height_lastbin Height of the last bin of the pgap_theta_z, relative to the ground
pavd_z Plant Area Volume Density profile
Returns an S4 object of class data.table::data.table containing the Plant Area Volume Density Index.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# Specifying the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Extracting GEDI Plant Area Volume Density (PAVD) Index level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) head(level2BPAVDProfile) close(level2b)# Specifying the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Extracting GEDI Plant Area Volume Density (PAVD) Index level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) head(level2BPAVDProfile) close(level2b)
This function extracts information from GEDI Level2B data: Total Plant Area Index, Foliage Height Diversity, Foliage Clumping Index, Total Gap Probability (theta), and Total canopy cover.
getLevel2BVPM( level2b, cols = c("beam", "shot_number", "algorithmrun_flag", "l2b_quality_flag", "delta_time", "sensitivity", "solar_elevation", "latitude_lastbin", "latitude_bin0", "longitude_bin0", "longitude_lastbin", "elev_highestreturn", "elev_lowestmode", "rh100", "pai", "fhd_normal", "omega", "pgap_theta", "cover"), beams = NULL )getLevel2BVPM( level2b, cols = c("beam", "shot_number", "algorithmrun_flag", "l2b_quality_flag", "delta_time", "sensitivity", "solar_elevation", "latitude_lastbin", "latitude_bin0", "longitude_bin0", "longitude_lastbin", "elev_highestreturn", "elev_lowestmode", "rh100", "pai", "fhd_normal", "omega", "pgap_theta", "cover"), beams = NULL )
level2b |
A GEDI Level2B object (output of |
cols |
A character vector containing the list of columns to be extracted. See the default columns in the description. |
beams |
Optional beam names. |
These are the biophysical variables and additional information extracted by default:
beam Beam identifier
shot_number Shot number
algorithmrun_flag The L2B algorithm is run if this flag is set to 1 indicating data have sufficient waveform fidelity for L2B to run
l2b_quality_flag L2B quality flag
delta_time Transmit time of the shot since Jan 1 00:00 2018
sensitivity Maxmimum canopy cover that can be penetrated
solar_elevation Solar elevation
latitude_lastbin Latitude of last bin of the pgap_theta_z, interpolated from L1B waveform coordinate
latitude_bin0 Latitude of first bin of the pgap_theta_z, interpolated from L1B waveform coordinate
elev_highestreturn Elevation of highest detected return relative to reference ellipsoid
elev_lowestmode Elevation of center of lowest mode relative to reference ellipsoid
rh100 RH100 slice
pai Total Plant Area Index
fhd_normal Foliage Height Diversity
omega Foliage Clumping Index
pgap_theta Total Gap Probability (theta)
cover Total canopy cover
Every other columns in the GEDI2B product are also available, you can specify each column by using the cols parameter.
Returns an S4 object of class data.table::data.table containing the Vegetation Profile Biophysical Variables.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# Specifying the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Extracting GEDI Vegetation Profile Biophysical Variables level2BVPM<-getLevel2BVPM(level2b, cols=c("beam", "shot_number")) head(level2BVPM) close(level2b)# Specifying the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Extracting GEDI Vegetation Profile Biophysical Variables level2BVPM<-getLevel2BVPM(level2b, cols=c("beam", "shot_number")) head(level2BVPM) close(level2b)
Extract GEDI Level 4A footprint metrics
getLevel4A( level4a, cols = .level4a_default_columns, quality = FALSE, beams = NULL )getLevel4A( level4a, cols = .level4a_default_columns, quality = FALSE, beams = NULL )
level4a |
A |
cols |
Character vector of fields to return. |
quality |
Logical. If
Legacy Release 2 quality fields remain supported. |
beams |
Optional character vector of GEDI beam names. |
A data.table::data.table with one row per footprint.
Get an Earth Engine image tile URL
getTileUrl(image, vis = list())getTileUrl(image, vis = list())
image |
Earth Engine image. |
vis |
Visualization parameter list. |
Character tile URL.
Earth Engine gray-level co-occurrence textures
glcmTexture(x, size = 1L, kernel = NULL, average = TRUE)glcmTexture(x, size = 1L, kernel = NULL, average = TRUE)
x |
Earth Engine integer image. |
size |
Neighborhood size. |
kernel |
Optional Earth Engine kernel. |
average |
Average directional metrics. |
An Earth Engine image.
GEDI grid-stratified sampling specification
gridSampling(size, grid_size, lon = NULL, lat = NULL)gridSampling(size, grid_size, lon = NULL, lat = NULL)
size |
Number or fraction per cell. |
grid_size |
Grid size in decimal degrees. |
lon, lat
|
Optional coordinate column names. |
This function computes a series of user defined descriptive statistics within each grid cell for GEDI derived Elevation and Height Metrics (Level2A)
gridStatsLevel2AM(level2AM, func, res)gridStatsLevel2AM(level2AM, func, res)
level2AM |
A GEDI Level2AM object (output of |
func |
The function(s) to be applied to each cell |
res |
Spatial resolution in decimal degrees for the output stars raster layer |
Return a stars raster layer(s) of selected GEDI Elevation and Height Metric(s)
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-a-002
## Not run: # specify the path to GEDI level2A data (zip file) outdir <- tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Get GEDI derived Elevation and Height Metrics level2AM <- getLevel2AM(level2a) head(level2AM) #' Define your own function mySetOfMetrics <- function(x) { metrics <- list( min = min(x), # Min of z max = max(x), # Max of z mean = mean(x), # Mean of z sd = sd(x) # Sd of z ) return(metrics) } #' Computing a serie of GEDI metrics ZTstats <- gridStatsLevel2AM( level2AM = level2AM, func = mySetOfMetrics(elev_highestreturn), res = 0.005 ) if (interactive()) plot(ZTstats) if (interactive()) { # Computing the maximum of RH100 only maxRH100 <- gridStatsLevel2AM(level2AM, mySetOfMetrics(rh100), res = 0.0005) plot(maxRH100) # Computing the mean of ZG only ZGmean <- gridStatsLevel2AM(level2AM, mean(elev_lowestmode), res = 0.005) plot(ZGmean) } close(level2a) ## End(Not run)## Not run: # specify the path to GEDI level2A data (zip file) outdir <- tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Get GEDI derived Elevation and Height Metrics level2AM <- getLevel2AM(level2a) head(level2AM) #' Define your own function mySetOfMetrics <- function(x) { metrics <- list( min = min(x), # Min of z max = max(x), # Max of z mean = mean(x), # Mean of z sd = sd(x) # Sd of z ) return(metrics) } #' Computing a serie of GEDI metrics ZTstats <- gridStatsLevel2AM( level2AM = level2AM, func = mySetOfMetrics(elev_highestreturn), res = 0.005 ) if (interactive()) plot(ZTstats) if (interactive()) { # Computing the maximum of RH100 only maxRH100 <- gridStatsLevel2AM(level2AM, mySetOfMetrics(rh100), res = 0.0005) plot(maxRH100) # Computing the mean of ZG only ZGmean <- gridStatsLevel2AM(level2AM, mean(elev_lowestmode), res = 0.005) plot(ZGmean) } close(level2a) ## End(Not run)
This function computes a series of user defined descriptive statistics within each grid cell for GEDI derived Canopy Cover and Vertical Profile Metrics (Level2B)
gridStatsLevel2BVPM(level2BVPM, func, res)gridStatsLevel2BVPM(level2BVPM, func, res)
level2BVPM |
A GEDI Level2AM object (output of |
func |
The function(s) to be applied to each cell |
res |
Spatial resolution in decimal degrees for the output stars raster layer |
Returns a stars raster layer(s) of selected GEDI Canopy Cover and Vertical Profile Metric(s)
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
## Not run: # specify the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Get GEDI derived Canopy Cover and Vertical Profile Metrics level2BVPM <- getLevel2BVPM(level2b) head(level2BVPM) #' Define your own function mySetOfMetrics <- function(x) { metrics <- list( min = min(x), # Min of z max = max(x), # Max of z mean = mean(x), # Mean of z sd = sd(x) # Sd of z ) return(metrics) } #' Computing a serie of statistics of GEDI derived canopy cover cover_stats <- gridStatsLevel2BVPM( level2BVPM = level2BVPM, func = mySetOfMetrics(cover), res = 0.005 ) plot(cover_stats) #' Computing the max of the Total Plant Area Index only pai_max <- gridStatsLevel2BVPM(level2BVPM = level2BVPM, func = max(pai), res = 0.005) plot(pai_max) #' Computing the Foliage Height Diversity Index only fhd_mean <- gridStatsLevel2BVPM(level2BVPM = level2BVPM, func = mean(fhd_normal), res = 0.005) plot(fhd_mean) close(level2b) ## End(Not run)## Not run: # specify the path to GEDI level2B data (zip file) outdir <- tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip, exdir = outdir) # Reading GEDI level2B data (h5 file) level2b <- readLevel2B(level2Bpath = level2Bpath) # Get GEDI derived Canopy Cover and Vertical Profile Metrics level2BVPM <- getLevel2BVPM(level2b) head(level2BVPM) #' Define your own function mySetOfMetrics <- function(x) { metrics <- list( min = min(x), # Min of z max = max(x), # Max of z mean = mean(x), # Mean of z sd = sd(x) # Sd of z ) return(metrics) } #' Computing a serie of statistics of GEDI derived canopy cover cover_stats <- gridStatsLevel2BVPM( level2BVPM = level2BVPM, func = mySetOfMetrics(cover), res = 0.005 ) plot(cover_stats) #' Computing the max of the Total Plant Area Index only pai_max <- gridStatsLevel2BVPM(level2BVPM = level2BVPM, func = max(pai), res = 0.005) plot(pai_max) #' Computing the Foliage Height Diversity Index only fhd_mean <- gridStatsLevel2BVPM(level2BVPM = level2BVPM, func = mean(fhd_normal), res = 0.005) plot(fhd_mean) close(level2b) ## End(Not run)
Grid GEDI Level 4A footprint metrics
gridStatsLevel4A(level4A, metric = "agbd", fun = mean, res = 0.01, ...)gridStatsLevel4A(level4A, metric = "agbd", fun = mean, res = 0.01, ...)
level4A |
A table returned by |
metric |
Metric column name. |
fun |
Aggregation function. |
res |
Output resolution in decimal degrees. |
... |
Additional arguments passed to |
Apply an Earth Engine model to a predictor image
map_create(model, stack, aoi = NULL, name = "prediction")map_create(model, stack, aoi = NULL, name = "prediction")
model |
A trained Earth Engine classifier or regressor. |
stack |
Earth Engine predictor image. |
aoi |
Optional area to clip. |
name |
Output band name. |
An Earth Engine image.
Download an Earth Engine image
map_download( image, filename, region, scale = 30, crs = "EPSG:4326", overwrite = FALSE )map_download( image, filename, region, scale = 30, crs = "EPSG:4326", overwrite = FALSE )
image |
Earth Engine image. |
filename |
Destination GeoTIFF path. |
region |
Area of interest. |
scale |
Pixel size in meters. |
crs |
Output CRS. |
overwrite |
Logical. |
Invisibly returns filename.
Display Earth Engine layers in Leaflet
map_view(layers, vis = list(), aoi = NULL)map_view(layers, vis = list(), aoi = NULL)
layers |
Named list of Earth Engine images. |
vis |
Named list of visualization parameter lists. |
aoi |
Optional spatial object used to fit map bounds. |
A Leaflet widget.
Mosaic GEDI Level 3 rasters
mosaicLevel3(x, fun = "mean", filename = "", overwrite = FALSE)mosaicLevel3(x, fun = "mean", filename = "", overwrite = FALSE)
x |
Raster paths, a |
fun |
Function used for overlapping cells. |
filename |
Optional output filename. |
overwrite |
Logical. |
Mosaic GEDI Level 4B rasters
mosaicLevel4B(x, fun = "mean", filename = "", overwrite = FALSE)mosaicLevel4B(x, fun = "mean", filename = "", overwrite = FALSE)
x |
Raster paths, a |
fun |
Function used for overlapping cells. |
filename |
Optional output filename. |
overwrite |
Logical. |
Raster products are opened with GDAL through terra::rast(). HDF5 cloud
granules are opened lazily with Python earthaccess and h5py.
openGEDI(x, product = NULL, stream = TRUE, cache_dir = tempdir())openGEDI(x, product = NULL, stream = TRUE, cache_dir = tempdir())
x |
Local path, HTTPS URL, S3 URI, OPeNDAP URL, or an Earthaccess granule. |
product |
Optional product identifier. |
stream |
Logical; stream raster data rather than download it. |
cache_dir |
Download directory for non-streamed data. |
A SpatRaster, gedi.cloud_h5, or local GEDI object.
Creates an interactive 3D HTML animation or an animated GIF from GEDI footprint coordinates. The presentation follows the ICESat2VegR orbit animation, with a rotating Earth, a NASA ISS illustration carrying GEDI, and a red near-infrared laser and ground track. ISS motion follows the time-ordered geolocation of the most complete beam extracted from the supplied HDF5 object.
plot_gedi_orbit_animation( x, lon = NULL, lat = NULL, time = NULL, track = NULL, output_file = tempfile("rGEDI-orbit-", fileext = ".html"), title = "GEDI orbit animation", duration = 18, launch = interactive(), track_speed = 2, earth_rotation_speed = 2, beams = NULL, every = 1L )plot_gedi_orbit_animation( x, lon = NULL, lat = NULL, time = NULL, track = NULL, output_file = tempfile("rGEDI-orbit-", fileext = ".html"), title = "GEDI orbit animation", duration = 18, launch = interactive(), track_speed = 2, earth_rotation_speed = 2, beams = NULL, every = 1L )
x |
A data frame, |
lon, lat
|
Names of longitude and latitude columns. When |
time |
Optional name of a column used to order footprints within each
track. GEDI |
track |
Optional name of a beam or track column. Separate tracks are colored independently. |
output_file |
Path of the |
title |
Title shown above the animation. |
duration |
Duration of one animation cycle in seconds. |
launch |
Open the animation in the default browser after it is written. |
track_speed |
Initial HTML track playback speed from 1 to 15. |
earth_rotation_speed |
Initial Earth rotation speed from 0 to 20. |
beams |
Optional beam names to read from open GEDI objects. |
every |
Keep every nth footprint after ordering. Increase this for a complete orbit to reduce animation size and rendering time. |
The normalized path to the HTML file, invisibly.
orbit <- data.frame( longitude = seq(-60, -45, length.out = 30), latitude = seq(-8, 5, length.out = 30), delta_time = seq_len(30), beam = "BEAM0101" ) html <- plot_gedi_orbit_animation( orbit, output_file = tempfile(fileext = ".html") ) file.exists(html)orbit <- data.frame( longitude = seq(-60, -45, length.out = 30), latitude = seq(-8, 5, length.out = 30), delta_time = seq_len(30), beam = "BEAM0101" ) html <- plot_gedi_orbit_animation( orbit, output_file = tempfile(fileext = ".html") ) file.exists(html)
For gedi.fullwaveform: will plot the full waveform
## S4 method for signature 'gedi.fullwaveform,missing' plot(x, relative = FALSE, polygon = FALSE, ...)## S4 method for signature 'gedi.fullwaveform,missing' plot(x, relative = FALSE, polygon = FALSE, ...)
x |
An object of class |
relative |
if TRUE, the Waveform Amplitude will be showed in percentage (%) |
polygon |
if TRUE, the polygon will be added to the plot |
... |
will be passed to the main plot |
No return value
# Specifying the path to GEDI level1B data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Extracting GEDI Full-Waveform wf <- getLevel1BWF(level1b, shot_number = "19640521100108408") # Plotting GEDI Full-waveform oldpar <- par() par(mfrow = c(1, 2), cex.axis = 1.5) plot(wf, relative = FALSE, polygon = TRUE, type = "l", lwd = 2, col = "forestgreen", xlab = "", ylab = "Elevation (m)" ) rGEDI::plot(wf, relative = TRUE, polygon = TRUE, type = "l", lwd = 2, col = "forestgreen", xlab = "Waveform Amplitude (%)", ylab = "Elevation (m)" ) par(oldpar) close(level1b)# Specifying the path to GEDI level1B data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) # Reading GEDI level1B data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) # Extracting GEDI Full-Waveform wf <- getLevel1BWF(level1b, shot_number = "19640521100108408") # Plotting GEDI Full-waveform oldpar <- par() par(mfrow = c(1, 2), cex.axis = 1.5) plot(wf, relative = FALSE, polygon = TRUE, type = "l", lwd = 2, col = "forestgreen", xlab = "", ylab = "Elevation (m)" ) rGEDI::plot(wf, relative = TRUE, polygon = TRUE, type = "l", lwd = 2, col = "forestgreen", xlab = "Waveform Amplitude (%)", ylab = "Elevation (m)" ) par(oldpar) close(level1b)
Plot GEDI variable selection results
## S3 method for class 'gedi_var_selection' plot(x, which = c("importance", "rfe"), ...)## S3 method for class 'gedi_var_selection' plot(x, which = c("importance", "rfe"), ...)
x |
A |
which |
Plot variable importance or RFE error. |
... |
Additional graphical parameters. |
The object, invisibly.
Plot GEDI Level 3 metrics
plotLevel3(x, ...)plotLevel3(x, ...)
x |
A raster path or |
... |
Passed to |
Invisibly returns the raster.
Plot GEDI Level 4A footprint biomass
plotLevel4A(level4A, metric = "agbd", ...)plotLevel4A(level4A, metric = "agbd", ...)
level4A |
A table returned by |
metric |
Metric column to display. |
... |
Additional arguments passed to |
Invisibly returns level4A.
Plot GEDI Level 4B metrics
plotLevel4B(x, ...)plotLevel4B(x, ...)
x |
A raster path or |
... |
Passed to |
Invisibly returns the raster.
This functions plots Plant Area Index (PAI) Profile (GEDI level2B)
plotPAIProfile(level2BPAIProfile, beam = "BEAM0101", elev = TRUE)plotPAIProfile(level2BPAIProfile, beam = "BEAM0101", elev = TRUE)
level2BPAIProfile |
A GEDI Level2B object (output of |
beam |
Select GEDI beam. Default is "BEAM0101". See details section. |
elev |
If TRUE, elevation will be used for plotting the PAI profile. Otherwise, height will be used instead. |
list of GEDI beams. See the output of getLevel2BPAIProfile() function.
BEAM0000
BEAM0001
BEAM0010
BEAM0011
BEAM0101
BEAM0110
BEAM1000
BEAM1011
Returns a ggplot object. See ggplot2::ggplot package.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# specify the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Get Plant Area Volume Density profile level2BPAIProfile<-getLevel2BPAIProfile(level2b) # Plot Level2B PAI Profile gprofile<-plotPAIProfile(level2BPAIProfile, beam="BEAM0101", elev=TRUE) close(level2b)# specify the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Get Plant Area Volume Density profile level2BPAIProfile<-getLevel2BPAIProfile(level2b) # Plot Level2B PAI Profile gprofile<-plotPAIProfile(level2BPAIProfile, beam="BEAM0101", elev=TRUE) close(level2b)
This functions plots Plant Area Volume Density profile (GEDI level2B)
plotPAVDProfile(level2BPAVDProfile, beam = "BEAM0101", elev = TRUE)plotPAVDProfile(level2BPAVDProfile, beam = "BEAM0101", elev = TRUE)
level2BPAVDProfile |
A GEDI Level2B object (output of |
beam |
Select GEDI beam. Default is "BEAM0101". See details section. |
elev |
If TRUE, elevation will be used for plotting the PAVD profile. Otherwise, height will be used instead. |
list of GEDI beams. See the output of getLevel2BPAVDProfile() function.
BEAM0000
BEAM0001
BEAM0010
BEAM0011
BEAM0101
BEAM0110
BEAM1000
BEAM1011
Returns a ggplot object. See ggplot2::ggplot package.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# specify the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Get Plant Area Volume Density profile level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) # Plot Level2B PAVD Profile gprofile<-plotPAVDProfile(level2BPAVDProfile, beam="BEAM0101", elev=TRUE) close(level2b)# specify the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) # Get Plant Area Volume Density profile level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) # Plot Level2B PAVD Profile gprofile<-plotPAVDProfile(level2BPAVDProfile, beam="BEAM0101", elev=TRUE) close(level2b)
Plots the waveform with overlaid RH metrics
plotWFMetrics(level1b, level2a, shot_number, rh=c(25, 50, 75),...)plotWFMetrics(level1b, level2a, shot_number, rh=c(25, 50, 75),...)
level1b |
A GEDI Level1B object (output of |
level2a |
A GEDI Level2A object (output of |
shot_number |
Shot number. A scalar representing the shot number of a giving pulse. |
rh |
Integer vector. Specify which RH metrics to plot except rh0 and rh100, default c(25, 50, 75). |
... |
Will be passed to the main plot. |
Nothing
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# specify the path to GEDI level1B and Level2A data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level1B and Level2A data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) level2a <- readLevel2A(level2Apath = level2Apath) shot_number <- "19640521100108408" plotWFMetrics(level1b, level2a, shot_number, rh = c(25, 50, 75, 90)) close(level1b) close(level2a)# specify the path to GEDI level1B and Level2A data (zip file) outdir <- tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package = "rGEDI" ) level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip, exdir = outdir) level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level1B and Level2A data (h5 file) level1b <- readLevel1B(level1Bpath = level1Bpath) level2a <- readLevel2A(level2Apath = level2Apath) shot_number <- "19640521100108408" plotWFMetrics(level1b, level2a, shot_number, rh = c(25, 50, 75, 90)) close(level1b) close(level2a)
Computes a Series of Statistics from GEDI derived Elevation and Height Metrics (Level2A) within a given area defined or not by a polygon
polyStatsLevel2AM(level2AM, func, id=NULL)polyStatsLevel2AM(level2AM, func, id=NULL)
level2AM |
A GEDI Level2AM object (output of |
func |
The function to be applied for computing the defined statistics |
id |
A vector containing the polygon id for each GEDI observation. Default is NULL |
Returns an S4 object of class data.table::data.table Containing Statistics of GEDI level2A defined metrics
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-a-002
# Specifying the path to GEDI level2A data (zip file) outdir <- tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Extracting GEDI Eleveation and Relative Metrics (level2A) level2AM <- getLevel2AM(level2a) head(level2AM) # Clipping GEDI data by geometry level2AM_clip <- clipLevel2AMGeometry(level2AM, polygon, split_by = "id") #' Define your own function mySetOfMetrics <- function(x) { metrics <- list( min = min(x), # Min of x max = max(x), # Max of x mean = mean(x), # Mean of x sd = sd(x) # Sd of x ) return(metrics) } # Computing the maximum of RH100 RH100max <- polyStatsLevel2AM(level2AM_clip, func = max(rh100)) # Computing the maximum of RH100 stratified by polygon RH100max_poly <- polyStatsLevel2AM(level2AM_clip, func = max(rh100), id = "id") # Computing a serie statistics for GEDI metrics stratified by polygon RH100metrics <- polyStatsLevel2AM(level2AM_clip, func = mySetOfMetrics(rh100), id = "id" ) head(RH100metrics) close(level2a)# Specifying the path to GEDI level2A data (zip file) outdir <- tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package = "rGEDI" ) # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip, exdir = outdir) # Reading GEDI level2A data (h5 file) level2a <- readLevel2A(level2Apath = level2Apath) # Specifying the path to shapefile polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package = "rGEDI") # Reading shapefile as sf object library(sf) polygon <- sf::st_read(polygon_filepath) # Extracting GEDI Eleveation and Relative Metrics (level2A) level2AM <- getLevel2AM(level2a) head(level2AM) # Clipping GEDI data by geometry level2AM_clip <- clipLevel2AMGeometry(level2AM, polygon, split_by = "id") #' Define your own function mySetOfMetrics <- function(x) { metrics <- list( min = min(x), # Min of x max = max(x), # Max of x mean = mean(x), # Mean of x sd = sd(x) # Sd of x ) return(metrics) } # Computing the maximum of RH100 RH100max <- polyStatsLevel2AM(level2AM_clip, func = max(rh100)) # Computing the maximum of RH100 stratified by polygon RH100max_poly <- polyStatsLevel2AM(level2AM_clip, func = max(rh100), id = "id") # Computing a serie statistics for GEDI metrics stratified by polygon RH100metrics <- polyStatsLevel2AM(level2AM_clip, func = mySetOfMetrics(rh100), id = "id" ) head(RH100metrics) close(level2a)
Computes a Series of Statistics of GEDI derived Canopy Cover and Vertical Profile metrics within a given area defined or not by a polygon
polyStatsLevel2BVPM(level2BVPM, func, id=NULL)polyStatsLevel2BVPM(level2BVPM, func, id=NULL)
level2BVPM |
A GEDI Level2BVPM object (output of |
func |
The function to be applied for computing the defined statistics |
id |
A vector containing the polygon id for each GEDI observation. Default is NULL |
Returns an S4 object of class data.table::data.table Containing Statistics of GEDI level2BVPM defined metrics
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-b-002
# A small extracted Level 2B table level2BVPM <- data.table::data.table( pai = c(1.1, 1.8, 2.2, 0.9, 1.5, 2.4), cover = c(0.31, 0.44, 0.52, 0.27, 0.39, 0.58), poly_id = rep(c("stand_1", "stand_2"), each = 3) ) head(level2BVPM) # Define your own function mySetOfMetrics <- function(x) { metrics <- list( min = min(x), # Min of x max = max(x), # Max of x mean = mean(x), # Mean of x sd = sd(x) # Sd of x ) return(metrics) } # Computing the max of the Total Plant Area Index pai_max <- polyStatsLevel2BVPM(level2BVPM, func = max(pai), id = NULL) pai_max # Computing the max of the Total Plant Area Index stratified by polygon pai_max_poly <- polyStatsLevel2BVPM(level2BVPM, func = max(pai), id = "poly_id") head(pai_max_poly) # Computing the serie of statistics of canopy cover stratified by polygon cover_metrics <- polyStatsLevel2BVPM(level2BVPM, func = mySetOfMetrics(cover), id = "poly_id" ) head(cover_metrics)# A small extracted Level 2B table level2BVPM <- data.table::data.table( pai = c(1.1, 1.8, 2.2, 0.9, 1.5, 2.4), cover = c(0.31, 0.44, 0.52, 0.27, 0.39, 0.58), poly_id = rep(c("stand_1", "stand_2"), each = 3) ) head(level2BVPM) # Define your own function mySetOfMetrics <- function(x) { metrics <- list( min = min(x), # Min of x max = max(x), # Max of x mean = mean(x), # Mean of x sd = sd(x) # Sd of x ) return(metrics) } # Computing the max of the Total Plant Area Index pai_max <- polyStatsLevel2BVPM(level2BVPM, func = max(pai), id = NULL) pai_max # Computing the max of the Total Plant Area Index stratified by polygon pai_max_poly <- polyStatsLevel2BVPM(level2BVPM, func = max(pai), id = "poly_id") head(pai_max_poly) # Computing the serie of statistics of canopy cover stratified by polygon cover_metrics <- polyStatsLevel2BVPM(level2BVPM, func = mySetOfMetrics(cover), id = "poly_id" ) head(cover_metrics)
Polygon summaries of GEDI Level 3 metrics
polyStatsLevel3(x, y, fun = mean, na.rm = TRUE, ...)polyStatsLevel3(x, y, fun = mean, na.rm = TRUE, ...)
x |
A raster path or |
y |
Points or polygons accepted by |
fun |
Summary function. |
na.rm |
Logical. |
... |
Passed to |
A data frame.
Polygon statistics for GEDI Level 4A footprints
polyStatsLevel4A(level4A, polygon, metric = "agbd", fun = mean, id = NULL, ...)polyStatsLevel4A(level4A, polygon, metric = "agbd", fun = mean, id = NULL, ...)
level4A |
A table returned by |
polygon |
An |
metric |
Metric column name. |
fun |
Aggregation function. |
id |
Optional polygon ID field. |
... |
Additional arguments passed to |
A data table with one row per polygon.
Polygon summaries of GEDI Level 4B metrics
polyStatsLevel4B(x, y, fun = mean, na.rm = TRUE, ...)polyStatsLevel4B(x, y, fun = mean, na.rm = TRUE, ...)
x |
A raster path or |
y |
Points or polygons accepted by |
fun |
Summary function. |
na.rm |
Logical. |
... |
Passed to |
A data frame.
Predict GEDI footprint values
predictGEDI(model, data, name = "prediction")predictGEDI(model, data, name = "prediction")
model |
A |
data |
Predictor table. |
name |
Output column name. |
A data table containing input data and predictions.
Predict values and write them to HDF5
predictGEDIH5(model, data, output, dataset = "prediction")predictGEDIH5(model, data, output, dataset = "prediction")
model |
A |
data |
Predictor table. |
output |
Output HDF5 filename. |
dataset |
Dataset name. |
Invisibly returns output.
Project a GEDI Level 3 raster
projectLevel3(x, crs, method = "bilinear", ...)projectLevel3(x, crs, method = "bilinear", ...)
x |
A raster path or |
crs |
Target CRS. |
method |
Resampling method. |
... |
Passed to |
Project a GEDI Level 4B raster
projectLevel4B(x, crs, method = "bilinear", ...)projectLevel4B(x, crs, method = "bilinear", ...)
x |
A raster path or |
crs |
Target CRS. |
method |
Resampling method. |
... |
Passed to |
GEDI random sampling specification
randomSampling(size)randomSampling(size)
size |
Number or fraction of observations to select. |
Rasterize GEDI footprint data
rasterizeGEDI(x, metric, res = 0.01, fun = mean, lon = NULL, lat = NULL, ...)rasterizeGEDI(x, metric, res = 0.01, fun = mean, lon = NULL, lat = NULL, ...)
x |
GEDI footprint table. |
metric |
Metric column. |
res |
Resolution in decimal degrees. |
fun |
Aggregation function. |
lon, lat
|
Optional coordinate columns. |
... |
Passed to |
Rasterize GEDI Level 4A footprints
rasterizeLevel4A( level4A, metric = "agbd", fun = mean, res = 0.01, filename = "", overwrite = FALSE, ... )rasterizeLevel4A( level4A, metric = "agbd", fun = mean, res = 0.01, filename = "", overwrite = FALSE, ... )
level4A |
A table returned by |
metric |
Metric column name. |
fun |
Aggregation function. |
res |
Output resolution in decimal degrees. |
filename |
Optional output GeoTIFF path. |
overwrite |
Logical; overwrite |
... |
Additional arguments passed to |
GEDI raster-stratified sampling specification
rasterSampling(size, raster, lon = NULL, lat = NULL)rasterSampling(size, raster, lon = NULL, lat = NULL)
size |
Number or fraction per raster class. |
raster |
A categorical |
lon, lat
|
Optional coordinate column names. |
Open a GEDI HDF5 granule through Earthaccess
readGEDICloud(x, product = NULL, cache_dir = tempdir())readGEDICloud(x, product = NULL, cache_dir = tempdir())
x |
URL, S3 URI, or Earthaccess granule result. |
product |
Optional product identifier. |
cache_dir |
Used when cloud modules are unavailable and a URL is downloaded. |
An object of class gedi.cloud_h5.
This function reads GEDI level1B products: geolocated Waveforms
readLevel1B(level1Bpath)readLevel1B(level1Bpath)
level1Bpath |
Local file path or Earthdata Cloud URL pointing to a GEDI Level 1B HDF5 granule. |
Returns an S4 object of class gedi.level1b containing GEDI level1B data.
hdf5r::H5File in the hdf5r package and
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi01-b-002
# Specifying the path to GEDI level1B data (zip file) outdir = tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package="rGEDI") # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip,exdir = outdir) # Reading GEDI level1B data (h5 file) level1b<-readLevel1B(level1Bpath=level1Bpath) close(level1b)# Specifying the path to GEDI level1B data (zip file) outdir = tempdir() level1B_fp_zip <- system.file("extdata", "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip", package="rGEDI") # Unzipping GEDI level1B data level1Bpath <- unzip(level1B_fp_zip,exdir = outdir) # Reading GEDI level1B data (h5 file) level1b<-readLevel1B(level1Bpath=level1Bpath) close(level1b)
This function reads GEDI level2A products: ground elevation, canopy top height, and relative heights (RH).
readLevel2A(level2Apath)readLevel2A(level2Apath)
level2Apath |
Local file path or Earthdata Cloud URL pointing to a GEDI Level 2A HDF5 granule. |
Returns an S4 object of class gedi.level2a containing GEDI level2A data.
https://www.earthdata.nasa.gov/data/catalog/lpcloud-gedi02-a-002
# Specifying the path to GEDI level2A data (zip file) outdir = tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip,exdir = outdir) # Reading GEDI level2A data (h5 file) level2a<-readLevel2A(level2Apath=level2Apath) close(level2a)# Specifying the path to GEDI level2A data (zip file) outdir = tempdir() level2A_fp_zip <- system.file("extdata", "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Apath <- unzip(level2A_fp_zip,exdir = outdir) # Reading GEDI level2A data (h5 file) level2a<-readLevel2A(level2Apath=level2Apath) close(level2a)
This function reads GEDI level2B products: canopy cover, Plant Area Index (PAI), Plant Area Volume Density (PAVD), and Foliage Height Diversity (FHD).
readLevel2B(level2Bpath)readLevel2B(level2Bpath)
level2Bpath |
Local file path or Earthdata Cloud URL pointing to a GEDI Level 2B HDF5 granule. |
Returns an S4 object of class gedi.level2b containing GEDI level2B data.
# Specifying the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) close(level2b)# Specifying the path to GEDI level2B data (zip file) outdir = tempdir() level2B_fp_zip <- system.file("extdata", "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.zip", package="rGEDI") # Unzipping GEDI level2A data level2Bpath <- unzip(level2B_fp_zip,exdir = outdir) # Reading GEDI level2B data (h5 file) level2b<-readLevel2B(level2Bpath=level2Bpath) close(level2b)
Read GEDI Level 3 gridded metrics
readLevel3(x, metrics = NULL)readLevel3(x, metrics = NULL)
x |
One or more local paths, GDAL-readable URLs, or a |
metrics |
Optional layer names to retain. |
https://daac.ornl.gov/GEDI/guides/GEDI_L3_LandSurface_Metrics_V3.html
Opens a GEDI04_A HDF5 granule containing footprint-level aboveground biomass density estimates.
readLevel4A(level4Apath)readLevel4A(level4Apath)
level4Apath |
Local file path or Earthdata Cloud URL pointing to a GEDI04_A HDF5 granule. |
A gedi.level4a object. Close it with close().
https://daac.ornl.gov/GEDI/guides/GEDI_L4A_AGB_Density_V3.html
Read GEDI Level 4B gridded biomass
readLevel4B(x, metrics = NULL)readLevel4B(x, metrics = NULL)
x |
One or more local paths, GDAL-readable URLs, or a |
metrics |
Optional layer names to retain. |
Resample a GEDI Level 3 raster
resampleLevel3(x, template, method = "bilinear", ...)resampleLevel3(x, template, method = "bilinear", ...)
x |
A raster path or |
template |
Target |
method |
Resampling method. |
... |
Passed to |
Resample a GEDI Level 4B raster
resampleLevel4B(x, template, method = "bilinear", ...)resampleLevel4B(x, template, method = "bilinear", ...)
x |
A raster path or |
template |
Target |
method |
Resampling method. |
... |
Passed to |
Configure optional rGEDI cloud and Earth Engine support
rGEDI_configure( python = NULL, install = FALSE, earth_engine_project = Sys.getenv("EE_PROJECT", unset = ""), quiet = FALSE )rGEDI_configure( python = NULL, install = FALSE, earth_engine_project = Sys.getenv("EE_PROJECT", unset = ""), quiet = FALSE )
python |
Optional Python executable or environment name. |
install |
Logical; install missing Python modules. |
earth_engine_project |
Optional Google Earth Engine project ID. |
quiet |
Logical. |
Invisibly returns a capability table.
Sample GEDI footprint observations
sampleGEDI(x, method)sampleGEDI(x, method)
x |
A data frame or data table of GEDI footprints. |
method |
A specification returned by one of the sampling constructors. |
Search the GEDI datasets available in Earth Engine
search_datasets(..., operator = c("and", "or"))search_datasets(..., operator = c("and", "or"))
... |
Words matched against the product name, catalog ID, and title. |
operator |
Use |
A data table containing product, catalog ID, version, and title.
Earth Engine terrain slope
slope(x)slope(x)
x |
Earth Engine elevation image. |
An Earth Engine image.
GEDI minimum-distance sampling specification
spacedSampling(size, radius, lon = NULL, lat = NULL)spacedSampling(size, radius, lon = NULL, lat = NULL)
size |
Number or fraction of observations to select. |
radius |
Minimum separation in meters. |
lon, lat
|
Optional coordinate column names. |
GEDI attribute-stratified sampling specification
stratifiedSampling(size, variable, breaks = NULL)stratifiedSampling(size, variable, breaks = NULL)
size |
Number or fraction per stratum. |
variable |
Column used as strata, or a numeric column to bin. |
breaks |
Optional breaks for a numeric variable. |
Convert GEDI footprints to a spatial vector
to_vect(x, lon = NULL, lat = NULL, crs = "EPSG:4326")to_vect(x, lon = NULL, lat = NULL, crs = "EPSG:4326")
x |
GEDI footprint table. |
lon, lat
|
Optional coordinate column names. |
crs |
Coordinate reference system. |
Select predictor variables for a GEDI model
varSel( x, y, method = c("correlation", "randomForest", "rfe"), threshold = 0.1, seed = NULL, ... )varSel( x, y, method = c("correlation", "randomForest", "rfe"), threshold = 0.1, seed = NULL, ... )
x |
Predictor data frame. |
y |
Response vector. |
method |
Selection method. |
threshold |
Minimum absolute correlation or scaled Random Forest
importance. For |
seed |
Optional random seed. |
... |
Passed to |
An object of class gedi_var_selection.
Convert a vector object to an Earth Engine feature collection
vect_as_ee(x)vect_as_ee(x)
x |
|
An Earth Engine FeatureCollection.