From eb336a8e37e69e26a44cd3fe980ed7b50535daa8 Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Fri, 6 Mar 2020 23:30:11 -0300 Subject: [PATCH] Replace paste0 and fs::file_path with file.path for paths --- NAMESPACE | 5 +- R/C_processExtractMetrics.R | 10 +- R/C_simulateFullWaveform.R | 8 +- R/LPDAACDataPool.R | 2 +- R/class.gedi.R | 7 +- R/clipLevel2BVPM.R | 6 +- R/getLevel2BVPM.R | 6 +- man/LPDAACDataPool.Rd | 78 ++--- man/clipLevel1B.Rd | 110 +++---- man/clipLevel1BGeo.Rd | 128 ++++---- man/clipLevel1BGeoGeometry.Rd | 126 ++++---- man/clipLevel1BGeometry.Rd | 106 +++---- man/clipLevel2A.Rd | 110 +++---- man/clipLevel2AGeometry.Rd | 110 +++---- man/clipLevel2AM.Rd | 110 +++---- man/clipLevel2AMGeometry.Rd | 122 +++---- man/clipLevel2B.Rd | 136 ++++---- man/clipLevel2BGeometry.Rd | 112 +++---- man/clipLevel2BPAIProfile.Rd | 110 +++---- man/clipLevel2BPAIProfileGeometry.Rd | 112 +++---- man/clipLevel2BPAVDProfile.Rd | 110 +++---- man/clipLevel2BPAVDProfileGeometry.Rd | 110 +++---- man/clipLevel2BVPM.Rd | 134 ++++---- man/clipLevel2BVPMGeometry.Rd | 148 ++++----- man/gedi.fullwaveform-class.Rd | 30 +- man/gedi.level1b-class.Rd | 30 +- man/gedi.level1bSim-class.Rd | 30 +- man/gedi.level2a-class.Rd | 30 +- man/gedi.level2b-class.Rd | 30 +- man/gediWFMetrics.Rd | 436 +++++++++++++------------- man/gediWFSimulator.Rd | 332 ++++++++++---------- man/gedifinder.Rd | 88 +++--- man/getLevel1BGeo.Rd | 252 +++++++-------- man/getLevel1BWF.Rd | 100 +++--- man/getLevel2AM.Rd | 78 ++--- man/getLevel2BPAIProfile.Rd | 76 ++--- man/getLevel2BPAVDProfile.Rd | 76 ++--- man/getLevel2BVPM.Rd | 122 +++---- man/gridStatsLevel2AM.Rd | 136 ++++---- man/gridStatsLevel2BVPM.Rd | 134 ++++---- man/plotPAIProfile.Rd | 120 +++---- man/plotPAVDProfile.Rd | 118 +++---- man/plotWFMetrics.Rd | 104 +++--- man/polyStatsLevel2AM.Rd | 150 ++++----- man/polyStatsLevel2BVPM.Rd | 156 ++++----- man/readLevel1B.Rd | 68 ++-- man/readLevel2A.Rd | 72 ++--- man/readLevel2B.Rd | 64 ++-- tools/deps.R | 4 +- vignettes/tutorial.Rmd | 70 ++--- 50 files changed, 2461 insertions(+), 2461 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index dc4b938..2e7b701 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,4 +1,4 @@ -# Generated by roxygen2: do not edit by hand +# Generated by roxygen2: do not edit by hand export(LPDAACDataPool) export(clipLevel1B) @@ -17,6 +17,7 @@ export(clipLevel2BPAVDProfile) export(clipLevel2BPAVDProfileGeometry) export(clipLevel2BVPM) export(clipLevel2BVPMGeometry) +export(close) export(gediWFMetrics) export(gediWFSimulator) export(gedifinder) @@ -42,8 +43,6 @@ exportClasses(gedi.level1b) exportClasses(gedi.level1bSim) exportClasses(gedi.level2a) exportClasses(gedi.level2b) -exportMethods(close) -exportMethods(plot) import(data.table) import(fs) import(ggplot2) diff --git a/R/C_processExtractMetrics.R b/R/C_processExtractMetrics.R index cc3a9e0..7872ad9 100644 --- a/R/C_processExtractMetrics.R +++ b/R/C_processExtractMetrics.R @@ -135,11 +135,11 @@ #' coords = c(xcenter_Savanna, ycenter_Savanna)) #' #'# Extracting GEDI feull-waveform derived metrics -#'wf_amazon_metrics<-gediWFMetrics(input=wf_amazon,outRoot=getwd()) -#'wf_cerrado_metrics<-gediWFMetrics(input=wf_cerrado,outRoot=getwd()) +#'wf_amazon_metrics<-gediWFMetrics(input=wf_amazon,outRoot=file.path(getwd(), "amazon")) +#'wf_cerrado_metrics<-gediWFMetrics(input=wf_cerrado,outRoot=file.path(getwd(), "cerrado")) #' -#'wf_amazon@h5$close() -#'wf_cerrado@h5$close() +#'close(wf_amazon) +#'close(wf_cerrtado) #' #'metrics<-rbind(wf_amazon_metrics,wf_cerrado_metrics) #'rownames(metrics)<-c("Amazon","Cerrado") @@ -404,7 +404,7 @@ gediWFMetrics = function( cleanInList(inputInList) if (res==0) { - output = paste0(outRoot, ".metric.txt") + output = fs::path_ext_set(outRoot, ".metric.txt") header = read.csv(output, sep=",", nrow=1, header = FALSE, as.is=TRUE) header[ncol(header)] = NULL header=gsub(" *\\d+ *([^,]*)", "\\1", header) diff --git a/R/C_simulateFullWaveform.R b/R/C_simulateFullWaveform.R index d65a4e9..5607137 100644 --- a/R/C_simulateFullWaveform.R +++ b/R/C_simulateFullWaveform.R @@ -132,9 +132,9 @@ #'plot(wf_Savanna, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="green", #' xlab="Waveform Amplitude (%)", ylab="Elevation (m)", ylim=c(815,835)) #'grid() -#' -#'wf_Amazon@h5$close_all() -#'wf_Savanna@h5$close_all() +#' +#'close(wf_Amazon) +#'close(wf_Amazon) #'} #' #' @import hdf5r @@ -234,7 +234,7 @@ gediWFSimulator = function( inputInList = inputOrInList(input) if (fs::path_ext(output) != "h5") { - output = paste0(output, ".h5") + output = fs::path_ext_set(output, ".h5") } .Call("C_gediSimulator", diff --git a/R/LPDAACDataPool.R b/R/LPDAACDataPool.R index bba753d..5ea51b5 100644 --- a/R/LPDAACDataPool.R +++ b/R/LPDAACDataPool.R @@ -56,7 +56,7 @@ LPDAACDataPool<-function(filepath,outdir){ cat(paste0("Downloading file ",filename," \n")) # Write file to disk (authenticating with netrc) using the current directory/filename - response <- httr::GET(files[i], httr::write_disk(paste0(outdir,"\\",filename), overwrite = TRUE), httr::progress(), + response <- httr::GET(files[i], httr::write_disk(file.path(outdir, "",filename), overwrite = TRUE), httr::progress(), httr::config(netrc = TRUE, netrc_file = netrc), httr::set_cookies("LC" = "cookies")) # Check to see if file downloaded correctly diff --git a/R/class.gedi.R b/R/class.gedi.R index 9258f93..44d4a89 100644 --- a/R/class.gedi.R +++ b/R/class.gedi.R @@ -63,6 +63,7 @@ gedi.fullwaveform <- setClass( #' #'@param x An object of class "gedi.fullwaveform". (output of \code{\link[rGEDI:getLevel1BWF]{getLevel1BWF}} function) #'@param y: not used (inherited from R base) +#'@param ...: will be passed to the main plot #' #'@param relative if TRUE, the Wavform Amplitude will be showed in percentage (\%) #'@param polygon if TRUE, polygon will be added to the plot @@ -86,13 +87,13 @@ setGeneric("plot", function(x, y, ...) #' "https://github.com/carlos-alberto-silva/rGEDI/", #' "releases/download/examples/examples.zip" #' ), -#' destfile=paste0(outdir,"/examples.zip")) +#' destfile=file.path(outdir, "examples.zip")) #' #'# unzip the file -#'unzip(paste0(outdir,"\\examples.zip")) +#'unzip(file.path(outdir, "examples.zip")) #' #'# specify the path to GEDI level1B data -#'level1bpath = paste0(outdir,"\\GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.h5") +#'level1bpath = file.path(outdir, "GEDI01'_B_2019108080338_O01964_T05337_02_003_01_sub.h5") #' #'# Reading GEDI level1B file #'level1b<-readLevel1b(gedilevel1b) diff --git a/R/clipLevel2BVPM.R b/R/clipLevel2BVPM.R index bf257cd..4330846 100644 --- a/R/clipLevel2BVPM.R +++ b/R/clipLevel2BVPM.R @@ -100,13 +100,13 @@ clipLevel2BVPM = function(level2BVPM,xmin, xmax, ymin, ymax){ #' "https://github.com/carlos-alberto-silva/rGEDI/", #' "releases/download/examples/examples.zip" #' ), -#' destfile=paste0(outdir,"/examples.zip")) +#' destfile=file.path(outdir, "examples.zip")) #' #'# unzip the file -#'unzip(paste0(outdir,"\\examples.zip")) +#'unzip(file.path(outdir, "examples.zip")) #' #'# specify the path to GEDI level2B data -#'level2bpath = paste0(outdir,"\\GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5") +#'level2bpath = file.path(outdir, "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5") #' #'# Reading GEDI level1B file #'level2b<-readLevel2b(gedilevel2b) diff --git a/R/getLevel2BVPM.R b/R/getLevel2BVPM.R index 4e2257f..ff96bd9 100644 --- a/R/getLevel2BVPM.R +++ b/R/getLevel2BVPM.R @@ -34,13 +34,13 @@ #' "https://github.com/carlos-alberto-silva/rGEDI/", #' "releases/download/examples/examples.zip" #' ), -#' destfile=paste0(outdir,"/examples.zip")) +#' destfile=file.path(outdir, "examples.zip")) #' #'# unzip the file -#'unzip(paste0(outdir,"\\examples.zip")) +#'unzip(file.path(outdir, "examples.zip")) #' #'# specify the path to GEDI level2B data -#'level2bpath = paste0(outdir,"\\GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5") +#'level2bpath = file.path(outdir, "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5") #' #'# Reading GEDI level1B file #'level2b<-readLevel2b(gedilevel2b) diff --git a/man/LPDAACDataPool.Rd b/man/LPDAACDataPool.Rd index a400ae1..9eb3bb0 100644 --- a/man/LPDAACDataPool.Rd +++ b/man/LPDAACDataPool.Rd @@ -1,39 +1,39 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/LPDAACDataPool.R -\name{LPDAACDataPool} -\alias{LPDAACDataPool} -\title{Download GEDI data} -\usage{ -LPDAACDataPool(filepath,outdir) -} -\arguments{ -\item{filepath}{Vector object; path to the GEDI data} - -\item{outdir}{Vector object, output directory for downloading GEDI data} -} -\description{ -Download GEDI data from LP DAAC Data Pool. Users will need to enter their -Earth Explore login Information for downloading the data. -} -\examples{ -\dontrun{ -#' Set path to GEDI data -filepath=c(paste0( - "https://e4ftl01.cr.usgs.gov/GEDI/GEDI02_B.001", - "/2019.04.18/GEDI02_B_2019108032534_O01961_T03911_02_001_01.h5" - ), - paste0("https://e4ftl01.cr.usgs.gov/GEDI/GEDI02_B.001", - "/2019.04.18/GEDI02_B_2019108045815_O01962_T01066_02_001_01.h5" - ) - ) - -# Set dir to download files to -outdir=tempdir() - -#' Downloading GEDI data -LPDAACDataPool(filepath,outdir) -} -} -\references{ -Credits to Cole Krehbiel. Code adpted from -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/LPDAACDataPool.R +\name{LPDAACDataPool} +\alias{LPDAACDataPool} +\title{Download GEDI data} +\usage{ +LPDAACDataPool(filepath,outdir) +} +\arguments{ +\item{filepath}{Vector object; path to the GEDI data} + +\item{outdir}{Vector object, output directory for downloading GEDI data} +} +\description{ +Download GEDI data from LP DAAC Data Pool. Users will need to enter their +Earth Explore login Information for downloading the data. +} +\examples{ +\dontrun{ +#' Set path to GEDI data +filepath=c(paste0( + "https://e4ftl01.cr.usgs.gov/GEDI/GEDI02_B.001", + "/2019.04.18/GEDI02_B_2019108032534_O01961_T03911_02_001_01.h5" + ), + paste0("https://e4ftl01.cr.usgs.gov/GEDI/GEDI02_B.001", + "/2019.04.18/GEDI02_B_2019108045815_O01962_T01066_02_001_01.h5" + ) + ) + +# Set dir to download files to +outdir=tempdir() + +#' Downloading GEDI data +LPDAACDataPool(filepath,outdir) +} +} +\references{ +Credits to Cole Krehbiel. Code adpted from +} diff --git a/man/clipLevel1B.Rd b/man/clipLevel1B.Rd index 29fae9d..98a1a0a 100644 --- a/man/clipLevel1B.Rd +++ b/man/clipLevel1B.Rd @@ -1,55 +1,55 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel1B.R -\name{clipLevel1B} -\alias{clipLevel1B} -\title{Clip GEDI Level1B data by Coordinates} -\usage{ -clipLevel1B(level1b, xmin, xmax, ymin, ymax, output) -} -\arguments{ -\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} - -\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{output}{Optional character path where to save the new hdf5file. The default stores a temporary file only.} -} -\value{ -Returns a list of S4 object of class "gedi.level1b". -} -\description{ -This function clips GEDI Level1B data within given bounding coordinates -} -\examples{ -# specify 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 = dirname(level1B_fp_zip)) - -# Reading GEDI level1B data (h5 file) -level1b<-readLevel1B(level1Bpath=level1Bpath) - -# Bounding rectangle coordinates -xmin = -44.15036 -xmax = -44.10066 -ymin = -13.75831 -ymax = -13.71244 - -# Spepecifing output file and path -output<-paste0(getwd(),"//GEDI01_B_2019108080338_O01964_T05337_02_003_01_clip") - -# clip by extent boundary box -level1b_clip <- clipLevel1B(level1b,xmin, xmax, ymin, ymax,output) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi01_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel1B.R +\name{clipLevel1B} +\alias{clipLevel1B} +\title{Clip GEDI Level1B data by Coordinates} +\usage{ +clipLevel1B(level1b, xmin, xmax, ymin, ymax, output) +} +\arguments{ +\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} + +\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{output}{Optional character path where to save the new hdf5file. The default stores a temporary file only.} +} +\value{ +Returns a list of S4 object of class "gedi.level1b". +} +\description{ +This function clips GEDI Level1B data within given bounding coordinates +} +\examples{ +# specify 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 = dirname(level1B_fp_zip)) + +# Reading GEDI level1B data (h5 file) +level1b<-readLevel1B(level1Bpath=level1Bpath) + +# Bounding rectangle coordinates +xmin = -44.15036 +xmax = -44.10066 +ymin = -13.75831 +ymax = -13.71244 + +# Spepecifing output file and path +output<-paste0(getwd(),"//GEDI01_B_2019108080338_O01964_T05337_02_003_01_clip") + +# clip by extent boundary box +level1b_clip <- clipLevel1B(level1b,xmin, xmax, ymin, ymax,output) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi01_bv001/ +} diff --git a/man/clipLevel1BGeo.Rd b/man/clipLevel1BGeo.Rd index dfab79f..72b84ee 100644 --- a/man/clipLevel1BGeo.Rd +++ b/man/clipLevel1BGeo.Rd @@ -1,64 +1,64 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel1BGeo.R -\name{clipLevel1BGeo} -\alias{clipLevel1BGeo} -\title{Clip Level1BGeo data by Coordinates} -\usage{ -clipLevel1BGeo(level1BGeo, xmin, xmax, ymin, ymax) -} -\arguments{ -\item{level1BGeo}{A GEDI Level1b object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} - -\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}}. -} -\description{ -This function clips GEDI level1B extracted geolocation (level1BGeo) -data within given bounding coordinates -} -\examples{ -# specify 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 = dirname(level1B_fp_zip)) - -# Reading GEDI level1B data (h5 file) -level1b<-readLevel1B(level1Bpath=level1Bpath) - -# Get GEDI level1B geolocations -level1BGeo<-getLevel1BGeo(level1b) - -# Bounding rectangle coordinates -xmin = -44.15036 -xmax = -44.10066 -ymin = -13.75831 -ymax = -13.71244 - -# clip by boundary box coordinates -level1bGeo_clip <- clipLevel1BGeo(level1BGeo,xmin, xmax, ymin, ymax) - -library(leaflet) -leaflet() \%>\% - addCircleMarkers(level1bGeo_clip@dt$longitude_bin0, - level1bGeo_clip@dt$latitude_bin0, - radius = 1, - opacity = 1, - color = "red") \%>\% - addScaleBar(options = list(imperial = FALSE)) \%>\% - addProviderTiles(providers$Esri.WorldImagery) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi01_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel1BGeo.R +\name{clipLevel1BGeo} +\alias{clipLevel1BGeo} +\title{Clip Level1BGeo data by Coordinates} +\usage{ +clipLevel1BGeo(level1BGeo, xmin, xmax, ymin, ymax) +} +\arguments{ +\item{level1BGeo}{A GEDI Level1b object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} + +\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}}. +} +\description{ +This function clips GEDI level1B extracted geolocation (level1BGeo) +data within given bounding coordinates +} +\examples{ +# specify 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 = dirname(level1B_fp_zip)) + +# Reading GEDI level1B data (h5 file) +level1b<-readLevel1B(level1Bpath=level1Bpath) + +# Get GEDI level1B geolocations +level1BGeo<-getLevel1BGeo(level1b) + +# Bounding rectangle coordinates +xmin = -44.15036 +xmax = -44.10066 +ymin = -13.75831 +ymax = -13.71244 + +# clip by boundary box coordinates +level1bGeo_clip <- clipLevel1BGeo(level1BGeo,xmin, xmax, ymin, ymax) + +library(leaflet) +leaflet() \%>\% + addCircleMarkers(level1bGeo_clip@dt$longitude_bin0, + level1bGeo_clip@dt$latitude_bin0, + radius = 1, + opacity = 1, + color = "red") \%>\% + addScaleBar(options = list(imperial = FALSE)) \%>\% + addProviderTiles(providers$Esri.WorldImagery) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi01_bv001/ +} diff --git a/man/clipLevel1BGeoGeometry.Rd b/man/clipLevel1BGeoGeometry.Rd index aed30eb..77fbf8f 100644 --- a/man/clipLevel1BGeoGeometry.Rd +++ b/man/clipLevel1BGeoGeometry.Rd @@ -1,63 +1,63 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel1BGeo.R -\name{clipLevel1BGeoGeometry} -\alias{clipLevel1BGeoGeometry} -\title{Clip Level1BGeo data by geometry} -\usage{ -clipLevel1BGeoGeometry(level1BGeo, polygon_spdf, split_by) -} -\arguments{ -\item{level1BGeo}{A GEDI Level1b object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "data.table".} - -\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, -which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} - -\item{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} -} -\value{ -A S4 object of class \code{\link[data.table:data.table]{data.table-class}}. -} -\description{ -This function clips GEDI level1B extracted geolocation (level1BGeo) -data within given geometry -} -\examples{ -# specify 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 = dirname(level1B_fp_zip)) - -# Reading GEDI level1B data (h5 file) -level1b<-readLevel1B(level1Bpath=level1Bpath) - -# Get GEDI level1B geolocations -level1BGeo<-getLevel1BGeo(level1b) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -level1bGeo_clip = clipLevel1BGeometry(level1bGeo, polygon_spdf, split_by="id") - -library(leaflet) -leaflet() \%>\% - addCircleMarkers(level1b_clip@dt$longitude_bin0, - level1b_clip@dt$latitude_bin0, - radius = 1, - opacity = 1, - color = "red") \%>\% - addScaleBar(options = list(imperial = FALSE)) \%>\% - addPolygons(data=polygon_spdf,weight=1,col = 'white', - opacity = 1, fillOpacity = 0) \%>\% - addProviderTiles(providers$Esri.WorldImagery) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi01_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel1BGeo.R +\name{clipLevel1BGeoGeometry} +\alias{clipLevel1BGeoGeometry} +\title{Clip Level1BGeo data by geometry} +\usage{ +clipLevel1BGeoGeometry(level1BGeo, polygon_spdf, split_by) +} +\arguments{ +\item{level1BGeo}{A GEDI Level1b object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "data.table".} + +\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, +which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} + +\item{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} +} +\value{ +A S4 object of class \code{\link[data.table:data.table]{data.table-class}}. +} +\description{ +This function clips GEDI level1B extracted geolocation (level1BGeo) +data within given geometry +} +\examples{ +# specify 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 = dirname(level1B_fp_zip)) + +# Reading GEDI level1B data (h5 file) +level1b<-readLevel1B(level1Bpath=level1Bpath) + +# Get GEDI level1B geolocations +level1BGeo<-getLevel1BGeo(level1b) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +level1bGeo_clip = clipLevel1BGeometry(level1bGeo, polygon_spdf, split_by="id") + +library(leaflet) +leaflet() \%>\% + addCircleMarkers(level1b_clip@dt$longitude_bin0, + level1b_clip@dt$latitude_bin0, + radius = 1, + opacity = 1, + color = "red") \%>\% + addScaleBar(options = list(imperial = FALSE)) \%>\% + addPolygons(data=polygon_spdf,weight=1,col = 'white', + opacity = 1, fillOpacity = 0) \%>\% + addProviderTiles(providers$Esri.WorldImagery) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi01_bv001/ +} diff --git a/man/clipLevel1BGeometry.Rd b/man/clipLevel1BGeometry.Rd index 6c71be8..fc40e49 100644 --- a/man/clipLevel1BGeometry.Rd +++ b/man/clipLevel1BGeometry.Rd @@ -1,53 +1,53 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel1B.R -\name{clipLevel1BGeometry} -\alias{clipLevel1BGeometry} -\title{Clip GEDI Level1B data by geometry} -\usage{ -clipLevel1BGeometry(level1b, polygon_spdf, output = "", - split_by = NULL) -} -\arguments{ -\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} - -\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, -which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} - -\item{output}{Optional character path where to save the new hdf5file. The default stores a temporary file only.} - -\item{split_by}{Polygon id. If defined, GEDI data will be clipped by each polygon using attribute specified by \code{split_by} from attribute table.} -} -\value{ -Returns a list of S4 object of class "gedi.level1b". -} -\description{ -This function clips GEDI Level1B data within a bounding geometry -} -\examples{ -# specify 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 = dirname(level1B_fp_zip)) - -# Reading GEDI level1B data (h5 file) -level1b<-readLevel1B(level1Bpath=level1Bpath) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -# Spepecifing output file and path -output<-paste0(getwd(),"//GEDI01_B_2019108080338_O01964_T05337_02_003_01_clip") - -# clip by extent boundary box -level1b_clip <- clipLevel1BGeometry(level1b, polygon_spdf = polygon_spdf, - output=output, - split_by="id") - -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel1B.R +\name{clipLevel1BGeometry} +\alias{clipLevel1BGeometry} +\title{Clip GEDI Level1B data by geometry} +\usage{ +clipLevel1BGeometry(level1b, polygon_spdf, output = "", + split_by = NULL) +} +\arguments{ +\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} + +\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, +which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} + +\item{output}{Optional character path where to save the new hdf5file. The default stores a temporary file only.} + +\item{split_by}{Polygon id. If defined, GEDI data will be clipped by each polygon using attribute specified by \code{split_by} from attribute table.} +} +\value{ +Returns a list of S4 object of class "gedi.level1b". +} +\description{ +This function clips GEDI Level1B data within a bounding geometry +} +\examples{ +# specify 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 = dirname(level1B_fp_zip)) + +# Reading GEDI level1B data (h5 file) +level1b<-readLevel1B(level1Bpath=level1Bpath) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +# Spepecifing output file and path +output<-paste0(getwd(),"//GEDI01_B_2019108080338_O01964_T05337_02_003_01_clip") + +# clip by extent boundary box +level1b_clip <- clipLevel1BGeometry(level1b, polygon_spdf = polygon_spdf, + output=output, + split_by="id") + +} diff --git a/man/clipLevel2A.Rd b/man/clipLevel2A.Rd index fca4f24..450f28d 100644 --- a/man/clipLevel2A.Rd +++ b/man/clipLevel2A.Rd @@ -1,55 +1,55 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2A.R -\name{clipLevel2A} -\alias{clipLevel2A} -\title{Clip GEDI Level2A data by Coordinates} -\usage{ -clipLevel2A(level2a, xmin, xmax, ymin, ymax, output) -} -\arguments{ -\item{level2a}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} - -\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{output}{Optional character path where to save the new hdf5file. The default stores a temporary file only.} -} -\value{ -Returns a list of S4 object of class "gedi.level2a". -} -\description{ -This function clips GEDI Level2A data within given bounding coordinates -} -\examples{ -# specify 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 = dirname(level2A_fp_zip)) - -# Reading GEDI level2A data (h5 file) -level2a<-readLevel2A(level2Apath=level2Apath) - -# Bounding rectangle coordinates -xmin = -44.15036 -xmax = -44.10066 -ymin = -13.75831 -ymax = -13.71244 - -# Spepecifing output file and path -output<-paste0(getwd(),"//GEDI02_A_2019108080338_O01964_T05337_02_001_01_clip") - -# clip by extent boundary box -level2a_clip <- clipLevel2A(level1a,xmin,xmax,ymin,ymax,output) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_av001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2A.R +\name{clipLevel2A} +\alias{clipLevel2A} +\title{Clip GEDI Level2A data by Coordinates} +\usage{ +clipLevel2A(level2a, xmin, xmax, ymin, ymax, output) +} +\arguments{ +\item{level2a}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} + +\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{output}{Optional character path where to save the new hdf5file. The default stores a temporary file only.} +} +\value{ +Returns a list of S4 object of class "gedi.level2a". +} +\description{ +This function clips GEDI Level2A data within given bounding coordinates +} +\examples{ +# specify 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 = dirname(level2A_fp_zip)) + +# Reading GEDI level2A data (h5 file) +level2a<-readLevel2A(level2Apath=level2Apath) + +# Bounding rectangle coordinates +xmin = -44.15036 +xmax = -44.10066 +ymin = -13.75831 +ymax = -13.71244 + +# Spepecifing output file and path +output<-paste0(getwd(),"//GEDI02_A_2019108080338_O01964_T05337_02_001_01_clip") + +# clip by extent boundary box +level2a_clip <- clipLevel2A(level1a,xmin,xmax,ymin,ymax,output) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_av001/ +} diff --git a/man/clipLevel2AGeometry.Rd b/man/clipLevel2AGeometry.Rd index d6071ce..65cdaea 100644 --- a/man/clipLevel2AGeometry.Rd +++ b/man/clipLevel2AGeometry.Rd @@ -1,55 +1,55 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2A.R -\name{clipLevel2AGeometry} -\alias{clipLevel2AGeometry} -\title{Clip GEDI Level2A data by geometry} -\usage{ -clipLevel2AGeometry(level2a, polygon_spdf, output="", split_by=NULL) -} -\arguments{ -\item{level2a}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} - -\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, -which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} - -\item{output}{optional character path where to save the new h5file. Default "" (temporary file).} - -\item{split_by}{Polygon id. If defined, GEDI data will be clipped by each polygon using attribute specified by \code{split_by} from attribute table.} -} -\value{ -Returns a list of S4 object of class "gedi.level2a". -} -\description{ -This function clips GEDI Level2A data within given geometry -} -\examples{ -# specify 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 = dirname(level2A_fp_zip)) - -# Reading GEDI level2A data (h5 file) -level2a<-readLevel2A(level2Apath=level2Apath) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -# Spepecifing output file and path -output<-paste0(getwd(),"//GEDI02_A_2019108080338_O01964_T05337_02_001_01_clip") - -# clip by extent boundary box -level2a_clip <- clipLevel2AGeometry(level2a, polygon_spdf = polygon_spdf, - output=output, - split_by="id") - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_av001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2A.R +\name{clipLevel2AGeometry} +\alias{clipLevel2AGeometry} +\title{Clip GEDI Level2A data by geometry} +\usage{ +clipLevel2AGeometry(level2a, polygon_spdf, output="", split_by=NULL) +} +\arguments{ +\item{level2a}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} + +\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, +which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} + +\item{output}{optional character path where to save the new h5file. Default "" (temporary file).} + +\item{split_by}{Polygon id. If defined, GEDI data will be clipped by each polygon using attribute specified by \code{split_by} from attribute table.} +} +\value{ +Returns a list of S4 object of class "gedi.level2a". +} +\description{ +This function clips GEDI Level2A data within given geometry +} +\examples{ +# specify 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 = dirname(level2A_fp_zip)) + +# Reading GEDI level2A data (h5 file) +level2a<-readLevel2A(level2Apath=level2Apath) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +# Spepecifing output file and path +output<-paste0(getwd(),"//GEDI02_A_2019108080338_O01964_T05337_02_001_01_clip") + +# clip by extent boundary box +level2a_clip <- clipLevel2AGeometry(level2a, polygon_spdf = polygon_spdf, + output=output, + split_by="id") + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_av001/ +} diff --git a/man/clipLevel2AM.Rd b/man/clipLevel2AM.Rd index 2e3f298..d78d083 100644 --- a/man/clipLevel2AM.Rd +++ b/man/clipLevel2AM.Rd @@ -1,55 +1,55 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2AM.R -\name{clipLevel2AM} -\alias{clipLevel2AM} -\title{Clip Level2AM data by Coordinates} -\usage{ -clipLevel2AM(level2AM, xmin, xmax, ymin, ymax) -} -\arguments{ -\item{level2AM}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} - -\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containing the elevation and relative heights. -} -\description{ -This function clips GEDI Level2A extracted Elevation and Height Metrics (Level2AM) -within given bounding coordinates -} -\examples{ -# specify 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 = dirname(level2A_fp_zip)) - -# Reading GEDI level2A data (h5 file) -level2a<-readLevel2A(level2Apath=level2Apath) - -#' Extracting GEDI Elevation and Height Metrics -level2AM = getLevel2AM(level2a) - -# Bounding rectangle coordinates -xmin = -44.15036 -xmax = -44.10066 -ymin = -13.75831 -ymax = -13.71244 - -# clip by extent boundary box -level2AM_clip <- clipLevel2AM(level2AM,xmin, xmax, ymin, ymax) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_av001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2AM.R +\name{clipLevel2AM} +\alias{clipLevel2AM} +\title{Clip Level2AM data by Coordinates} +\usage{ +clipLevel2AM(level2AM, xmin, xmax, ymin, ymax) +} +\arguments{ +\item{level2AM}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} + +\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containing the elevation and relative heights. +} +\description{ +This function clips GEDI Level2A extracted Elevation and Height Metrics (Level2AM) +within given bounding coordinates +} +\examples{ +# specify 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 = dirname(level2A_fp_zip)) + +# Reading GEDI level2A data (h5 file) +level2a<-readLevel2A(level2Apath=level2Apath) + +#' Extracting GEDI Elevation and Height Metrics +level2AM = getLevel2AM(level2a) + +# Bounding rectangle coordinates +xmin = -44.15036 +xmax = -44.10066 +ymin = -13.75831 +ymax = -13.71244 + +# clip by extent boundary box +level2AM_clip <- clipLevel2AM(level2AM,xmin, xmax, ymin, ymax) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_av001/ +} diff --git a/man/clipLevel2AMGeometry.Rd b/man/clipLevel2AMGeometry.Rd index eb848dd..6c16d52 100644 --- a/man/clipLevel2AMGeometry.Rd +++ b/man/clipLevel2AMGeometry.Rd @@ -1,61 +1,61 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2AM.R -\name{clipLevel2AMGeometry} -\alias{clipLevel2AMGeometry} -\title{Clip Level2AM data by Coordinates} -\usage{ -clipLevel2AMGeometry(level2AM, polygon_spdf, split_by) -} -\arguments{ -\item{level2AM}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "data.table".} - -\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, -which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} - -\item{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} -} -\value{ -A S4 object of class \code{\link[data.table:data.table]{data.table-class}}. -} -\description{ -This function clips GEDI Level2A extracted Elevation and Height Metrics (Level2AM) -within given bounding coordinates -} -\examples{ -# specify 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 = dirname(level2A_fp_zip)) - -# Reading GEDI level2A data (h5 file) -level2a<-readLevel2A(level2Apath=level2Apath) - -#' Extracting GEDI Elevation and Height Metrics -level2AM = getLevel2AM(level2a) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -level2AM_clip = clipLevel2AMGeometry(level2AM, polygon_spdf, split_by="id") - -library(leaflet) -leaflet() \%>\% - addCircleMarkers(clipped_level1Bdt@dt$longitude_bin0, - clipped_level1Bdt@dt$latitude_bin0, - radius = 1, - opacity = 1, - color = "red") \%>\% - addScaleBar(options = list(imperial = FALSE)) \%>\% - addPolygons(data=polygon_spdf,weight=1,col = 'white', - opacity = 1, fillOpacity = 0) \%>\% - addProviderTiles(providers$Esri.WorldImagery) - - -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2AM.R +\name{clipLevel2AMGeometry} +\alias{clipLevel2AMGeometry} +\title{Clip Level2AM data by Coordinates} +\usage{ +clipLevel2AMGeometry(level2AM, polygon_spdf, split_by) +} +\arguments{ +\item{level2AM}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "data.table".} + +\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, +which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} + +\item{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} +} +\value{ +A S4 object of class \code{\link[data.table:data.table]{data.table-class}}. +} +\description{ +This function clips GEDI Level2A extracted Elevation and Height Metrics (Level2AM) +within given bounding coordinates +} +\examples{ +# specify 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 = dirname(level2A_fp_zip)) + +# Reading GEDI level2A data (h5 file) +level2a<-readLevel2A(level2Apath=level2Apath) + +#' Extracting GEDI Elevation and Height Metrics +level2AM = getLevel2AM(level2a) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +level2AM_clip = clipLevel2AMGeometry(level2AM, polygon_spdf, split_by="id") + +library(leaflet) +leaflet() \%>\% + addCircleMarkers(clipped_level1Bdt@dt$longitude_bin0, + clipped_level1Bdt@dt$latitude_bin0, + radius = 1, + opacity = 1, + color = "red") \%>\% + addScaleBar(options = list(imperial = FALSE)) \%>\% + addPolygons(data=polygon_spdf,weight=1,col = 'white', + opacity = 1, fillOpacity = 0) \%>\% + addProviderTiles(providers$Esri.WorldImagery) + + +} diff --git a/man/clipLevel2B.Rd b/man/clipLevel2B.Rd index b511ffb..6fd83cf 100644 --- a/man/clipLevel2B.Rd +++ b/man/clipLevel2B.Rd @@ -1,68 +1,68 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2B.R -\name{clipLevel2B} -\alias{clipLevel2B} -\title{Clip GEDI Level2B data by Coordinates} -\usage{ -clipLevel2B(level2b, xmin, xmax, ymin, ymax, output = "") -} -\arguments{ -\item{level2b}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel2B]{readLevel2B}} function). A S4 object of class "gedi.level2b".} - -\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{output}{Optional character path where to save the new hdf5 file. The default stores a temporary file only.} -} -\value{ -Returns a list of S4 object of class "gedi.level2b". -} -\description{ -This function extracts GEDI Level1B data within given bounding coordinates -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# Bounding rectangle coordinates -xmin = -44.15036 -xmax = -44.10066 -ymin = -13.75831 -ymax = -13.71244 - -# Spepecifing output file and path -output<-paste0(getwd(),"//GEDI02_B_2019108080338_O01964_T05337_02_001_01_clip") - -# clip level2BVPM by extent boundary box -level2b_clip <- level2BVPM(level2BVPM,xmin, xmax, ymin, ymax) - -library(leaflet) -leaflet() \%>\% - addCircleMarkers(level2b_clip@dt$longitude_bin0, - level2b_clip@dt$latitude_bin0, - radius = 1, - opacity = 1, - color = "red") \%>\% - addScaleBar(options = list(imperial = FALSE)) \%>\% - addPolygons(data=polygon_spdf,weight=1,col = 'white', - opacity = 1, fillOpacity = 0) \%>\% - addProviderTiles(providers$Esri.WorldImagery) - - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi01_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2B.R +\name{clipLevel2B} +\alias{clipLevel2B} +\title{Clip GEDI Level2B data by Coordinates} +\usage{ +clipLevel2B(level2b, xmin, xmax, ymin, ymax, output = "") +} +\arguments{ +\item{level2b}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel2B]{readLevel2B}} function). A S4 object of class "gedi.level2b".} + +\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{output}{Optional character path where to save the new hdf5 file. The default stores a temporary file only.} +} +\value{ +Returns a list of S4 object of class "gedi.level2b". +} +\description{ +This function extracts GEDI Level1B data within given bounding coordinates +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# Bounding rectangle coordinates +xmin = -44.15036 +xmax = -44.10066 +ymin = -13.75831 +ymax = -13.71244 + +# Spepecifing output file and path +output<-paste0(getwd(),"//GEDI02_B_2019108080338_O01964_T05337_02_001_01_clip") + +# clip level2BVPM by extent boundary box +level2b_clip <- level2BVPM(level2BVPM,xmin, xmax, ymin, ymax) + +library(leaflet) +leaflet() \%>\% + addCircleMarkers(level2b_clip@dt$longitude_bin0, + level2b_clip@dt$latitude_bin0, + radius = 1, + opacity = 1, + color = "red") \%>\% + addScaleBar(options = list(imperial = FALSE)) \%>\% + addPolygons(data=polygon_spdf,weight=1,col = 'white', + opacity = 1, fillOpacity = 0) \%>\% + addProviderTiles(providers$Esri.WorldImagery) + + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi01_bv001/ +} diff --git a/man/clipLevel2BGeometry.Rd b/man/clipLevel2BGeometry.Rd index b729cc1..bb84595 100644 --- a/man/clipLevel2BGeometry.Rd +++ b/man/clipLevel2BGeometry.Rd @@ -1,56 +1,56 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2B.R -\name{clipLevel2BGeometry} -\alias{clipLevel2BGeometry} -\title{Clip GEDI Level2B data by geometry} -\usage{ -clipLevel2BGeometry(level2b, polygon_spdf, output = "", - split_by = NULL) -} -\arguments{ -\item{level2b}{h5file; S4 object of class H5File} - -\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, -which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} - -\item{output}{optional character path where to save the new h5file. Default "" (temporary file).} - -\item{split_by}{Polygon id. If defined, GEDI data will be clipped by each polygon using attribute specified by \code{split_by} from attribute table.} -} -\value{ -Returns a list of S4 object of class "gedi.level2b". -} -\description{ -This function extracts GEDI Level1B data within given geometry -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -# Spepecifing output file and path -output<-paste0(getwd(),"//GEDI02_B_2019108080338_O01964_T05337_02_001_01_clip") - -# clip by extent boundary box -level2b_clip <- clipLevel2BGeometry(level2B, polygon_spdf = polygon_spdf, - output=output, - split_by="id") - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi01_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2B.R +\name{clipLevel2BGeometry} +\alias{clipLevel2BGeometry} +\title{Clip GEDI Level2B data by geometry} +\usage{ +clipLevel2BGeometry(level2b, polygon_spdf, output = "", + split_by = NULL) +} +\arguments{ +\item{level2b}{h5file; S4 object of class H5File} + +\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, +which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} + +\item{output}{optional character path where to save the new h5file. Default "" (temporary file).} + +\item{split_by}{Polygon id. If defined, GEDI data will be clipped by each polygon using attribute specified by \code{split_by} from attribute table.} +} +\value{ +Returns a list of S4 object of class "gedi.level2b". +} +\description{ +This function extracts GEDI Level1B data within given geometry +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +# Spepecifing output file and path +output<-paste0(getwd(),"//GEDI02_B_2019108080338_O01964_T05337_02_001_01_clip") + +# clip by extent boundary box +level2b_clip <- clipLevel2BGeometry(level2B, polygon_spdf = polygon_spdf, + output=output, + split_by="id") + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi01_bv001/ +} diff --git a/man/clipLevel2BPAIProfile.Rd b/man/clipLevel2BPAIProfile.Rd index f8a9504..ada1f67 100644 --- a/man/clipLevel2BPAIProfile.Rd +++ b/man/clipLevel2BPAIProfile.Rd @@ -1,55 +1,55 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2BPAIProfile.R -\name{clipLevel2BPAIProfile} -\alias{clipLevel2BPAIProfile} -\title{Clip GEDI Plant Area Index profile data by Coordinates} -\usage{ -clipLevel2BPAIProfile(level2BPAIProfile, xmin, xmax, ymin, ymax) -} -\arguments{ -\item{level2BPAIProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function). A S4 object of class "gedi.level2b".} - -\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containing the Plant Area Index profile data. -} -\description{ -This function clips GEDI level2B-derived -Plant Area Index profile within given bounding coordinates -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# Get Plant Area Index profile -level2BPAIProfile<-getLevel2BPAIProfile(level2b) - -# Bounding rectangle coordinates -xmin = -44.15036 -xmax = -44.10066 -ymin = -13.75831 -ymax = -13.71244 - -# clip level2BVPM by extent boundary box -level2b_clip <- clipLevel2BPAIProfile(level2BPAIProfile,xmin, xmax, ymin, ymax) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2BPAIProfile.R +\name{clipLevel2BPAIProfile} +\alias{clipLevel2BPAIProfile} +\title{Clip GEDI Plant Area Index profile data by Coordinates} +\usage{ +clipLevel2BPAIProfile(level2BPAIProfile, xmin, xmax, ymin, ymax) +} +\arguments{ +\item{level2BPAIProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function). A S4 object of class "gedi.level2b".} + +\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containing the Plant Area Index profile data. +} +\description{ +This function clips GEDI level2B-derived +Plant Area Index profile within given bounding coordinates +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# Get Plant Area Index profile +level2BPAIProfile<-getLevel2BPAIProfile(level2b) + +# Bounding rectangle coordinates +xmin = -44.15036 +xmax = -44.10066 +ymin = -13.75831 +ymax = -13.71244 + +# clip level2BVPM by extent boundary box +level2b_clip <- clipLevel2BPAIProfile(level2BPAIProfile,xmin, xmax, ymin, ymax) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/clipLevel2BPAIProfileGeometry.Rd b/man/clipLevel2BPAIProfileGeometry.Rd index 30ad5b0..c7c9fa9 100644 --- a/man/clipLevel2BPAIProfileGeometry.Rd +++ b/man/clipLevel2BPAIProfileGeometry.Rd @@ -1,56 +1,56 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2BPAIProfile.R -\name{clipLevel2BPAIProfileGeometry} -\alias{clipLevel2BPAIProfileGeometry} -\title{Clip GEDI Plant Area Index profile data by geometry} -\usage{ -clipLevel2BPAIProfileGeometry(level2BPAIProfile, polygon_spdf, split_by) -} -\arguments{ -\item{level2BPAIProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function). A S4 object of class "data.table".} - -\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, -which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} - -\item{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} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}}. -} -\description{ -This function clips GEDI level2B-derived -Plant Area Index profile within given geometry -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# Get Plant Area Index profile -level2BPAIProfile<-getLevel2BPAIProfile(level2b) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -# clip level2BPAIProfile by geometry -level2b_clip_geometry <- clipLevel2BPAIProfileGeometry( - level2BPAIProfile, - polygon_spdf, - split_by="id") - - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2BPAIProfile.R +\name{clipLevel2BPAIProfileGeometry} +\alias{clipLevel2BPAIProfileGeometry} +\title{Clip GEDI Plant Area Index profile data by geometry} +\usage{ +clipLevel2BPAIProfileGeometry(level2BPAIProfile, polygon_spdf, split_by) +} +\arguments{ +\item{level2BPAIProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function). A S4 object of class "data.table".} + +\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, +which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} + +\item{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} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}}. +} +\description{ +This function clips GEDI level2B-derived +Plant Area Index profile within given geometry +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# Get Plant Area Index profile +level2BPAIProfile<-getLevel2BPAIProfile(level2b) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +# clip level2BPAIProfile by geometry +level2b_clip_geometry <- clipLevel2BPAIProfileGeometry( + level2BPAIProfile, + polygon_spdf, + split_by="id") + + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/clipLevel2BPAVDProfile.Rd b/man/clipLevel2BPAVDProfile.Rd index f4f3a65..0c7bb0e 100644 --- a/man/clipLevel2BPAVDProfile.Rd +++ b/man/clipLevel2BPAVDProfile.Rd @@ -1,55 +1,55 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2BPAVDProfile.R -\name{clipLevel2BPAVDProfile} -\alias{clipLevel2BPAVDProfile} -\title{Clip level2BPAVDProfile data by Coordinates} -\usage{ -clipLevel2BPAVDProfile(level2BPAVDProfile, xmin, xmax, ymin, ymax) -} -\arguments{ -\item{level2BPAVDProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAVDProfile]{getLevel2BPAVDProfile}} function). A S4 object of class "data.table".} - -\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containing the Plant Area Volume Density profile data. -} -\description{ -This function clips GEDI level2B-derived -Plant Area Volume Density profile within given bounding coordinates -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# Get Plant Area Volume Density profile -level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) - -# Bounding rectangle coordinates -xmin = -44.15036 -xmax = -44.10066 -ymin = -13.75831 -ymax = -13.71244 - -# clip level2BVPM by extent boundary box -level2BPAVDProfile_clip <- clipLevel2BPAVDProfile(level2BPAVDProfile,xmin, xmax, ymin, ymax) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2BPAVDProfile.R +\name{clipLevel2BPAVDProfile} +\alias{clipLevel2BPAVDProfile} +\title{Clip level2BPAVDProfile data by Coordinates} +\usage{ +clipLevel2BPAVDProfile(level2BPAVDProfile, xmin, xmax, ymin, ymax) +} +\arguments{ +\item{level2BPAVDProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAVDProfile]{getLevel2BPAVDProfile}} function). A S4 object of class "data.table".} + +\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containing the Plant Area Volume Density profile data. +} +\description{ +This function clips GEDI level2B-derived +Plant Area Volume Density profile within given bounding coordinates +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# Get Plant Area Volume Density profile +level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) + +# Bounding rectangle coordinates +xmin = -44.15036 +xmax = -44.10066 +ymin = -13.75831 +ymax = -13.71244 + +# clip level2BVPM by extent boundary box +level2BPAVDProfile_clip <- clipLevel2BPAVDProfile(level2BPAVDProfile,xmin, xmax, ymin, ymax) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/clipLevel2BPAVDProfileGeometry.Rd b/man/clipLevel2BPAVDProfileGeometry.Rd index af5946e..19bd0cd 100644 --- a/man/clipLevel2BPAVDProfileGeometry.Rd +++ b/man/clipLevel2BPAVDProfileGeometry.Rd @@ -1,55 +1,55 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2BPAVDProfile.R -\name{clipLevel2BPAVDProfileGeometry} -\alias{clipLevel2BPAVDProfileGeometry} -\title{Clip level2BPAVDProfile data by geometry} -\usage{ -clipLevel2BPAVDProfileGeometry(level2BPAVDProfile, polygon_spdf, split_by) -} -\arguments{ -\item{level2BPAVDProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function). A S4 object of class "gedi.level2b".} - -\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, -which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{shapefile} package.} - -\item{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} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}}. -} -\description{ -This function clips GEDI level2B-derived -Plant Area Index profile within given geometry -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# Get Plant Area Volume Density profile -level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -# clip level2BPAIProfile by geometry -level2BPAVDProfile_clip <- clipLevel2BPAVDProfileGeometry( - level2BPAVDProfile, - polygon_spdf, - split_by="id") - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2BPAVDProfile.R +\name{clipLevel2BPAVDProfileGeometry} +\alias{clipLevel2BPAVDProfileGeometry} +\title{Clip level2BPAVDProfile data by geometry} +\usage{ +clipLevel2BPAVDProfileGeometry(level2BPAVDProfile, polygon_spdf, split_by) +} +\arguments{ +\item{level2BPAVDProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function). A S4 object of class "gedi.level2b".} + +\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, +which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{shapefile} package.} + +\item{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} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}}. +} +\description{ +This function clips GEDI level2B-derived +Plant Area Index profile within given geometry +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# Get Plant Area Volume Density profile +level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +# clip level2BPAIProfile by geometry +level2BPAVDProfile_clip <- clipLevel2BPAVDProfileGeometry( + level2BPAVDProfile, + polygon_spdf, + split_by="id") + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/clipLevel2BVPM.Rd b/man/clipLevel2BVPM.Rd index 66d56ee..f0410db 100644 --- a/man/clipLevel2BVPM.Rd +++ b/man/clipLevel2BVPM.Rd @@ -1,67 +1,67 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2BVPM.R -\name{clipLevel2BVPM} -\alias{clipLevel2BVPM} -\title{Clip level2BVPM data by Coordinates} -\usage{ -clipLevel2BVPM(level2BVPM, xmin, xmax, ymin, ymax) -} -\arguments{ -\item{level2BVPM}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "data.table".} - -\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containing the Canopy Cover and Vertical Profile metrics. -} -\description{ -This function clips GEDI level2B-derived -Canopy Cover and Vertical Profile metrics within given bounding coordinates -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# Get canopy cover and vertical profile metrics -level2BVPM<-getlevel2BVPM(level2b) - -# Bounding rectangle coordinates -xmin = -44.15036 -xmax = -44.10066 -ymin = -13.75831 -ymax = -13.71244 - -# clip level2BVPM by extent boundary box -level2b_clip <- level2BVPM(level2BVPM,xmin, xmax, ymin, ymax) - -library(leaflet) -leaflet() \%>\% - addCircleMarkers(level2b_clip@dt$longitude_bin0, - level2b_clip@dt$latitude_bin0, - radius = 1, - opacity = 1, - color = "red") \%>\% - addScaleBar(options = list(imperial = FALSE)) \%>\% - addPolygons(data=polygon_spdf,weight=1,col = 'white', - opacity = 1, fillOpacity = 0) \%>\% - addProviderTiles(providers$Esri.WorldImagery) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2BVPM.R +\name{clipLevel2BVPM} +\alias{clipLevel2BVPM} +\title{Clip level2BVPM data by Coordinates} +\usage{ +clipLevel2BVPM(level2BVPM, xmin, xmax, ymin, ymax) +} +\arguments{ +\item{level2BVPM}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "data.table".} + +\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containing the Canopy Cover and Vertical Profile metrics. +} +\description{ +This function clips GEDI level2B-derived +Canopy Cover and Vertical Profile metrics within given bounding coordinates +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# Get canopy cover and vertical profile metrics +level2BVPM<-getlevel2BVPM(level2b) + +# Bounding rectangle coordinates +xmin = -44.15036 +xmax = -44.10066 +ymin = -13.75831 +ymax = -13.71244 + +# clip level2BVPM by extent boundary box +level2b_clip <- level2BVPM(level2BVPM,xmin, xmax, ymin, ymax) + +library(leaflet) +leaflet() \%>\% + addCircleMarkers(level2b_clip@dt$longitude_bin0, + level2b_clip@dt$latitude_bin0, + radius = 1, + opacity = 1, + color = "red") \%>\% + addScaleBar(options = list(imperial = FALSE)) \%>\% + addPolygons(data=polygon_spdf,weight=1,col = 'white', + opacity = 1, fillOpacity = 0) \%>\% + addProviderTiles(providers$Esri.WorldImagery) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/clipLevel2BVPMGeometry.Rd b/man/clipLevel2BVPMGeometry.Rd index c0902ed..e47b916 100644 --- a/man/clipLevel2BVPMGeometry.Rd +++ b/man/clipLevel2BVPMGeometry.Rd @@ -1,74 +1,74 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clipLevel2BVPM.R -\name{clipLevel2BVPMGeometry} -\alias{clipLevel2BVPMGeometry} -\title{Clip level2BVPM data by geometry} -\usage{ -clipLevel2BVPMGeometry(level2BVPM, polygon_spdf, split_by) -} -\arguments{ -\item{level2BVPM}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level2b".} - -\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, -which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} - -\item{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} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}}. -} -\description{ -This function clips GEDI level2B-derived -Canopy Cover and Vertical Profile metrics within a given geometry -} -\examples{ -\dontrun{ -# specify the path to download GEDI example dataset -outdir<-getwd() - -# downloading GEDI example dataset (zip file) -download.file( - paste0( - "https://github.com/carlos-alberto-silva/rGEDI/", - "releases/download/examples/examples.zip" - ), - destfile=paste0(outdir,"/examples.zip")) - -# unzip the file -unzip(paste0(outdir,"\\\\examples.zip")) - -# specify the path to GEDI level2B data -level2bpath = paste0(outdir,"\\\\GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5") - -# Reading GEDI level1B file -level2b<-readLevel2b(gedilevel2b) - -# Get canopy cover and vertical profile metrics -level2BVPM<-getlevel2BVPM(level2b) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -# clip level2BVPM by geometry -level2b_clip_geometry <- clipLevel2BVPMGeometry(level2BVPM,polygon_spdf,split_by="id") - -library(leaflet) -leaflet() \%>\% - addCircleMarkers(level2b_clip_geometry@dt$longitude_bin0, - level2b_clip_geometry@dt$latitude_bin0, - radius = 1, - opacity = 1, - color = "red") \%>\% - addScaleBar(options = list(imperial = FALSE)) \%>\% - addPolygons(data=polygon_spdf,weight=1,col = 'white', - opacity = 1, fillOpacity = 0) \%>\% - addProviderTiles(providers$Esri.WorldImagery) -} -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clipLevel2BVPM.R +\name{clipLevel2BVPMGeometry} +\alias{clipLevel2BVPMGeometry} +\title{Clip level2BVPM data by geometry} +\usage{ +clipLevel2BVPMGeometry(level2BVPM, polygon_spdf, split_by) +} +\arguments{ +\item{level2BVPM}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level2b".} + +\item{polygon_spdf}{Polygon. An object of class \code{\link[sp]{SpatialPolygonsDataFrame-class}}, +which can be loaded as an ESRI shapefile using \code{\link[raster:shapefile]{raster::shapefile()}} function in the \emph{raster} package.} + +\item{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} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}}. +} +\description{ +This function clips GEDI level2B-derived +Canopy Cover and Vertical Profile metrics within a given geometry +} +\examples{ +\dontrun{ +# specify the path to download GEDI example dataset +outdir<-getwd() + +# downloading GEDI example dataset (zip file) +download.file( + paste0( + "https://github.com/carlos-alberto-silva/rGEDI/", + "releases/download/examples/examples.zip" + ), + destfile=paste0(outdir,"/examples.zip")) + +# unzip the file +unzip(paste0(outdir,"\\\\examples.zip")) + +# specify the path to GEDI level2B data +level2bpath = paste0(outdir,"\\\\GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5") + +# Reading GEDI level1B file +level2b<-readLevel2b(gedilevel2b) + +# Get canopy cover and vertical profile metrics +level2BVPM<-getlevel2BVPM(level2b) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "stands_cerrado.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +# clip level2BVPM by geometry +level2b_clip_geometry <- clipLevel2BVPMGeometry(level2BVPM,polygon_spdf,split_by="id") + +library(leaflet) +leaflet() \%>\% + addCircleMarkers(level2b_clip_geometry@dt$longitude_bin0, + level2b_clip_geometry@dt$latitude_bin0, + radius = 1, + opacity = 1, + color = "red") \%>\% + addScaleBar(options = list(imperial = FALSE)) \%>\% + addPolygons(data=polygon_spdf,weight=1,col = 'white', + opacity = 1, fillOpacity = 0) \%>\% + addProviderTiles(providers$Esri.WorldImagery) +} +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/gedi.fullwaveform-class.Rd b/man/gedi.fullwaveform-class.Rd index 59f27af..8122cca 100644 --- a/man/gedi.fullwaveform-class.Rd +++ b/man/gedi.fullwaveform-class.Rd @@ -1,16 +1,16 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class.gedi.R -\docType{class} -\name{gedi.fullwaveform-class} -\alias{gedi.fullwaveform-class} -\alias{gedi.fullwaveform} -\title{Class for GEDI level1B Full Waveform} -\description{ -Class for GEDI level1B Full Waveform -} -\section{Slots}{ - -\describe{ -\item{\code{dt}}{Object of class data.table from data.table package} -}} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/class.gedi.R +\docType{class} +\name{gedi.fullwaveform-class} +\alias{gedi.fullwaveform-class} +\alias{gedi.fullwaveform} +\title{Class for GEDI level1B Full Waveform} +\description{ +Class for GEDI level1B Full Waveform +} +\section{Slots}{ + +\describe{ +\item{\code{dt}}{Object of class data.table from data.table package} +}} diff --git a/man/gedi.level1b-class.Rd b/man/gedi.level1b-class.Rd index a89870f..abe600e 100644 --- a/man/gedi.level1b-class.Rd +++ b/man/gedi.level1b-class.Rd @@ -1,16 +1,16 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class.gedi.R -\docType{class} -\name{gedi.level1b-class} -\alias{gedi.level1b-class} -\alias{gedi.level1b} -\title{Class for GEDI level1B} -\description{ -Class for GEDI level1B -} -\section{Slots}{ - -\describe{ -\item{\code{h5}}{Object of class H5File from hdf5r package} -}} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/class.gedi.R +\docType{class} +\name{gedi.level1b-class} +\alias{gedi.level1b-class} +\alias{gedi.level1b} +\title{Class for GEDI level1B} +\description{ +Class for GEDI level1B +} +\section{Slots}{ + +\describe{ +\item{\code{h5}}{Object of class H5File from hdf5r package} +}} diff --git a/man/gedi.level1bSim-class.Rd b/man/gedi.level1bSim-class.Rd index 6266479..d09148f 100644 --- a/man/gedi.level1bSim-class.Rd +++ b/man/gedi.level1bSim-class.Rd @@ -1,16 +1,16 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class.gedi.R -\docType{class} -\name{gedi.level1bSim-class} -\alias{gedi.level1bSim-class} -\alias{gedi.level1bSim} -\title{Class for GEDI Full-Waveform Simulation} -\description{ -Class for GEDI Full-Waveform Simulation -} -\section{Slots}{ - -\describe{ -\item{\code{h5}}{Object of class H5File from hdf5r package} -}} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/class.gedi.R +\docType{class} +\name{gedi.level1bSim-class} +\alias{gedi.level1bSim-class} +\alias{gedi.level1bSim} +\title{Class for GEDI Full-Waveform Simulation} +\description{ +Class for GEDI Full-Waveform Simulation +} +\section{Slots}{ + +\describe{ +\item{\code{h5}}{Object of class H5File from hdf5r package} +}} diff --git a/man/gedi.level2a-class.Rd b/man/gedi.level2a-class.Rd index 82bb4e1..6b22e78 100644 --- a/man/gedi.level2a-class.Rd +++ b/man/gedi.level2a-class.Rd @@ -1,16 +1,16 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class.gedi.R -\docType{class} -\name{gedi.level2a-class} -\alias{gedi.level2a-class} -\alias{gedi.level2a} -\title{Class for GEDI level2A} -\description{ -Class for GEDI level2A -} -\section{Slots}{ - -\describe{ -\item{\code{h5}}{Object of class H5File from hdf5r package} -}} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/class.gedi.R +\docType{class} +\name{gedi.level2a-class} +\alias{gedi.level2a-class} +\alias{gedi.level2a} +\title{Class for GEDI level2A} +\description{ +Class for GEDI level2A +} +\section{Slots}{ + +\describe{ +\item{\code{h5}}{Object of class H5File from hdf5r package} +}} diff --git a/man/gedi.level2b-class.Rd b/man/gedi.level2b-class.Rd index 5651dc8..3af6378 100644 --- a/man/gedi.level2b-class.Rd +++ b/man/gedi.level2b-class.Rd @@ -1,16 +1,16 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class.gedi.R -\docType{class} -\name{gedi.level2b-class} -\alias{gedi.level2b-class} -\alias{gedi.level2b} -\title{Class for GEDI level2B} -\description{ -Class for GEDI level2B -} -\section{Slots}{ - -\describe{ -\item{\code{h5}}{Object of class H5File from hdf5r package} -}} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/class.gedi.R +\docType{class} +\name{gedi.level2b-class} +\alias{gedi.level2b-class} +\alias{gedi.level2b} +\title{Class for GEDI level2B} +\description{ +Class for GEDI level2B +} +\section{Slots}{ + +\describe{ +\item{\code{h5}}{Object of class H5File from hdf5r package} +}} diff --git a/man/gediWFMetrics.Rd b/man/gediWFMetrics.Rd index 4c03ed6..6e99931 100644 --- a/man/gediWFMetrics.Rd +++ b/man/gediWFMetrics.Rd @@ -1,218 +1,218 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/C_processExtractMetrics.R -\name{gediWFMetrics} -\alias{gediWFMetrics} -\title{GEDI full waveform data processing} -\usage{ -gediWFMetrics(input, outRoot, writeFit = FALSE, writeGauss = FALSE, - bounds = NULL, ground = FALSE, useInt = FALSE, useFrac = FALSE, - rhRes = 5, laiRes = 10, laiH = 30, noRHgauss = FALSE, gTol = 0, - fhdHistRes = 0.001, forcePsigma = FALSE, bayesGround = FALSE, - dontTrustGround = FALSE, noRoundCoord = FALSE, noCanopy = FALSE, - dcBias = 0, nSig = 0, seed = NULL, hNoise = 0, - linkNoise = NULL, linkFsig = NULL, linkPsig = NULL, - trueSig = NULL, bitRate = NULL, maxDN = NULL, renoise = FALSE, - newPsig = -1, oldPsig = 0.764331, addDrift = NULL, - missGround = FALSE, minGap = NULL, photonCount = FALSE, - pcl = FALSE, nPhotons = 2.1, photonWind = 200, noiseMult = 0.1, - rhoVrhoG = 1, nPhotC = 2.1, nPhotG = -1, photHDF = FALSE, - meanN = 0, thresh = 1e-14, varNoise = FALSE, varScale = NULL, - statsLen = NULL, noiseTrack = FALSE, sWidth = NULL, psWidth = 0, - msWidth = NULL, preMatchF = FALSE, postMatchF = FALSE, - pFile = NULL, gWidth = 1.2, minGsig = 0.764331, minWidth = 0, - medNoise = FALSE, varDrift = NULL, driftFac = NULL, rhoG = 0.4, - rhoC = 0.57, pSigma = NULL, gold = FALSE, deconTol = NULL) -} -\arguments{ -\item{input}{\code{\link[rGEDI:gedi.level1bSim-class]{gedi.level1bSim}} (may be a list of objects). Simulated waveform input object(s).} - -\item{outRoot}{name. output filename root} - -\item{writeFit}{write fitted waveform} - -\item{writeGauss}{write Gaussian parameters} - -\item{bounds}{minX minY maxX maxY. only analyse data within bounds} - -\item{ground}{read true ground from file} - -\item{useInt}{use discrete intensity instead of count} - -\item{useFrac}{use fractional hits rather than counts} - -\item{rhRes}{r. percentage energy resolution of RH metrics} - -\item{laiRes}{res. lai profile resolution in metres} - -\item{laiH}{h. height to calculate LAI to} - -\item{noRHgauss}{do not fit Gaussians} - -\item{gTol}{tol. ALS ground tolerance. Used to calculate slope.} - -\item{fhdHistRes}{res. waveform intensity resolution to use when calculating FHD from histograms} - -\item{forcePsigma}{do not read pulse sigma from file} - -\item{bayesGround}{use Bayseian ground finding} - -\item{dontTrustGround}{don't trust ground in waveforms, if included} - -\item{noRoundCoord}{do not round up coords when outputting} - -\item{noCanopy}{do not calculate FHD histograms and LAI profiles} - -\item{dcBias}{n. mean noise level} - -\item{nSig}{sig. noise sigma} - -\item{seed}{n. random number seed} - -\item{hNoise}{n. hard threshold noise as a fraction of integral} - -\item{linkNoise}{linkM cov. apply Gaussian noise based on link margin at a cover} - -\item{linkFsig}{sig. footprint width to use when calculating and applying signal noise} - -\item{linkPsig}{sig. pulse width to use when calculating and applying signal noise} - -\item{trueSig}{sig. true sigma of background noise} - -\item{bitRate}{n. digitisation bit rate} - -\item{maxDN}{max. maximum DN} - -\item{renoise}{remove noise from truth before applying new noise level} - -\item{newPsig}{sig. new value for pulse width, when lengthening pulse} - -\item{oldPsig}{sig. old value for pulse width if not defined in waveform file, when lengthening pulse} - -\item{addDrift}{xi. apply detector background drift} - -\item{missGround}{assume ground is missed to assess RH metrics} - -\item{minGap}{gap. delete signal beneath min detectable gap fraction} - -\item{photonCount}{output point cloud from photon counting} - -\item{pcl}{convert to photon counting pulsecompressed} - -\item{nPhotons}{n. mean number of photons} - -\item{photonWind}{x. window length for photon counting search, metres} - -\item{noiseMult}{x. noise multiplier for photoncounting} - -\item{rhoVrhoG}{x. ratio of canopy to ground reflectance at this wavelength. Not different from rhoV and rhoG} - -\item{nPhotC}{n. mean number of canopy photons (replaces nPhotons and rhoVrhoG)} - -\item{nPhotG}{n. mean number of ground photons (replaces nPhotons and rhoVrhoG)} - -\item{photHDF}{write photoncounting} - -\item{meanN}{n. mean noise level, if using a predefined mean level} - -\item{thresh}{n. noise threshold, if using a predefined noise threshold} - -\item{varNoise}{use a variable noise threshold} - -\item{varScale}{x. variable noise threshold scale (multiple of stdev above mean to set threshold)} - -\item{statsLen}{len. length to calculate noise stats over for varNoise} - -\item{noiseTrack}{use noise tracking} - -\item{sWidth}{sig. smoothing width, after densoising} - -\item{psWidth}{sigma. smoothing width, before denoising} - -\item{msWidth}{sig. smoothing width, after noise stats, before denoising} - -\item{preMatchF}{matched filter before denoising} - -\item{postMatchF}{matched filter after denoising} - -\item{pFile}{file. read pulse file, for deconvoltuion and matched filters} - -\item{gWidth}{sig. Gaussian parameter selection smoothing width} - -\item{minGsig}{sig. minimum Gaussian sigma to fit} - -\item{minWidth}{n. minimum feature width in bins} - -\item{medNoise}{use median stats rather than mean} - -\item{varDrift}{correct detector drift with variable factor} - -\item{driftFac}{xi. fix drift with constant drift factor} - -\item{rhoG}{rho. ground reflectance} - -\item{rhoC}{rho. canopy reflectance} - -\item{pSigma}{sig. pulse width to smooth by if using Gaussian pulse} - -\item{gold}{deconvolve with Gold's method} - -\item{deconTol}{deconvolution tolerance} -} -\value{ -A S4 object of class \code{\link[hdf5r:H5File-class]{hdf5r::H5File}} in the \emph{hdf5r} package. -} -\description{ -GEDI full waveform data processing and metrics extraction -} -\examples{ -libsAvailable = require(lidR) && require(plot3D) -if (libsAvailable) { - -# specify the path to ALS data (zip) -alsfile_Amazon_zip <- system.file("extdata", "Amazon.zip", package="rGEDI") -alsfile_Savanna_zip <- system.file("extdata", "Savanna.zip", package="rGEDI") - -# Unzipping ALS data -alsfile_Amazon_filepath <- unzip(alsfile_Amazon_zip,exdir = dirname(alsfile_Amazon_zip)) -alsfile_Savanna_filepath <- unzip(alsfile_Smazon_zip,exdir = dirname(alsfile_Savanna_zip)) - -# Reading and plot ALS file (las file) -als_Amazon<-readLAS(alsfile_Amazon_filepath) -als_Savanna<-readLAS(alsfile_Savanna_filepath) - -# Extracting plot center geolocations -xcenter_Amazon = mean(als_Amazon@bbox[1,]) -ycenter_Amazon = mean(als_Amazon@bbox[2,]) -xcenter_Savanna = mean(als_Savanna@bbox[1,]) -ycenter_Savanna = mean(als_Savanna@bbox[2,]) - -# Simulating GEDI full-waveform -wf_Amazon<-gediWFSimulator(input=lasfile_amazon, - output=paste0(getwd(),"/gediWF_amazon_simulation.h5"), - coords = c(xcenter_Amazon, ycenter_Amazon)) - -wf_Savanna<-gediWFSimulator(input=als_Savanna, - output=paste0(getwd(),"/gediWF_cerrado_simulation.h5"), - coords = c(xcenter_Savanna, ycenter_Savanna)) - -# Extracting GEDI feull-waveform derived metrics -wf_amazon_metrics<-gediWFMetrics(input=wf_amazon,outRoot=getwd()) -wf_cerrado_metrics<-gediWFMetrics(input=wf_cerrado,outRoot=getwd()) - -wf_amazon@h5$close() -wf_cerrado@h5$close() - -metrics<-rbind(wf_amazon_metrics,wf_cerrado_metrics) -rownames(metrics)<-c("Amazon","Cerrado") -head(metrics) -} - -} -\seealso{ -i) Hancock, S., Armston, J., Hofton, M., Sun, X., Tang, H., Duncanson, L.I., Kellner, -J.R. and Dubayah, R., 2019. The GEDI simulator: A large‐footprint waveform lidar simulator -for calibration and validation of spaceborne missions. Earth and Space Science. -https://doi.org/10.1029/2018EA000506 - -ii) gediSimulator: https://bitbucket.org/StevenHancock/gedisimulator/src/master/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/C_processExtractMetrics.R +\name{gediWFMetrics} +\alias{gediWFMetrics} +\title{GEDI full waveform data processing} +\usage{ +gediWFMetrics(input, outRoot, writeFit = FALSE, writeGauss = FALSE, + bounds = NULL, ground = FALSE, useInt = FALSE, useFrac = FALSE, + rhRes = 5, laiRes = 10, laiH = 30, noRHgauss = FALSE, gTol = 0, + fhdHistRes = 0.001, forcePsigma = FALSE, bayesGround = FALSE, + dontTrustGround = FALSE, noRoundCoord = FALSE, noCanopy = FALSE, + dcBias = 0, nSig = 0, seed = NULL, hNoise = 0, + linkNoise = NULL, linkFsig = NULL, linkPsig = NULL, + trueSig = NULL, bitRate = NULL, maxDN = NULL, renoise = FALSE, + newPsig = -1, oldPsig = 0.764331, addDrift = NULL, + missGround = FALSE, minGap = NULL, photonCount = FALSE, + pcl = FALSE, nPhotons = 2.1, photonWind = 200, noiseMult = 0.1, + rhoVrhoG = 1, nPhotC = 2.1, nPhotG = -1, photHDF = FALSE, + meanN = 0, thresh = 1e-14, varNoise = FALSE, varScale = NULL, + statsLen = NULL, noiseTrack = FALSE, sWidth = NULL, psWidth = 0, + msWidth = NULL, preMatchF = FALSE, postMatchF = FALSE, + pFile = NULL, gWidth = 1.2, minGsig = 0.764331, minWidth = 0, + medNoise = FALSE, varDrift = NULL, driftFac = NULL, rhoG = 0.4, + rhoC = 0.57, pSigma = NULL, gold = FALSE, deconTol = NULL) +} +\arguments{ +\item{input}{\code{\link[rGEDI:gedi.level1bSim-class]{gedi.level1bSim}} (may be a list of objects). Simulated waveform input object(s).} + +\item{outRoot}{name. output filename root} + +\item{writeFit}{write fitted waveform} + +\item{writeGauss}{write Gaussian parameters} + +\item{bounds}{minX minY maxX maxY. only analyse data within bounds} + +\item{ground}{read true ground from file} + +\item{useInt}{use discrete intensity instead of count} + +\item{useFrac}{use fractional hits rather than counts} + +\item{rhRes}{r. percentage energy resolution of RH metrics} + +\item{laiRes}{res. lai profile resolution in metres} + +\item{laiH}{h. height to calculate LAI to} + +\item{noRHgauss}{do not fit Gaussians} + +\item{gTol}{tol. ALS ground tolerance. Used to calculate slope.} + +\item{fhdHistRes}{res. waveform intensity resolution to use when calculating FHD from histograms} + +\item{forcePsigma}{do not read pulse sigma from file} + +\item{bayesGround}{use Bayseian ground finding} + +\item{dontTrustGround}{don't trust ground in waveforms, if included} + +\item{noRoundCoord}{do not round up coords when outputting} + +\item{noCanopy}{do not calculate FHD histograms and LAI profiles} + +\item{dcBias}{n. mean noise level} + +\item{nSig}{sig. noise sigma} + +\item{seed}{n. random number seed} + +\item{hNoise}{n. hard threshold noise as a fraction of integral} + +\item{linkNoise}{linkM cov. apply Gaussian noise based on link margin at a cover} + +\item{linkFsig}{sig. footprint width to use when calculating and applying signal noise} + +\item{linkPsig}{sig. pulse width to use when calculating and applying signal noise} + +\item{trueSig}{sig. true sigma of background noise} + +\item{bitRate}{n. digitisation bit rate} + +\item{maxDN}{max. maximum DN} + +\item{renoise}{remove noise from truth before applying new noise level} + +\item{newPsig}{sig. new value for pulse width, when lengthening pulse} + +\item{oldPsig}{sig. old value for pulse width if not defined in waveform file, when lengthening pulse} + +\item{addDrift}{xi. apply detector background drift} + +\item{missGround}{assume ground is missed to assess RH metrics} + +\item{minGap}{gap. delete signal beneath min detectable gap fraction} + +\item{photonCount}{output point cloud from photon counting} + +\item{pcl}{convert to photon counting pulsecompressed} + +\item{nPhotons}{n. mean number of photons} + +\item{photonWind}{x. window length for photon counting search, metres} + +\item{noiseMult}{x. noise multiplier for photoncounting} + +\item{rhoVrhoG}{x. ratio of canopy to ground reflectance at this wavelength. Not different from rhoV and rhoG} + +\item{nPhotC}{n. mean number of canopy photons (replaces nPhotons and rhoVrhoG)} + +\item{nPhotG}{n. mean number of ground photons (replaces nPhotons and rhoVrhoG)} + +\item{photHDF}{write photoncounting} + +\item{meanN}{n. mean noise level, if using a predefined mean level} + +\item{thresh}{n. noise threshold, if using a predefined noise threshold} + +\item{varNoise}{use a variable noise threshold} + +\item{varScale}{x. variable noise threshold scale (multiple of stdev above mean to set threshold)} + +\item{statsLen}{len. length to calculate noise stats over for varNoise} + +\item{noiseTrack}{use noise tracking} + +\item{sWidth}{sig. smoothing width, after densoising} + +\item{psWidth}{sigma. smoothing width, before denoising} + +\item{msWidth}{sig. smoothing width, after noise stats, before denoising} + +\item{preMatchF}{matched filter before denoising} + +\item{postMatchF}{matched filter after denoising} + +\item{pFile}{file. read pulse file, for deconvoltuion and matched filters} + +\item{gWidth}{sig. Gaussian parameter selection smoothing width} + +\item{minGsig}{sig. minimum Gaussian sigma to fit} + +\item{minWidth}{n. minimum feature width in bins} + +\item{medNoise}{use median stats rather than mean} + +\item{varDrift}{correct detector drift with variable factor} + +\item{driftFac}{xi. fix drift with constant drift factor} + +\item{rhoG}{rho. ground reflectance} + +\item{rhoC}{rho. canopy reflectance} + +\item{pSigma}{sig. pulse width to smooth by if using Gaussian pulse} + +\item{gold}{deconvolve with Gold's method} + +\item{deconTol}{deconvolution tolerance} +} +\value{ +A S4 object of class \code{\link[hdf5r:H5File-class]{hdf5r::H5File}} in the \emph{hdf5r} package. +} +\description{ +GEDI full waveform data processing and metrics extraction +} +\examples{ +libsAvailable = require(lidR) && require(plot3D) +if (libsAvailable) { + +# specify the path to ALS data (zip) +alsfile_Amazon_zip <- system.file("extdata", "Amazon.zip", package="rGEDI") +alsfile_Savanna_zip <- system.file("extdata", "Savanna.zip", package="rGEDI") + +# Unzipping ALS data +alsfile_Amazon_filepath <- unzip(alsfile_Amazon_zip,exdir = dirname(alsfile_Amazon_zip)) +alsfile_Savanna_filepath <- unzip(alsfile_Smazon_zip,exdir = dirname(alsfile_Savanna_zip)) + +# Reading and plot ALS file (las file) +als_Amazon<-readLAS(alsfile_Amazon_filepath) +als_Savanna<-readLAS(alsfile_Savanna_filepath) + +# Extracting plot center geolocations +xcenter_Amazon = mean(als_Amazon@bbox[1,]) +ycenter_Amazon = mean(als_Amazon@bbox[2,]) +xcenter_Savanna = mean(als_Savanna@bbox[1,]) +ycenter_Savanna = mean(als_Savanna@bbox[2,]) + +# Simulating GEDI full-waveform +wf_Amazon<-gediWFSimulator(input=lasfile_amazon, + output=paste0(getwd(),"/gediWF_amazon_simulation.h5"), + coords = c(xcenter_Amazon, ycenter_Amazon)) + +wf_Savanna<-gediWFSimulator(input=als_Savanna, + output=paste0(getwd(),"/gediWF_cerrado_simulation.h5"), + coords = c(xcenter_Savanna, ycenter_Savanna)) + +# Extracting GEDI feull-waveform derived metrics +wf_amazon_metrics<-gediWFMetrics(input=wf_amazon,outRoot=getwd()) +wf_cerrado_metrics<-gediWFMetrics(input=wf_cerrado,outRoot=getwd()) + +wf_amazon@h5$close() +wf_cerrado@h5$close() + +metrics<-rbind(wf_amazon_metrics,wf_cerrado_metrics) +rownames(metrics)<-c("Amazon","Cerrado") +head(metrics) +} + +} +\seealso{ +i) Hancock, S., Armston, J., Hofton, M., Sun, X., Tang, H., Duncanson, L.I., Kellner, +J.R. and Dubayah, R., 2019. The GEDI simulator: A large‐footprint waveform lidar simulator +for calibration and validation of spaceborne missions. Earth and Space Science. +https://doi.org/10.1029/2018EA000506 + +ii) gediSimulator: https://bitbucket.org/StevenHancock/gedisimulator/src/master/ +} diff --git a/man/gediWFSimulator.Rd b/man/gediWFSimulator.Rd index 7670ba4..e80385f 100644 --- a/man/gediWFSimulator.Rd +++ b/man/gediWFSimulator.Rd @@ -1,166 +1,166 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/C_simulateFullWaveform.R -\name{gediWFSimulator} -\alias{gediWFSimulator} -\title{GEDI full-waveform data simulation} -\usage{ -gediWFSimulator(input, output, waveID = NULL, coords = NULL, - listCoord = NULL, gridBound = NULL, gridStep = 30, pSigma = -1, - pFWHM = 15, readPulse = NULL, fSigma = 5.5, wavefront = NULL, - res = 0.15, topHat = FALSE, sideLobe = FALSE, lobeAng = 0, - checkCover = FALSE, maxScanAng = 1e+06, decimate = 1, - pBuff = as.integer(2e+08), maxBins = as.integer(1024), - countOnly = FALSE, pulseAfter = FALSE, pulseBefore = TRUE, - noNorm = FALSE, noOctree = FALSE, octLevels = as.integer(0), - nOctPix = as.integer(40), keepOld = FALSE, useShadow = FALSE, - polyGround = FALSE, seed = NULL) -} -\arguments{ -\item{input}{character vector. lasfile input filename} - -\item{output}{character. output filename} - -\item{waveID}{id. supply a waveID to pass to the output (only for single footprints) -Single footprint, list of footprints, or grid of footprints} - -\item{coords}{lon lat numeric vector. footprint coordinate in same system as lasfile} - -\item{listCoord}{name. Text file with list of coordinates. Pattern: X Y `[waveID]` `[geoCoordsX]` `[geoCoordsY]`. `[]` are optional, separated by spaces.} - -\item{gridBound}{minX maxX minY maxY numeric vector. make a grid of waveforms in this box} - -\item{gridStep}{res. grid step size -Lidar characteristics. Defaults are expected GEDI values.} - -\item{pSigma}{pSigmasig. set Gaussian pulse width as 1 sigma} - -\item{pFWHM}{fhwm. set Gaussian pulse width as FWHM in ns} - -\item{readPulse}{file. read pulse shape and width from a file insteda of making Gaussian} - -\item{fSigma}{sig. set footprint width} - -\item{wavefront}{file. read wavefront shape from file instead of setting Gaussian. Note that footprint width is still set by fSigma} - -\item{res}{res. range resolution of waveform digitisation to output, in units of ALS data} - -\item{topHat}{use a top hat wavefront} - -\item{sideLobe}{use side lobes} - -\item{lobeAng}{ang. lobe axis azimuth -Input data quality filters} - -\item{checkCover}{check that the footprint is covered by ALS data. Do not output if not} - -\item{maxScanAng}{ang. maximum scan angle, degrees} - -\item{decimate}{x. probability of accepting an ALS beam -Computational speed options} - -\item{pBuff}{s. point reading buffer size in Gbytes} - -\item{maxBins}{for HDF5, limit number of bins to save trimming.} - -\item{countOnly}{only use count method} - -\item{pulseAfter}{apply the pulse smoothing after binning for computational speed, at the risk of aliasing (default)} - -\item{pulseBefore}{apply the pulse smoothing before binning to avoid the risk of aliasing, at the expense of computational speed} - -\item{noNorm}{don't normalise for ALS density -Octree} - -\item{noOctree}{do not use an octree} - -\item{octLevels}{n. number of octree levels to use} - -\item{nOctPix}{n. number of octree pixels along a side for the top level -Using full-waveform input data (not tested)} - -\item{keepOld}{do not overwrite old files, if they exist} - -\item{useShadow}{account for shadowing in discrete return data through voxelisation} - -\item{polyGround}{find mean ground elevation and slope through fitting a polynomial} - -\item{seed}{n integer. random number seed - -#'} -} -\value{ -A S4 object of class \code{\link[hdf5r:H5File-class]{hdf5r::H5File}} in the \emph{hdf5r} package. -} -\description{ -Simulate GEDI full-waveform data from Airborne Laser Scanning (ALS) 3-D point cloud - -Input and output filenames, and formats -} -\examples{ -libsAvailable = require(lidR) && require(plot3D) -if (libsAvailable) { - -# specify the path to ALS data (zip) -alsfile_Amazon_zip <- system.file("extdata", "Amazon.zip", package="rGEDI") -alsfile_Savanna_zip <- system.file("extdata", "Savanna.zip", package="rGEDI") - -# Unzipping ALS data -alsfile_Amazon_filepath <- unzip(alsfile_Amazon_zip,exdir = dirname(alsfile_Amazon_zip)) -alsfile_Savanna_filepath <- unzip(alsfile_Smazon_zip,exdir = dirname(alsfile_Savanna_zip)) - -# Reading and plot ALS file (las file) -als_Amazon<-readLAS(alsfile_Amazon_filepath) -als_Savanna<-readLAS(alsfile_Savanna_filepath) - -# Extracting plot center geolocations -xcenter_Amazon = mean(als_Amazon@bbox[1,]) -ycenter_Amazon = mean(als_Amazon@bbox[2,]) -xcenter_Savanna = mean(als_Savanna@bbox[1,]) -ycenter_Savanna = mean(als_Savanna@bbox[2,]) - -# Simulating GEDI full-waveform -wf_Amazon<-gediWFSimulator(input=lasfile_amazon, - output=paste0(getwd(),"/gediWF_amazon_simulation.h5"), - coords = c(xcenter_Amazon, ycenter_Amazon)) - -wf_Savanna<-gediWFSimulator(input=als_Savanna, - output=paste0(getwd(),"/gediWF_cerrado_simulation.h5"), - coords = c(xcenter_Savanna, ycenter_Savanna)) - -# Plot ALS and GEDI simulated full-waveform - -par(mfrow=c(2,2), mar=c(4,4,0,0), oma=c(0,0,1,1),cex.axis = 1.2) -scatter3D( - als_Amazon@data$X,als_Amazon@data$Y,als_Amazon@data$Z, - pch = 16,colkey = FALSE, main="", - cex = 0.5,bty = "u",col.panel ="gray90", - phi = 30,alpha=1,theta=45,col.grid = "gray50", - xlab="UTM Easting (m)", ylab="UTM Northing (m)", zlab="Elevation (m)") - -plot(wf_Amazon, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="forestgreen", - xlab="", ylab="Elevation (m)", ylim=c(90,140)) -grid() -scatter3D( - als_Savanna@data$X,als_Savanna@data$Y,als_Savanna@data$Z, - pch = 16,colkey = FALSE, main="", - cex = 0.5,bty = "u",col.panel ="gray90", - phi = 30,alpha=1,theta=45,col.grid = "gray50", - xlab="UTM Easting (m)", ylab="UTM Northing (m)", zlab="Elevation (m)") - -plot(wf_Savanna, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="green", - xlab="Waveform Amplitude (\%)", ylab="Elevation (m)", ylim=c(815,835)) -grid() - -wf_Amazon@h5$close_all() -wf_Savanna@h5$close_all() -} - -} -\seealso{ -i) Hancock, S., Armston, J., Hofton, M., Sun, X., Tang, H., Duncanson, L.I., Kellner, -J.R. and Dubayah, R., 2019. The GEDI simulator: A large‐footprint waveform lidar simulator -for calibration and validation of spaceborne missions. Earth and Space Science. -https://doi.org/10.1029/2018EA000506 - -ii) gediSimulator: https://bitbucket.org/StevenHancock/gedisimulator/src/master/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/C_simulateFullWaveform.R +\name{gediWFSimulator} +\alias{gediWFSimulator} +\title{GEDI full-waveform data simulation} +\usage{ +gediWFSimulator(input, output, waveID = NULL, coords = NULL, + listCoord = NULL, gridBound = NULL, gridStep = 30, pSigma = -1, + pFWHM = 15, readPulse = NULL, fSigma = 5.5, wavefront = NULL, + res = 0.15, topHat = FALSE, sideLobe = FALSE, lobeAng = 0, + checkCover = FALSE, maxScanAng = 1e+06, decimate = 1, + pBuff = as.integer(2e+08), maxBins = as.integer(1024), + countOnly = FALSE, pulseAfter = FALSE, pulseBefore = TRUE, + noNorm = FALSE, noOctree = FALSE, octLevels = as.integer(0), + nOctPix = as.integer(40), keepOld = FALSE, useShadow = FALSE, + polyGround = FALSE, seed = NULL) +} +\arguments{ +\item{input}{character vector. lasfile input filename} + +\item{output}{character. output filename} + +\item{waveID}{id. supply a waveID to pass to the output (only for single footprints) +Single footprint, list of footprints, or grid of footprints} + +\item{coords}{lon lat numeric vector. footprint coordinate in same system as lasfile} + +\item{listCoord}{name. Text file with list of coordinates. Pattern: X Y `[waveID]` `[geoCoordsX]` `[geoCoordsY]`. `[]` are optional, separated by spaces.} + +\item{gridBound}{minX maxX minY maxY numeric vector. make a grid of waveforms in this box} + +\item{gridStep}{res. grid step size +Lidar characteristics. Defaults are expected GEDI values.} + +\item{pSigma}{pSigmasig. set Gaussian pulse width as 1 sigma} + +\item{pFWHM}{fhwm. set Gaussian pulse width as FWHM in ns} + +\item{readPulse}{file. read pulse shape and width from a file insteda of making Gaussian} + +\item{fSigma}{sig. set footprint width} + +\item{wavefront}{file. read wavefront shape from file instead of setting Gaussian. Note that footprint width is still set by fSigma} + +\item{res}{res. range resolution of waveform digitisation to output, in units of ALS data} + +\item{topHat}{use a top hat wavefront} + +\item{sideLobe}{use side lobes} + +\item{lobeAng}{ang. lobe axis azimuth +Input data quality filters} + +\item{checkCover}{check that the footprint is covered by ALS data. Do not output if not} + +\item{maxScanAng}{ang. maximum scan angle, degrees} + +\item{decimate}{x. probability of accepting an ALS beam +Computational speed options} + +\item{pBuff}{s. point reading buffer size in Gbytes} + +\item{maxBins}{for HDF5, limit number of bins to save trimming.} + +\item{countOnly}{only use count method} + +\item{pulseAfter}{apply the pulse smoothing after binning for computational speed, at the risk of aliasing (default)} + +\item{pulseBefore}{apply the pulse smoothing before binning to avoid the risk of aliasing, at the expense of computational speed} + +\item{noNorm}{don't normalise for ALS density +Octree} + +\item{noOctree}{do not use an octree} + +\item{octLevels}{n. number of octree levels to use} + +\item{nOctPix}{n. number of octree pixels along a side for the top level +Using full-waveform input data (not tested)} + +\item{keepOld}{do not overwrite old files, if they exist} + +\item{useShadow}{account for shadowing in discrete return data through voxelisation} + +\item{polyGround}{find mean ground elevation and slope through fitting a polynomial} + +\item{seed}{n integer. random number seed + +#'} +} +\value{ +A S4 object of class \code{\link[hdf5r:H5File-class]{hdf5r::H5File}} in the \emph{hdf5r} package. +} +\description{ +Simulate GEDI full-waveform data from Airborne Laser Scanning (ALS) 3-D point cloud + +Input and output filenames, and formats +} +\examples{ +libsAvailable = require(lidR) && require(plot3D) +if (libsAvailable) { + +# specify the path to ALS data (zip) +alsfile_Amazon_zip <- system.file("extdata", "Amazon.zip", package="rGEDI") +alsfile_Savanna_zip <- system.file("extdata", "Savanna.zip", package="rGEDI") + +# Unzipping ALS data +alsfile_Amazon_filepath <- unzip(alsfile_Amazon_zip,exdir = dirname(alsfile_Amazon_zip)) +alsfile_Savanna_filepath <- unzip(alsfile_Smazon_zip,exdir = dirname(alsfile_Savanna_zip)) + +# Reading and plot ALS file (las file) +als_Amazon<-readLAS(alsfile_Amazon_filepath) +als_Savanna<-readLAS(alsfile_Savanna_filepath) + +# Extracting plot center geolocations +xcenter_Amazon = mean(als_Amazon@bbox[1,]) +ycenter_Amazon = mean(als_Amazon@bbox[2,]) +xcenter_Savanna = mean(als_Savanna@bbox[1,]) +ycenter_Savanna = mean(als_Savanna@bbox[2,]) + +# Simulating GEDI full-waveform +wf_Amazon<-gediWFSimulator(input=lasfile_amazon, + output=paste0(getwd(),"/gediWF_amazon_simulation.h5"), + coords = c(xcenter_Amazon, ycenter_Amazon)) + +wf_Savanna<-gediWFSimulator(input=als_Savanna, + output=paste0(getwd(),"/gediWF_cerrado_simulation.h5"), + coords = c(xcenter_Savanna, ycenter_Savanna)) + +# Plot ALS and GEDI simulated full-waveform + +par(mfrow=c(2,2), mar=c(4,4,0,0), oma=c(0,0,1,1),cex.axis = 1.2) +scatter3D( + als_Amazon@data$X,als_Amazon@data$Y,als_Amazon@data$Z, + pch = 16,colkey = FALSE, main="", + cex = 0.5,bty = "u",col.panel ="gray90", + phi = 30,alpha=1,theta=45,col.grid = "gray50", + xlab="UTM Easting (m)", ylab="UTM Northing (m)", zlab="Elevation (m)") + +plot(wf_Amazon, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="forestgreen", + xlab="", ylab="Elevation (m)", ylim=c(90,140)) +grid() +scatter3D( + als_Savanna@data$X,als_Savanna@data$Y,als_Savanna@data$Z, + pch = 16,colkey = FALSE, main="", + cex = 0.5,bty = "u",col.panel ="gray90", + phi = 30,alpha=1,theta=45,col.grid = "gray50", + xlab="UTM Easting (m)", ylab="UTM Northing (m)", zlab="Elevation (m)") + +plot(wf_Savanna, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="green", + xlab="Waveform Amplitude (\%)", ylab="Elevation (m)", ylim=c(815,835)) +grid() + +wf_Amazon@h5$close_all() +wf_Savanna@h5$close_all() +} + +} +\seealso{ +i) Hancock, S., Armston, J., Hofton, M., Sun, X., Tang, H., Duncanson, L.I., Kellner, +J.R. and Dubayah, R., 2019. The GEDI simulator: A large‐footprint waveform lidar simulator +for calibration and validation of spaceborne missions. Earth and Space Science. +https://doi.org/10.1029/2018EA000506 + +ii) gediSimulator: https://bitbucket.org/StevenHancock/gedisimulator/src/master/ +} diff --git a/man/gedifinder.Rd b/man/gedifinder.Rd index 8db46bd..4459142 100644 --- a/man/gedifinder.Rd +++ b/man/gedifinder.Rd @@ -1,44 +1,44 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gedifinder.R -\name{gedifinder} -\alias{gedifinder} -\title{GEDI finder} -\usage{ -gedifinder(level, xmin, xmax, ymin, ymax) -} -\arguments{ -\item{level}{GEDI data level; Options: "GEDI01_B", "GEDI02_A" or "GEDI02_B"} - -\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} - -\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} -} -\value{ -vector object pointing out the path for download GEDI data within -the boundary box coordinates provided -} -\description{ -This function finds the path to GEDI data within a boundary box coordinates provided - -#'@usage gedifinder(level="GEDI02_B",xmin,xmax,ymin,ymax) -} -\examples{ - -# specify bounding box coordinates -xmin<- -44.17246 -ymin<- -44.0654 -xmax<- -13.76913 -ymax<- -13.67646 - -# Getting the path to GEDI data for the specified boundary box coordinates -gedi02b_list<-gedifinder(level="GEDI02_B",xmin,xmax,ymin,ymax) - -} -\seealso{ -This function just call the gedifilder tool developted by LPDAAC: -https://lpdaacsvc.cr.usgs.gov/services/gedifinder -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/gedifinder.R +\name{gedifinder} +\alias{gedifinder} +\title{GEDI finder} +\usage{ +gedifinder(level, xmin, xmax, ymin, ymax) +} +\arguments{ +\item{level}{GEDI data level; Options: "GEDI01_B", "GEDI02_A" or "GEDI02_B"} + +\item{xmin}{Numeric. West longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{xmax}{Numeric. East longitude (x) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymin}{Numeric. South latitude (y) coordinate of bounding rectangle, in decimal degrees.} + +\item{ymax}{Numeric. North latitude (y) coordinate of bounding rectangle, in decimal degrees.} +} +\value{ +vector object pointing out the path for download GEDI data within +the boundary box coordinates provided +} +\description{ +This function finds the path to GEDI data within a boundary box coordinates provided + +#'@usage gedifinder(level="GEDI02_B",xmin,xmax,ymin,ymax) +} +\examples{ + +# specify bounding box coordinates +xmin<- -44.17246 +ymin<- -44.0654 +xmax<- -13.76913 +ymax<- -13.67646 + +# Getting the path to GEDI data for the specified boundary box coordinates +gedi02b_list<-gedifinder(level="GEDI02_B",xmin,xmax,ymin,ymax) + +} +\seealso{ +This function just call the gedifilder tool developted by LPDAAC: +https://lpdaacsvc.cr.usgs.gov/services/gedifinder +} diff --git a/man/getLevel1BGeo.Rd b/man/getLevel1BGeo.Rd index 86019b9..a4369e1 100644 --- a/man/getLevel1BGeo.Rd +++ b/man/getLevel1BGeo.Rd @@ -1,126 +1,126 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getLevel1BGeo.R -\name{getLevel1BGeo} -\alias{getLevel1BGeo} -\title{Get GEDI Pulse Full-Waveform Geolocations (GEDI Level1B)} -\usage{ -getLevel1BGeo(level1b, select) -} -\arguments{ -\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} - -\item{select}{A character vector specifying the fields to extract from GEDI Level1B data. If NULL, -by default it will extract \emph{latitude_bin0}, \emph{latitude_lastbin}, \emph{longitude_bin0}, \emph{longitude_lastbin}, and \emph{shot_number}. See details for more options.} -} -\value{ -A S4 object of class \code{\link[data.table:data.table]{data.table-class}} containing -} -\description{ -This function extracts Pulse Full-Waveform Geolocations from GEDI Level1B data -} -\details{ -Besides of the fields specified as defaul, GEDI mission level 1B description (https://lpdaac.usgs.gov/products/gedi01_bv001/) details all the information that can be extracted: -\itemize{ -\item \emph{all_samples_sum Sum} - of all values within the 10 km range window. -\item \emph{beam} - Beam number Number. -\item \emph{channel} - Channel number. -\item \emph{master_frac} - Master time, fractional part. -\item \emph{master_int} - Master time, integer part. -\item \emph{noise_mean_corrected} - Noise mean. -\item \emph{noise_stddev_corrected} - Corrected noise standard deviation. -\item \emph{nsemean_even} - Noise mean of the beam's detector channel from even sub-converte. -\item \emph{nsemean_odd} - Noise mean of the beam's odd sub-converter. -\item \emph{rx_energy} - Integrated energy in receive (RX) waveform after subtracting the noise mean. -\item \emph{rx_offset} - Time interval from first stored sample to first downloaded RX sample. -\item \emph{rx_open} - Time interval from time 0 to first stored RX sample. -\item \emph{rx_sample_count} - The number of sample intervals (elements) in each RX waveform. -\item \emph{rx_sample_start_index} - The index in the rxwaveform dataset of the first element of each RX waveform starting at 1. -\item \emph{selection_stretchers_x} - Commanded number of samples added to algorithm section on the left. -\item \emph{selection_stretchers_y} - Commanded number of samples added to algorithm section on the right. -\item \emph{shot_number} - Unique shot identifier. -\item \emph{stale_return_flag} - Indicates that a "stale" cue point from the coarse search algorithm is being used. -\item \emph{th_left_used} - Count values for left threshold used in fine search where two consecutive points at or above this value indicates pulse detection. -\item \emph{tx_egamplitude} - Amplitude of the extended Gaussian fit to the transmit (TX) waveform. -\item \emph{tx_egamplitude_error} - Error on tx_egamplitude. -\item \emph{tx_egbias} - Bias of the extended Gaussian fit to the TX waveform. -\item \emph{tx_egbias_error} - Error on tx_egbias. -\item \emph{tx_egflag} - Extended Gaussian fit status flag. -\item \emph{tx_eggamma} - Gamma value of the extended Gaussian fit to the TX waveform. -\item \emph{tx_eggamma_error} - Error on tx_eggamma. -\item \emph{tx_egsigma} - Sigma of the extended Gaussian fit to the TX waveform. -\item \emph{tx_egsigma_error} - Error on tx_egsigma. -\item \emph{tx_gloc} - Location (mean) of the Gaussian fit to the TX waveform. -\item \emph{tx_gloc_error} - Error on tx_gloc. -\item \emph{tx_pulseflag} - Set to 1 if a pulse is detected in the TX waveform. -\item \emph{tx_sample_count} - The number of sample intervals (elements) in each transmit waveform. -\item \emph{tx_sample_start_index} - The index in the rxwaveform dataset of the first element of each RX waveform starting at 1. -\item \emph{altitude_instrument} - Height of the instrument diffractive optical element (DOE) above the WGS84 ellipsoid. -\item \emph{altitude_instrument_error} - Error on altitude_instrument. -\item \emph{bounce_time_offset_bin0} - The difference between the TX time and the time at the start of the RX window. -\item \emph{bounce_time_offset_bin0_error} - Error on bounce_time_offset_bin0. -\item \emph{bounce_time_offset_lastbin} - The difference between the TX time and the time at the end of the RX window. -\item \emph{bounce_time_offset_lastbin_error} - Error on bounce_time_offset_lastbin. -\item \emph{degrade} - Greater than zero if the shot occurs during a degrade period, zero otherwise. -\item \emph{delta_time} - Transmit time of the shot, measured in seconds since 2018-01-01. -\item \emph{digital_elevation_model} - Digital elevation model height above the WGS84 ellipsoid. -\item \emph{elevation_bin0} - Height of the start of the RX window, relative to the WGS-84 ellipsoid. -\item \emph{elevation_bin0_error} - Error on elevation_bin0. -\item \emph{elevation_lastbin} - Height of the end of the RX window, relative to the WGS-84 ellipsoid. -\item \emph{elevation_lastbin_error} - Error on elevation_lastbin. -\item \emph{latitude_bin0} - Latitude of the start of the RX window. -\item \emph{latitude_bin0_error} - Error on latitude_bin0. -\item \emph{latitude_lastbin} - Latitude of the end of the RX window. -\item \emph{latitude_lastbin_error} - Error on latitude_lastbin. -\item \emph{latitude_instrument} - Latitude of the instrument diffractive optical element (DOE) at laser transmit time. -\item \emph{latitude_instrument_error} - Error on latitude_instrument. -\item \emph{local_beam_azimuth} - Azimuth of the unit pointing vector for the laser in the local East, North, Up (ENU) frame. -\item \emph{local_beam_azimuth_error} - Error on local_beam_azimuth. -\item \emph{local_beam_elevation} - Elevation of the unit pointing vector for the laser in the local ENU frame. -\item \emph{local_beam_elevation_error} - Error on local_beam_elevation. -\item \emph{longitude_bin0} - Longitude of the start of the RX window. -\item \emph{longitude_bin0_error} - Error on longitude_bin0. -\item \emph{longitude_lastbin} - Longitude of the end of the RX window. -\item \emph{longitude_lastbin_error} - Error on longitude_lastbin. -\item \emph{longitude_instrument} - Longitude of the instrument diffractive optical element (DOE) at laser transmit time. -\item \emph{longitude_instrument_error} - Error on longitude_instrument. -\item \emph{mean_sea_surface} - Mean sea surface height above the WGS84 ellipsoid, includes the geoid . -\item \emph{neutat_delay_derivative_bin0} - Change in neutral atmospheric delay per height change for the start of the RX window. -\item \emph{neutat_delay_derivative_lastbin} - Change in neutral atmospheric delay per height change for the end of the RX window. -\item \emph{neutat_delay_total_bin0} - Total neutral atmosphere delay correction (wet+dry) from the TX pulse tothe start of the RX window. -\item \emph{neutat_delay_total_lastbin} - Total neutral atmosphere delay correction (wet+dry) from the TX pulse tothe end of the RX window. -\item \emph{range_bias_correction} - The range bias applied to the range measurement. -\item \emph{shot_number} - Unique shot identifier Number. -\item \emph{solar_azimuth} - The azimuth of the sun position vector. -\item \emph{solar_elevation} - The elevation of the sun position vector. -\item \emph{surface_type} - Flags describing which surface types. -\item \emph{delta_time} - Transmit time of the shot. -\item \emph{dynamic_atmosphere_correction} - Dynamic Atmospheric Correction (DAC) includes inverted barometer (IB) effect. -\item \emph{geoid} - Geoid height above WGS-84 reference ellipsoid. -\item \emph{tide_earth} - Solid Earth tides. -\item \emph{tide_load} - Load Tide - Local displacement due to Ocean Loading. -\item \emph{tide_ocean} - Ocean Tides including diurnal and semi-diurnal, and longerperiod tides. -\item \emph{tide_ocean_pole} - Oceanic surface rotational deformation due to polar motion. -\item \emph{tide_pole} - Solid Earth Pole Tide -- Rotational deformation due to polar motion. -} -} -\examples{ -# specify 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 = dirname(level1B_fp_zip)) - -# Reading GEDI level1B data (h5 file) -level1b<-readLevel1B(level1Bpath=level1Bpath) - -# Get GEDI level1B geolocations -level1bGeo<-getLevel1BGeo(level1b,select=c("elevation_bin0", "elevation_lastbin")) -head(level1bGeo) - - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi01_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/getLevel1BGeo.R +\name{getLevel1BGeo} +\alias{getLevel1BGeo} +\title{Get GEDI Pulse Full-Waveform Geolocations (GEDI Level1B)} +\usage{ +getLevel1BGeo(level1b, select) +} +\arguments{ +\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} + +\item{select}{A character vector specifying the fields to extract from GEDI Level1B data. If NULL, +by default it will extract \emph{latitude_bin0}, \emph{latitude_lastbin}, \emph{longitude_bin0}, \emph{longitude_lastbin}, and \emph{shot_number}. See details for more options.} +} +\value{ +A S4 object of class \code{\link[data.table:data.table]{data.table-class}} containing +} +\description{ +This function extracts Pulse Full-Waveform Geolocations from GEDI Level1B data +} +\details{ +Besides of the fields specified as defaul, GEDI mission level 1B description (https://lpdaac.usgs.gov/products/gedi01_bv001/) details all the information that can be extracted: +\itemize{ +\item \emph{all_samples_sum Sum} - of all values within the 10 km range window. +\item \emph{beam} - Beam number Number. +\item \emph{channel} - Channel number. +\item \emph{master_frac} - Master time, fractional part. +\item \emph{master_int} - Master time, integer part. +\item \emph{noise_mean_corrected} - Noise mean. +\item \emph{noise_stddev_corrected} - Corrected noise standard deviation. +\item \emph{nsemean_even} - Noise mean of the beam's detector channel from even sub-converte. +\item \emph{nsemean_odd} - Noise mean of the beam's odd sub-converter. +\item \emph{rx_energy} - Integrated energy in receive (RX) waveform after subtracting the noise mean. +\item \emph{rx_offset} - Time interval from first stored sample to first downloaded RX sample. +\item \emph{rx_open} - Time interval from time 0 to first stored RX sample. +\item \emph{rx_sample_count} - The number of sample intervals (elements) in each RX waveform. +\item \emph{rx_sample_start_index} - The index in the rxwaveform dataset of the first element of each RX waveform starting at 1. +\item \emph{selection_stretchers_x} - Commanded number of samples added to algorithm section on the left. +\item \emph{selection_stretchers_y} - Commanded number of samples added to algorithm section on the right. +\item \emph{shot_number} - Unique shot identifier. +\item \emph{stale_return_flag} - Indicates that a "stale" cue point from the coarse search algorithm is being used. +\item \emph{th_left_used} - Count values for left threshold used in fine search where two consecutive points at or above this value indicates pulse detection. +\item \emph{tx_egamplitude} - Amplitude of the extended Gaussian fit to the transmit (TX) waveform. +\item \emph{tx_egamplitude_error} - Error on tx_egamplitude. +\item \emph{tx_egbias} - Bias of the extended Gaussian fit to the TX waveform. +\item \emph{tx_egbias_error} - Error on tx_egbias. +\item \emph{tx_egflag} - Extended Gaussian fit status flag. +\item \emph{tx_eggamma} - Gamma value of the extended Gaussian fit to the TX waveform. +\item \emph{tx_eggamma_error} - Error on tx_eggamma. +\item \emph{tx_egsigma} - Sigma of the extended Gaussian fit to the TX waveform. +\item \emph{tx_egsigma_error} - Error on tx_egsigma. +\item \emph{tx_gloc} - Location (mean) of the Gaussian fit to the TX waveform. +\item \emph{tx_gloc_error} - Error on tx_gloc. +\item \emph{tx_pulseflag} - Set to 1 if a pulse is detected in the TX waveform. +\item \emph{tx_sample_count} - The number of sample intervals (elements) in each transmit waveform. +\item \emph{tx_sample_start_index} - The index in the rxwaveform dataset of the first element of each RX waveform starting at 1. +\item \emph{altitude_instrument} - Height of the instrument diffractive optical element (DOE) above the WGS84 ellipsoid. +\item \emph{altitude_instrument_error} - Error on altitude_instrument. +\item \emph{bounce_time_offset_bin0} - The difference between the TX time and the time at the start of the RX window. +\item \emph{bounce_time_offset_bin0_error} - Error on bounce_time_offset_bin0. +\item \emph{bounce_time_offset_lastbin} - The difference between the TX time and the time at the end of the RX window. +\item \emph{bounce_time_offset_lastbin_error} - Error on bounce_time_offset_lastbin. +\item \emph{degrade} - Greater than zero if the shot occurs during a degrade period, zero otherwise. +\item \emph{delta_time} - Transmit time of the shot, measured in seconds since 2018-01-01. +\item \emph{digital_elevation_model} - Digital elevation model height above the WGS84 ellipsoid. +\item \emph{elevation_bin0} - Height of the start of the RX window, relative to the WGS-84 ellipsoid. +\item \emph{elevation_bin0_error} - Error on elevation_bin0. +\item \emph{elevation_lastbin} - Height of the end of the RX window, relative to the WGS-84 ellipsoid. +\item \emph{elevation_lastbin_error} - Error on elevation_lastbin. +\item \emph{latitude_bin0} - Latitude of the start of the RX window. +\item \emph{latitude_bin0_error} - Error on latitude_bin0. +\item \emph{latitude_lastbin} - Latitude of the end of the RX window. +\item \emph{latitude_lastbin_error} - Error on latitude_lastbin. +\item \emph{latitude_instrument} - Latitude of the instrument diffractive optical element (DOE) at laser transmit time. +\item \emph{latitude_instrument_error} - Error on latitude_instrument. +\item \emph{local_beam_azimuth} - Azimuth of the unit pointing vector for the laser in the local East, North, Up (ENU) frame. +\item \emph{local_beam_azimuth_error} - Error on local_beam_azimuth. +\item \emph{local_beam_elevation} - Elevation of the unit pointing vector for the laser in the local ENU frame. +\item \emph{local_beam_elevation_error} - Error on local_beam_elevation. +\item \emph{longitude_bin0} - Longitude of the start of the RX window. +\item \emph{longitude_bin0_error} - Error on longitude_bin0. +\item \emph{longitude_lastbin} - Longitude of the end of the RX window. +\item \emph{longitude_lastbin_error} - Error on longitude_lastbin. +\item \emph{longitude_instrument} - Longitude of the instrument diffractive optical element (DOE) at laser transmit time. +\item \emph{longitude_instrument_error} - Error on longitude_instrument. +\item \emph{mean_sea_surface} - Mean sea surface height above the WGS84 ellipsoid, includes the geoid . +\item \emph{neutat_delay_derivative_bin0} - Change in neutral atmospheric delay per height change for the start of the RX window. +\item \emph{neutat_delay_derivative_lastbin} - Change in neutral atmospheric delay per height change for the end of the RX window. +\item \emph{neutat_delay_total_bin0} - Total neutral atmosphere delay correction (wet+dry) from the TX pulse tothe start of the RX window. +\item \emph{neutat_delay_total_lastbin} - Total neutral atmosphere delay correction (wet+dry) from the TX pulse tothe end of the RX window. +\item \emph{range_bias_correction} - The range bias applied to the range measurement. +\item \emph{shot_number} - Unique shot identifier Number. +\item \emph{solar_azimuth} - The azimuth of the sun position vector. +\item \emph{solar_elevation} - The elevation of the sun position vector. +\item \emph{surface_type} - Flags describing which surface types. +\item \emph{delta_time} - Transmit time of the shot. +\item \emph{dynamic_atmosphere_correction} - Dynamic Atmospheric Correction (DAC) includes inverted barometer (IB) effect. +\item \emph{geoid} - Geoid height above WGS-84 reference ellipsoid. +\item \emph{tide_earth} - Solid Earth tides. +\item \emph{tide_load} - Load Tide - Local displacement due to Ocean Loading. +\item \emph{tide_ocean} - Ocean Tides including diurnal and semi-diurnal, and longerperiod tides. +\item \emph{tide_ocean_pole} - Oceanic surface rotational deformation due to polar motion. +\item \emph{tide_pole} - Solid Earth Pole Tide -- Rotational deformation due to polar motion. +} +} +\examples{ +# specify 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 = dirname(level1B_fp_zip)) + +# Reading GEDI level1B data (h5 file) +level1b<-readLevel1B(level1Bpath=level1Bpath) + +# Get GEDI level1B geolocations +level1bGeo<-getLevel1BGeo(level1b,select=c("elevation_bin0", "elevation_lastbin")) +head(level1bGeo) + + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi01_bv001/ +} diff --git a/man/getLevel1BWF.Rd b/man/getLevel1BWF.Rd index 04c6c47..e65d7c8 100644 --- a/man/getLevel1BWF.Rd +++ b/man/getLevel1BWF.Rd @@ -1,50 +1,50 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getLevel1BWF.R -\name{getLevel1BWF} -\alias{getLevel1BWF} -\title{Get GEDI Pulse Full-Waveform (GEDI Level1B)} -\usage{ -getLevel1BWF(level1b, shot_number) -} -\arguments{ -\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} - -\item{shot_number}{Shot number. A scalar represeting the shot number of a giving pulse.} -} -\value{ -Returns An object of class "gedi.fullwaveform". -} -\description{ -This function extracts the full waveform of a given pulse from GEDI Level1B data. -} -\details{ -Shot numbers can be extracted using \code{\link[rGEDI:readLevel1B]{readLevel1B}} function. -} -\examples{ -# specify 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 = dirname(level1B_fp_zip)) - -# Reading GEDI level1B data (h5 file) -level1b<-readLevel1B(level1Bpath=level1Bpath) - -# extracting GEDI full-waveform for a giving shotnumber -wf <- getLevel1BWF(level1b, shot_number="19640521100108408") - -# Plot Full-waveform -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)") - - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi01_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/getLevel1BWF.R +\name{getLevel1BWF} +\alias{getLevel1BWF} +\title{Get GEDI Pulse Full-Waveform (GEDI Level1B)} +\usage{ +getLevel1BWF(level1b, shot_number) +} +\arguments{ +\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} + +\item{shot_number}{Shot number. A scalar represeting the shot number of a giving pulse.} +} +\value{ +Returns An object of class "gedi.fullwaveform". +} +\description{ +This function extracts the full waveform of a given pulse from GEDI Level1B data. +} +\details{ +Shot numbers can be extracted using \code{\link[rGEDI:readLevel1B]{readLevel1B}} function. +} +\examples{ +# specify 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 = dirname(level1B_fp_zip)) + +# Reading GEDI level1B data (h5 file) +level1b<-readLevel1B(level1Bpath=level1Bpath) + +# extracting GEDI full-waveform for a giving shotnumber +wf <- getLevel1BWF(level1b, shot_number="19640521100108408") + +# Plot Full-waveform +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)") + + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi01_bv001/ +} diff --git a/man/getLevel2AM.Rd b/man/getLevel2AM.Rd index 8a913dc..80e7630 100644 --- a/man/getLevel2AM.Rd +++ b/man/getLevel2AM.Rd @@ -1,39 +1,39 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getLevel2AM.R -\name{getLevel2AM} -\alias{getLevel2AM} -\title{Get GEDI Elevation and Height Metrics (GEDI Level2A)} -\usage{ -getLevel2AM(level2a) -} -\arguments{ -\item{level2a}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containing the elevation and relative heights. -} -\description{ -This function extracts Elevation and Relative Height (RH) metrics from GEDI Level2A data . -} -\examples{ -\dontrun{ -# specify 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 = dirname(level2A_fp_zip)) - -# Reading GEDI level2A data (h5 file) -level2a<-readLevel2A(level2Apath=level2Apath) - -# Get GEDI Elevation and Height Metrics -level2AM<-getLevel2AM(level2a) -head(level2AM) -} -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_av001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/getLevel2AM.R +\name{getLevel2AM} +\alias{getLevel2AM} +\title{Get GEDI Elevation and Height Metrics (GEDI Level2A)} +\usage{ +getLevel2AM(level2a) +} +\arguments{ +\item{level2a}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containing the elevation and relative heights. +} +\description{ +This function extracts Elevation and Relative Height (RH) metrics from GEDI Level2A data . +} +\examples{ +\dontrun{ +# specify 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 = dirname(level2A_fp_zip)) + +# Reading GEDI level2A data (h5 file) +level2a<-readLevel2A(level2Apath=level2Apath) + +# Get GEDI Elevation and Height Metrics +level2AM<-getLevel2AM(level2a) +head(level2AM) +} +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_av001/ +} diff --git a/man/getLevel2BPAIProfile.Rd b/man/getLevel2BPAIProfile.Rd index 791b87f..6f78af5 100644 --- a/man/getLevel2BPAIProfile.Rd +++ b/man/getLevel2BPAIProfile.Rd @@ -1,38 +1,38 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getLevel2BPAIProfile.R -\name{getLevel2BPAIProfile} -\alias{getLevel2BPAIProfile} -\title{Get GEDI Plant Area Index (PAI) Profile (GEDI Level2B)} -\usage{ -getLevel2BPAIProfile(level2b) -} -\arguments{ -\item{level2b}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel2B]{readLevel2B}} function). A S4 object of class "gedi.level2b".} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containing the elevation and relative heights. -} -\description{ -This function extracts a Plant Area Index (PAI) Profile from GEDI Level2B data. -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# Get GEDI Plant Area Index (PAI) Profile (GEDI Level2B) -level2BPAIProfile<-getLevel2BPAIProfile(level2b) -head(level2BPAIProfile) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/getLevel2BPAIProfile.R +\name{getLevel2BPAIProfile} +\alias{getLevel2BPAIProfile} +\title{Get GEDI Plant Area Index (PAI) Profile (GEDI Level2B)} +\usage{ +getLevel2BPAIProfile(level2b) +} +\arguments{ +\item{level2b}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel2B]{readLevel2B}} function). A S4 object of class "gedi.level2b".} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containing the elevation and relative heights. +} +\description{ +This function extracts a Plant Area Index (PAI) Profile from GEDI Level2B data. +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# Get GEDI Plant Area Index (PAI) Profile (GEDI Level2B) +level2BPAIProfile<-getLevel2BPAIProfile(level2b) +head(level2BPAIProfile) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/getLevel2BPAVDProfile.Rd b/man/getLevel2BPAVDProfile.Rd index e9ec85b..21fae21 100644 --- a/man/getLevel2BPAVDProfile.Rd +++ b/man/getLevel2BPAVDProfile.Rd @@ -1,38 +1,38 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getLevel2BPAVDProfile.R -\name{getLevel2BPAVDProfile} -\alias{getLevel2BPAVDProfile} -\title{Get GEDI Plant Area Volume Density (PAVD) Index (GEDI Level2B)} -\usage{ -getLevel2BPAVDProfile(level2b) -} -\arguments{ -\item{level2b}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel2B]{readLevel2B}} function). A S4 object of class "gedi.level2b".} -} -\value{ -An S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containing the PAVD Index. -} -\description{ -This function extracts Plant Area Volume Density (PAVD) Index from GEDI Level2B data. -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# Getting GEDI Plant Area Volume Density (PAVD) Index -level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) -head(level2BPAVDProfile) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/getLevel2BPAVDProfile.R +\name{getLevel2BPAVDProfile} +\alias{getLevel2BPAVDProfile} +\title{Get GEDI Plant Area Volume Density (PAVD) Index (GEDI Level2B)} +\usage{ +getLevel2BPAVDProfile(level2b) +} +\arguments{ +\item{level2b}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel2B]{readLevel2B}} function). A S4 object of class "gedi.level2b".} +} +\value{ +An S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containing the PAVD Index. +} +\description{ +This function extracts Plant Area Volume Density (PAVD) Index from GEDI Level2B data. +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# Getting GEDI Plant Area Volume Density (PAVD) Index +level2BPAVDProfile<-getLevel2BPAVDProfile(level2b) +head(level2BPAVDProfile) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/getLevel2BVPM.Rd b/man/getLevel2BVPM.Rd index 1e66d8c..6deb3c5 100644 --- a/man/getLevel2BVPM.Rd +++ b/man/getLevel2BVPM.Rd @@ -1,61 +1,61 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getLevel2BVPM.R -\name{getLevel2BVPM} -\alias{getLevel2BVPM} -\title{Get GEDI Vegetation Profile Biophysical Variables (GEDI Level2B)} -\usage{ -getLevel2BVPM(level2b) -} -\arguments{ -\item{level2b}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel2B]{readLevel2B}} -function). A S4 object of class "gedi.level2b". - -#'@return An S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containing the Vegetation Profile Biophysical Variables.} -} -\description{ -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. -} -\details{ -These are the biophysical variables extracted: -\itemize{ -\item \emph{pai} - Total Plant Area Index. -\item \emph{fhd_normal} - Foliage Height Diversity. -\item \emph{omega} - Foliage Clumping Index. -\item \emph{pgap_theta} - Total Gap Probability (theta). -\item \emph{cover} - Total canopy cover. -} -} -\examples{ -\dontrun{ -# specify the path to download GEDI example dataset -outdir<-getwd() - -# downloading GEDI example dataset (zip file) -download.file( - paste0( - "https://github.com/carlos-alberto-silva/rGEDI/", - "releases/download/examples/examples.zip" - ), - destfile=paste0(outdir,"/examples.zip")) - -# unzip the file -unzip(paste0(outdir,"\\\\examples.zip")) - -# specify the path to GEDI level2B data -level2bpath = paste0(outdir,"\\\\GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5") - -# Reading GEDI level1B file -level2b<-readLevel2b(gedilevel2b) - -# Get GEDI Vegetation Profile Biophysical Variables -level2BVPM<-getLevel2BVPM(level2b) -head(level2BVPM) - -} -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/getLevel2BVPM.R +\name{getLevel2BVPM} +\alias{getLevel2BVPM} +\title{Get GEDI Vegetation Profile Biophysical Variables (GEDI Level2B)} +\usage{ +getLevel2BVPM(level2b) +} +\arguments{ +\item{level2b}{A GEDI Level2B object (output of \code{\link[rGEDI:readLevel2B]{readLevel2B}} +function). A S4 object of class "gedi.level2b". + +#'@return An S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containing the Vegetation Profile Biophysical Variables.} +} +\description{ +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. +} +\details{ +These are the biophysical variables extracted: +\itemize{ +\item \emph{pai} - Total Plant Area Index. +\item \emph{fhd_normal} - Foliage Height Diversity. +\item \emph{omega} - Foliage Clumping Index. +\item \emph{pgap_theta} - Total Gap Probability (theta). +\item \emph{cover} - Total canopy cover. +} +} +\examples{ +\dontrun{ +# specify the path to download GEDI example dataset +outdir<-getwd() + +# downloading GEDI example dataset (zip file) +download.file( + paste0( + "https://github.com/carlos-alberto-silva/rGEDI/", + "releases/download/examples/examples.zip" + ), + destfile=paste0(outdir,"/examples.zip")) + +# unzip the file +unzip(paste0(outdir,"\\\\examples.zip")) + +# specify the path to GEDI level2B data +level2bpath = paste0(outdir,"\\\\GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5") + +# Reading GEDI level1B file +level2b<-readLevel2b(gedilevel2b) + +# Get GEDI Vegetation Profile Biophysical Variables +level2BVPM<-getLevel2BVPM(level2b) +head(level2BVPM) + +} +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/gridStatsLevel2AM.Rd b/man/gridStatsLevel2AM.Rd index 9f657ca..2c32eed 100644 --- a/man/gridStatsLevel2AM.Rd +++ b/man/gridStatsLevel2AM.Rd @@ -1,68 +1,68 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gridStatsLevel2AM.R -\name{gridStatsLevel2AM} -\alias{gridStatsLevel2AM} -\title{Compute Grids with descriptive statistics of GEDI-derived Elevation and Height Metrics (Level2A)} -\usage{ -gridStatsLevel2AM(level2AM, func, res) -} -\arguments{ -\item{level2AM}{A GEDI Level2AM object (output of \code{\link[rGEDI:getLevel2AM]{getLevel2AM}} function). A S4 object of class "data.table".} - -\item{func}{the function(s) to be applied to each cell} - -\item{res}{spatial resolution in decimal degrees for the output raster layer} -} -\value{ -Returns raster layer(s) of selected GEDI Elevation and Height Metric(s) -} -\description{ -This function computes a series of user-defined descriptive statistics within -each grid cell for GEDI-derived Elevation and Height Metrics (Level2A) -} -\examples{ -\dontrun{ -# specify 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 = dirname(level2A_fp_zip)) - -# 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(ZT), res=0.0005) -plot(ZTstats) - -#' Computing the maximum of RH100 only -maxRH100<-gridStatsLevel2AM(level2AM = level2AM, func=max(rh100), res=0.0005) -plot(maxRH100) - -#' Computing the mean of ZG only -ZGmean<-gridStatsLevel2AM(level2AM = level2AM, func=mean(ZG), res=0.0005) -plot(ZGmean) -} - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_av001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/gridStatsLevel2AM.R +\name{gridStatsLevel2AM} +\alias{gridStatsLevel2AM} +\title{Compute Grids with descriptive statistics of GEDI-derived Elevation and Height Metrics (Level2A)} +\usage{ +gridStatsLevel2AM(level2AM, func, res) +} +\arguments{ +\item{level2AM}{A GEDI Level2AM object (output of \code{\link[rGEDI:getLevel2AM]{getLevel2AM}} function). A S4 object of class "data.table".} + +\item{func}{the function(s) to be applied to each cell} + +\item{res}{spatial resolution in decimal degrees for the output raster layer} +} +\value{ +Returns raster layer(s) of selected GEDI Elevation and Height Metric(s) +} +\description{ +This function computes a series of user-defined descriptive statistics within +each grid cell for GEDI-derived Elevation and Height Metrics (Level2A) +} +\examples{ +\dontrun{ +# specify 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 = dirname(level2A_fp_zip)) + +# 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(ZT), res=0.0005) +plot(ZTstats) + +#' Computing the maximum of RH100 only +maxRH100<-gridStatsLevel2AM(level2AM = level2AM, func=max(rh100), res=0.0005) +plot(maxRH100) + +#' Computing the mean of ZG only +ZGmean<-gridStatsLevel2AM(level2AM = level2AM, func=mean(ZG), res=0.0005) +plot(ZGmean) +} + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_av001/ +} diff --git a/man/gridStatsLevel2BVPM.Rd b/man/gridStatsLevel2BVPM.Rd index 7b08641..9608c23 100644 --- a/man/gridStatsLevel2BVPM.Rd +++ b/man/gridStatsLevel2BVPM.Rd @@ -1,67 +1,67 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gridStatsLevel2BVPM.R -\name{gridStatsLevel2BVPM} -\alias{gridStatsLevel2BVPM} -\title{Compute Grids with descriptive statistics of -GEDI-derived Canopy Cover and Vertical Profile Metrics (Level2B)} -\usage{ -gridStatsLevel2BVPM(level2BVPM, func, res) -} -\arguments{ -\item{level2BVPM}{A GEDI Level2AM object (output of \code{\link[rGEDI:getLevel2BVPM]{getLevel2BVPM}} function). A S4 object of class "data.table".} - -\item{func}{the function(s) to be applied to each cell} - -\item{res}{spatial resolution in decimal degrees for the output raster layer} -} -\value{ -Returns raster layer(s) of selected GEDI Canopy Cover and Vertical Profile Metric(s) -} -\description{ -This function computes a series of user-defined descriptive statistics within -each grid cell for GEDI-derived Canopy Cover and Vertical Profile Metrics (Level2B) -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# 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.5) -plot(cover_stats) - -#' Computing the max of the Total Plant Area Index only -pai_max<-gridStatsLevel2BVPM(level2BVPM = level2BVPM, func=max(pai), res=0.5) -plot(pai_max) - -#' Computing the mean of Foliage Clumping Index only -omega_mean<-gridStatsLevel2BVPM(level2BVPM = level2BVPM, func=mean(omega), res=0.5) -plot(omega_mean) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/gridStatsLevel2BVPM.R +\name{gridStatsLevel2BVPM} +\alias{gridStatsLevel2BVPM} +\title{Compute Grids with descriptive statistics of +GEDI-derived Canopy Cover and Vertical Profile Metrics (Level2B)} +\usage{ +gridStatsLevel2BVPM(level2BVPM, func, res) +} +\arguments{ +\item{level2BVPM}{A GEDI Level2AM object (output of \code{\link[rGEDI:getLevel2BVPM]{getLevel2BVPM}} function). A S4 object of class "data.table".} + +\item{func}{the function(s) to be applied to each cell} + +\item{res}{spatial resolution in decimal degrees for the output raster layer} +} +\value{ +Returns raster layer(s) of selected GEDI Canopy Cover and Vertical Profile Metric(s) +} +\description{ +This function computes a series of user-defined descriptive statistics within +each grid cell for GEDI-derived Canopy Cover and Vertical Profile Metrics (Level2B) +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# 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.5) +plot(cover_stats) + +#' Computing the max of the Total Plant Area Index only +pai_max<-gridStatsLevel2BVPM(level2BVPM = level2BVPM, func=max(pai), res=0.5) +plot(pai_max) + +#' Computing the mean of Foliage Clumping Index only +omega_mean<-gridStatsLevel2BVPM(level2BVPM = level2BVPM, func=mean(omega), res=0.5) +plot(omega_mean) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/plotPAIProfile.Rd b/man/plotPAIProfile.Rd index 71fddee..4e03cb3 100644 --- a/man/plotPAIProfile.Rd +++ b/man/plotPAIProfile.Rd @@ -1,60 +1,60 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/plotPAIProfile.R -\name{plotPAIProfile} -\alias{plotPAIProfile} -\title{Plot Plant Area Index (PAI) Profile} -\usage{ -plotPAIProfile(level2BPAIProfile, beam = "BEAM0101", elev = TRUE) -} -\arguments{ -\item{level2BPAIProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function). A S4 object of class "data.table".} - -\item{beam}{select GEDI beam. Default is "BEAM0101". See details section.} - -\item{elev}{if TRUE, elevation will be used for plotting the PAI profile. Otherwise, -height will be used instead.} -} -\value{ -Returns a ggplot object. See \code{\link[ggplot2:ggplot]{ggplot}} package. -} -\description{ -This functions plots Plant Area Index (PAI) Profile (GEDI level2B) -} -\details{ -list of GEDI beams. See output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function. -\itemize{ -\item \emph{BEAM0000} -\item \emph{BEAM0001} -\item \emph{BEAM0010} -\item \emph{BEAM0011} -\item \emph{BEAM0101} -\item \emph{BEAM0110} -\item \emph{BEAM1000} -\item \emph{BEAM1011} -} -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# 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) - - - - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plotPAIProfile.R +\name{plotPAIProfile} +\alias{plotPAIProfile} +\title{Plot Plant Area Index (PAI) Profile} +\usage{ +plotPAIProfile(level2BPAIProfile, beam = "BEAM0101", elev = TRUE) +} +\arguments{ +\item{level2BPAIProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function). A S4 object of class "data.table".} + +\item{beam}{select GEDI beam. Default is "BEAM0101". See details section.} + +\item{elev}{if TRUE, elevation will be used for plotting the PAI profile. Otherwise, +height will be used instead.} +} +\value{ +Returns a ggplot object. See \code{\link[ggplot2:ggplot]{ggplot}} package. +} +\description{ +This functions plots Plant Area Index (PAI) Profile (GEDI level2B) +} +\details{ +list of GEDI beams. See output of \code{\link[rGEDI:getLevel2BPAIProfile]{getLevel2BPAIProfile}} function. +\itemize{ +\item \emph{BEAM0000} +\item \emph{BEAM0001} +\item \emph{BEAM0010} +\item \emph{BEAM0011} +\item \emph{BEAM0101} +\item \emph{BEAM0110} +\item \emph{BEAM1000} +\item \emph{BEAM1011} +} +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# 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) + + + + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/plotPAVDProfile.Rd b/man/plotPAVDProfile.Rd index 0892332..3ccd973 100644 --- a/man/plotPAVDProfile.Rd +++ b/man/plotPAVDProfile.Rd @@ -1,59 +1,59 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/plotPAVDProfile.R -\name{plotPAVDProfile} -\alias{plotPAVDProfile} -\title{Plot Plant Area Volume Density Profile} -\usage{ -plotPAVDProfile(level2BPAVDProfile, beam = "BEAM0101", elev = TRUE) -} -\arguments{ -\item{level2BPAVDProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAVDProfile]{getLevel2BPAVDProfile}} function). A S4 object of class "data.table".} - -\item{beam}{select GEDI beam. Default is "BEAM0101". See details section.} - -\item{elev}{if TRUE, elevation will be used for plotting the PAVD profile. Otherwise, -height will be used instead.} -} -\value{ -Returns a ggplot object. See \code{\link[ggplot2:ggplot]{ggplot}} package. -} -\description{ -This functions plots Plant Area Volume Density profile (GEDI level2B) -} -\details{ -list of GEDI beams. See output of \code{\link[rGEDI:getLevel2BPAVDProfile]{getLevel2BPAVDProfile}} function. -\itemize{ -\item \emph{BEAM0000} -\item \emph{BEAM0001} -\item \emph{BEAM0010} -\item \emph{BEAM0011} -\item \emph{BEAM0101} -\item \emph{BEAM0110} -\item \emph{BEAM1000} -\item \emph{BEAM1011} -} -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# 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) - - - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plotPAVDProfile.R +\name{plotPAVDProfile} +\alias{plotPAVDProfile} +\title{Plot Plant Area Volume Density Profile} +\usage{ +plotPAVDProfile(level2BPAVDProfile, beam = "BEAM0101", elev = TRUE) +} +\arguments{ +\item{level2BPAVDProfile}{A GEDI Level2B object (output of \code{\link[rGEDI:getLevel2BPAVDProfile]{getLevel2BPAVDProfile}} function). A S4 object of class "data.table".} + +\item{beam}{select GEDI beam. Default is "BEAM0101". See details section.} + +\item{elev}{if TRUE, elevation will be used for plotting the PAVD profile. Otherwise, +height will be used instead.} +} +\value{ +Returns a ggplot object. See \code{\link[ggplot2:ggplot]{ggplot}} package. +} +\description{ +This functions plots Plant Area Volume Density profile (GEDI level2B) +} +\details{ +list of GEDI beams. See output of \code{\link[rGEDI:getLevel2BPAVDProfile]{getLevel2BPAVDProfile}} function. +\itemize{ +\item \emph{BEAM0000} +\item \emph{BEAM0001} +\item \emph{BEAM0010} +\item \emph{BEAM0011} +\item \emph{BEAM0101} +\item \emph{BEAM0110} +\item \emph{BEAM1000} +\item \emph{BEAM1011} +} +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# 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) + + + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/plotWFMetrics.Rd b/man/plotWFMetrics.Rd index 790cc53..37b253b 100644 --- a/man/plotWFMetrics.Rd +++ b/man/plotWFMetrics.Rd @@ -1,52 +1,52 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/plotWFMetrics.R -\name{plotWFMetrics} -\alias{plotWFMetrics} -\title{GEDI-waveform plot with metrics} -\usage{ -plotWFMetrics(level1b, level2a, shot_number, rh=c(25, 50, 75),...) -} -\arguments{ -\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} - -\item{level2a}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} - -\item{shot_number}{Shot number. A scalar represeting the shot number of a giving pulse.} - -\item{rh}{integer vector. Specify which RH metrics to plot except rh0 and rh100, default c(25, 50, 75).} - -\item{...}{will be passed to the main plot.} -} -\value{ -Returns raster layer(s) of selected GEDI Canopy Cover and Vertical Profile Metric(s) -} -\description{ -Plots the waveform with overlaid RH metrics -} -\examples{ -# specify the path to GEDI level1B and Level2A data (zip file) -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 = dirname(level1B_fp_zip)) -level2Apath <- unzip(level2A_fp_zip,exdir = dirname(level2A_fp_zip)) - -# Reading GEDI level1B and Level2A data (h5 file) -level1b<-readLevel1B(level1Bpath=level1Bpath) -level2A<-readLevel1B(level2Apath=level2Apath) - -shot_number = "19640521100108408" - -plotWFMetrics(level1b, level2a, shot_number, rh=c(25, 50, 75, 90)) - - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plotWFMetrics.R +\name{plotWFMetrics} +\alias{plotWFMetrics} +\title{GEDI-waveform plot with metrics} +\usage{ +plotWFMetrics(level1b, level2a, shot_number, rh=c(25, 50, 75),...) +} +\arguments{ +\item{level1b}{A GEDI Level1B object (output of \code{\link[rGEDI:readLevel1B]{readLevel1B}} function). A S4 object of class "gedi.level1b".} + +\item{level2a}{A GEDI Level2A object (output of \code{\link[rGEDI:readLevel2A]{readLevel2A}} function). A S4 object of class "gedi.level2a".} + +\item{shot_number}{Shot number. A scalar represeting the shot number of a giving pulse.} + +\item{rh}{integer vector. Specify which RH metrics to plot except rh0 and rh100, default c(25, 50, 75).} + +\item{...}{will be passed to the main plot.} +} +\value{ +Returns raster layer(s) of selected GEDI Canopy Cover and Vertical Profile Metric(s) +} +\description{ +Plots the waveform with overlaid RH metrics +} +\examples{ +# specify the path to GEDI level1B and Level2A data (zip file) +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 = dirname(level1B_fp_zip)) +level2Apath <- unzip(level2A_fp_zip,exdir = dirname(level2A_fp_zip)) + +# Reading GEDI level1B and Level2A data (h5 file) +level1b<-readLevel1B(level1Bpath=level1Bpath) +level2A<-readLevel1B(level2Apath=level2Apath) + +shot_number = "19640521100108408" + +plotWFMetrics(level1b, level2a, shot_number, rh=c(25, 50, 75, 90)) + + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/polyStatsLevel2AM.Rd b/man/polyStatsLevel2AM.Rd index 6b20f06..836742e 100644 --- a/man/polyStatsLevel2AM.Rd +++ b/man/polyStatsLevel2AM.Rd @@ -1,75 +1,75 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/polyStatsLevel2AM.R -\name{polyStatsLevel2AM} -\alias{polyStatsLevel2AM} -\title{Compute descriptive statistics of GEDI Level2A-derived Metrics} -\usage{ -polyStatsLevel2AM(level2AM, func, id=NULL) -} -\arguments{ -\item{level2AM}{A GEDI Level2AM object (output of \code{\link[rGEDI:getLevel2AM]{getLevel2AM}} function). A S4 object of class "data.table".} - -\item{func}{the function to be applied for computing the defined statistics} - -\item{id}{a vector contatining the polygon id for each GEDI observation. Defaut is NULL} -} -\value{ -A S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containting Statistics of GEDI level2A defined metrics -} -\description{ -Computes a Series of Statistics from GEDI-derived Elevation and Height Metrics (Level2A) -within defined polygon ids or entire area -} -\examples{ -# specify 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 = dirname(level2A_fp_zip)) - -# Reading GEDI level2A data (h5 file) -level2a<-readLevel2A(level2Apath=level2Apath) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "clip_polygon.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -# Get GEDI Eleveation and Relative Metrics (level2A) -level2AM<-getLevel2AM(level2a) -head(level2AM) - -# clipping level2a by geometry -level2AM_clip = clipLevel2AMGeometry(level2AM, polygon_spdf, 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), id=NULL) - -# Computing the maximum of RH100 stratified by polygon -RH100max_poly<-polyStatsLevel2AM(level2AM_clip,func=max(RH100), id=NULL) - -# Computing a serie statistics for GEDI metrics stratified by polygon -RH100metrics<-polyStatsLevel2AM(level2AM_clip,func=mySetOfMetrics(RH100), - id=level2AM_clip@data$id) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_av001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/polyStatsLevel2AM.R +\name{polyStatsLevel2AM} +\alias{polyStatsLevel2AM} +\title{Compute descriptive statistics of GEDI Level2A-derived Metrics} +\usage{ +polyStatsLevel2AM(level2AM, func, id=NULL) +} +\arguments{ +\item{level2AM}{A GEDI Level2AM object (output of \code{\link[rGEDI:getLevel2AM]{getLevel2AM}} function). A S4 object of class "data.table".} + +\item{func}{the function to be applied for computing the defined statistics} + +\item{id}{a vector contatining the polygon id for each GEDI observation. Defaut is NULL} +} +\value{ +A S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containting Statistics of GEDI level2A defined metrics +} +\description{ +Computes a Series of Statistics from GEDI-derived Elevation and Height Metrics (Level2A) +within defined polygon ids or entire area +} +\examples{ +# specify 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 = dirname(level2A_fp_zip)) + +# Reading GEDI level2A data (h5 file) +level2a<-readLevel2A(level2Apath=level2Apath) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "clip_polygon.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +# Get GEDI Eleveation and Relative Metrics (level2A) +level2AM<-getLevel2AM(level2a) +head(level2AM) + +# clipping level2a by geometry +level2AM_clip = clipLevel2AMGeometry(level2AM, polygon_spdf, 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), id=NULL) + +# Computing the maximum of RH100 stratified by polygon +RH100max_poly<-polyStatsLevel2AM(level2AM_clip,func=max(RH100), id=NULL) + +# Computing a serie statistics for GEDI metrics stratified by polygon +RH100metrics<-polyStatsLevel2AM(level2AM_clip,func=mySetOfMetrics(RH100), + id=level2AM_clip@data$id) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_av001/ +} diff --git a/man/polyStatsLevel2BVPM.Rd b/man/polyStatsLevel2BVPM.Rd index 1ad1f14..d549a81 100644 --- a/man/polyStatsLevel2BVPM.Rd +++ b/man/polyStatsLevel2BVPM.Rd @@ -1,78 +1,78 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/polyStatsLevel2BVPM.R -\name{polyStatsLevel2BVPM} -\alias{polyStatsLevel2BVPM} -\title{Compute descriptive statistics of GEDI Level2BVPM-derived Metrics} -\usage{ -polyStatsLevel2BVPM(level2BVPM, func, id=NULL) -} -\arguments{ -\item{level2BVPM}{A GEDI Level2BVPM object (output of \code{\link[rGEDI:getLevel2BVPM]{getLevel2BVPM}} function). A S4 object of class "data.table".} - -\item{func}{the function to be applied for computing the defined statistics} - -\item{id}{a vector contatining the polygon id for each GEDI observation. Defaut is NULL} -} -\value{ -A S4 object of class \code{\link[data.table:data.table]{data.table-class}} -containting Statistics of GEDI level2BVPM defined metrics -} -\description{ -Computes a Series of Statistics of GEDI-derived Canopy Cover and Vertical Profile metrics (Level2BVPM) -for all obsercation or only those defined within a giving polygon -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -# specify the path to shapefile -polygon_filepath <- system.file("extdata", "clip_polygon.shp", package="rGEDI") - -# Reading shapefile as SpatialPolygonsDataFrame object -library(raster) -polygon_spdf<-shapefile(polygons_filepath) - -# Get GEDI Canopy Cover and Vertical Profile Metrics -level2BVPM<-getLevel2BVPM(level2b) -head(level2BVPM) - -# clipping level2BVPM by geometry -level2BVPM_clip = clipLevel2BVPMGeometry(level2BVPM, polygon_spdf, 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 max of the Total Plant Area Index -pai_max<-polyStatsLevel2BVPM(level2BVPM_clip,func=max(pai), id=NULL) -pai_max - -# Computing the max of the Total Plant Area Index stratified by polygon -pai_max_poly<-polyStatsLevel2BVPM(level2BVPM_clip,func=max(pai), id="id") -head(pai_max_poly) - -# Computing the serie of statistics of canopy cover stratified by polygon -cover_metrics<-polyStatsLevel2BVPM(level2BVPM_clip,func=mySetOfMetrics(cover), - id=level2BM_clip@data$id) -head(cover_metrics) - -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/polyStatsLevel2BVPM.R +\name{polyStatsLevel2BVPM} +\alias{polyStatsLevel2BVPM} +\title{Compute descriptive statistics of GEDI Level2BVPM-derived Metrics} +\usage{ +polyStatsLevel2BVPM(level2BVPM, func, id=NULL) +} +\arguments{ +\item{level2BVPM}{A GEDI Level2BVPM object (output of \code{\link[rGEDI:getLevel2BVPM]{getLevel2BVPM}} function). A S4 object of class "data.table".} + +\item{func}{the function to be applied for computing the defined statistics} + +\item{id}{a vector contatining the polygon id for each GEDI observation. Defaut is NULL} +} +\value{ +A S4 object of class \code{\link[data.table:data.table]{data.table-class}} +containting Statistics of GEDI level2BVPM defined metrics +} +\description{ +Computes a Series of Statistics of GEDI-derived Canopy Cover and Vertical Profile metrics (Level2BVPM) +for all obsercation or only those defined within a giving polygon +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +# specify the path to shapefile +polygon_filepath <- system.file("extdata", "clip_polygon.shp", package="rGEDI") + +# Reading shapefile as SpatialPolygonsDataFrame object +library(raster) +polygon_spdf<-shapefile(polygons_filepath) + +# Get GEDI Canopy Cover and Vertical Profile Metrics +level2BVPM<-getLevel2BVPM(level2b) +head(level2BVPM) + +# clipping level2BVPM by geometry +level2BVPM_clip = clipLevel2BVPMGeometry(level2BVPM, polygon_spdf, 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 max of the Total Plant Area Index +pai_max<-polyStatsLevel2BVPM(level2BVPM_clip,func=max(pai), id=NULL) +pai_max + +# Computing the max of the Total Plant Area Index stratified by polygon +pai_max_poly<-polyStatsLevel2BVPM(level2BVPM_clip,func=max(pai), id="id") +head(pai_max_poly) + +# Computing the serie of statistics of canopy cover stratified by polygon +cover_metrics<-polyStatsLevel2BVPM(level2BVPM_clip,func=mySetOfMetrics(cover), + id=level2BM_clip@data$id) +head(cover_metrics) + +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_bv001/ +} diff --git a/man/readLevel1B.Rd b/man/readLevel1B.Rd index b6ef689..ccffc5b 100644 --- a/man/readLevel1B.Rd +++ b/man/readLevel1B.Rd @@ -1,34 +1,34 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/readLevel1B.R -\name{readLevel1B} -\alias{readLevel1B} -\title{Read Geolocated Waveforms (GEDI Level1B)} -\usage{ -readLevel1B(level1Bpath) -} -\arguments{ -\item{level1Bpath}{file path pointing to GEDI level1B data. Data in HDF5 Hierarchical Data Format (.h5).} -} -\value{ -S4 object of class "gedi.level1b". -} -\description{ -This function reads GEDI level1B products: geolocated Waveforms -} -\examples{ -# specify 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 = dirname(level1B_fp_zip)) - -# Reading GEDI level1B data (h5 file) -level1b<-readLevel1B(level1Bpath=level1Bpath) - -} -\seealso{ -\code{\link[hdf5r:H5File-class]{hdf5r::H5File}} in the \emph{hdf5r} package and -https://lpdaac.usgs.gov/products/gedi01_bv001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/readLevel1B.R +\name{readLevel1B} +\alias{readLevel1B} +\title{Read Geolocated Waveforms (GEDI Level1B)} +\usage{ +readLevel1B(level1Bpath) +} +\arguments{ +\item{level1Bpath}{file path pointing to GEDI level1B data. Data in HDF5 Hierarchical Data Format (.h5).} +} +\value{ +S4 object of class "gedi.level1b". +} +\description{ +This function reads GEDI level1B products: geolocated Waveforms +} +\examples{ +# specify 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 = dirname(level1B_fp_zip)) + +# Reading GEDI level1B data (h5 file) +level1b<-readLevel1B(level1Bpath=level1Bpath) + +} +\seealso{ +\code{\link[hdf5r:H5File-class]{hdf5r::H5File}} in the \emph{hdf5r} package and +https://lpdaac.usgs.gov/products/gedi01_bv001/ +} diff --git a/man/readLevel2A.Rd b/man/readLevel2A.Rd index 726def0..c04a439 100644 --- a/man/readLevel2A.Rd +++ b/man/readLevel2A.Rd @@ -1,36 +1,36 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/readLevel2A.R -\name{readLevel2A} -\alias{readLevel2A} -\title{Read GEDI Basic Waveform Metrics (Level2A data)} -\usage{ -readLevel2A(level2Apath) -} -\arguments{ -\item{level2Apath}{file path pointing to GEDI level2A data. Data in HDF5 Hierarchical Data Format (.h5).} -} -\value{ -S4 object of class "gedi.level1a". -} -\description{ -This function reads GEDI level2A products: ground elevation, canopy top height, and relative heights (RH). -} -\examples{ -\dontrun{ -# specify 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 = dirname(level2A_fp_zip)) - -# Reading GEDI level2A data (h5 file) -level2a<-readLevel2A(level2Apath=level2Apath) - - -} -} -\seealso{ -https://lpdaac.usgs.gov/products/gedi02_av001/ -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/readLevel2A.R +\name{readLevel2A} +\alias{readLevel2A} +\title{Read GEDI Basic Waveform Metrics (Level2A data)} +\usage{ +readLevel2A(level2Apath) +} +\arguments{ +\item{level2Apath}{file path pointing to GEDI level2A data. Data in HDF5 Hierarchical Data Format (.h5).} +} +\value{ +S4 object of class "gedi.level1a". +} +\description{ +This function reads GEDI level2A products: ground elevation, canopy top height, and relative heights (RH). +} +\examples{ +\dontrun{ +# specify 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 = dirname(level2A_fp_zip)) + +# Reading GEDI level2A data (h5 file) +level2a<-readLevel2A(level2Apath=level2Apath) + + +} +} +\seealso{ +https://lpdaac.usgs.gov/products/gedi02_av001/ +} diff --git a/man/readLevel2B.Rd b/man/readLevel2B.Rd index 35dd7c6..20df1f0 100644 --- a/man/readLevel2B.Rd +++ b/man/readLevel2B.Rd @@ -1,32 +1,32 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/readLevel2B.R -\name{readLevel2B} -\alias{readLevel2B} -\title{Read GEDI Biophysical Metrics (Level2B data)} -\usage{ -readLevel2B(level2Bpath) -} -\arguments{ -\item{level2Bpath}{file path pointing to GEDI level2B data. Data in HDF5 Hierarchical Data Format (.h5).} -} -\value{ -S4 object of class "gedi.level1b". -} -\description{ -This function reads GEDI level2B products: canopy cover, Plant Area Index (PAI), Plant Area Volume Density (PAVD), and Foliage Height Diversity (FHD). - -#' -} -\examples{ -# specify 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 = dirname(level2B_fp_zip)) - -# Reading GEDI level2B data (h5 file) -level2b<-readLevel2B(level2Bpath=level2Bpath) - -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/readLevel2B.R +\name{readLevel2B} +\alias{readLevel2B} +\title{Read GEDI Biophysical Metrics (Level2B data)} +\usage{ +readLevel2B(level2Bpath) +} +\arguments{ +\item{level2Bpath}{file path pointing to GEDI level2B data. Data in HDF5 Hierarchical Data Format (.h5).} +} +\value{ +S4 object of class "gedi.level1b". +} +\description{ +This function reads GEDI level2B products: canopy cover, Plant Area Index (PAI), Plant Area Volume Density (PAVD), and Foliage Height Diversity (FHD). + +#' +} +\examples{ +# specify 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 = dirname(level2B_fp_zip)) + +# Reading GEDI level2B data (h5 file) +level2b<-readLevel2B(level2Bpath=level2Bpath) + +} diff --git a/tools/deps.R b/tools/deps.R index 6630fac..6508c8a 100644 --- a/tools/deps.R +++ b/tools/deps.R @@ -1,5 +1,5 @@ downloadDep = function(name, file, url, origName = "") { - if(!file.exists(paste0("./",name,"/",file))) { + if(!file.exists(file.path(".",name,file))) { print(paste0("Downloading ",name,"...")) download.file(url, "lib.tar.gz", quiet=FALSE) untar("lib.tar.gz", exdir=".") @@ -13,7 +13,7 @@ downloadDep = function(name, file, url, origName = "") { downloadDepBitBucket = function(name, file, origName) { - fileCheck = paste0("./",name,"/",file) + fileCheck = file.path(".",name,file) if(!file.exists(fileCheck)) { print(paste0("Downloading ",name,"...")) url = paste0("https://bitbucket.org/caiohamamura/",name,"/get/v0.3.0.zip") diff --git a/vignettes/tutorial.Rmd b/vignettes/tutorial.Rmd index ea67e91..112f186 100644 --- a/vignettes/tutorial.Rmd +++ b/vignettes/tutorial.Rmd @@ -30,24 +30,24 @@ head = function(...) { print(xtable(utils::head(...)), type="html") } -library(htmltools) -save_tags <- function (tags, file, selfcontained = F, libdir = "./lib") -{ - if (is.null(libdir)) { - libdir <- paste(tools::file_path_sans_ext(basename(file)), - "_files", sep = "") - } - htmltools::save_html(tags, file = file, libdir = libdir) - if (selfcontained) { - if (!htmlwidgets:::pandoc_available()) { - stop("Saving a widget with selfcontained = TRUE requires pandoc. For details see:\n", - "https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md") - } - htmlwidgets:::pandoc_self_contained_html(file, file) - unlink(libdir, recursive = TRUE) - } - return(file) -} +#library(htmltools) +#save_tags <- function (tags, file, selfcontained = F, libdir = "./lib") +#{ +# if (is.null(libdir)) { +# libdir <- paste(tools::file_path_sans_ext(basename(file)), +# "_files", sep = "") +# } +# htmltools::save_html(tags, file = file, libdir = libdir) +# if (selfcontained) { +# if (!htmlwidgets:::pandoc_available()) { +# stop("Saving a widget with selfcontained = TRUE requires pandoc. For details see:\n", +# "https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md") +# } +# htmlwidgets:::pandoc_self_contained_html(file, file) +# unlink(libdir, recursive = TRUE) +# } +# return(file) +#} ``` The rGEDI package provides functions for i) downloading, ii) visualizing, iii) clipping, iv) gridding, iv) simulating and v) exporting GEDI data. @@ -99,14 +99,14 @@ LPDAACDataPool(filepath=gLevel2B,outdir=outdir) #** Herein, we are using only a GEDI sample dataset for this tutorial. # downloading zip file -download.file("https://github.com/carlos-alberto-silva/rGEDI/releases/download/examples/examples.zip",destfile=paste0(outdir, "/examples.zip")) +download.file("https://github.com/carlos-alberto-silva/rGEDI/releases/download/examples/examples.zip",destfile=file.path(outdir, "examples.zip")) # unzip file -unzip(paste0(outdir,"/examples.zip"), exdir=outdir) +unzip(file.path(outdir, "examples.zip"), exdir=outdir) ``` ```{r, echo = FALSE, results="hide"} -zipfile = fs::path_join(c(outdir, "examples.zip")) -lasfile = fs::path_join(c(outdir, "Amazon.las")) +zipfile = file.path(outdir, "examples.zip") +lasfile = file.path(outdir, "Amazon.las") if (!file.exists(lasfile)) { config = httr::add_headers( Authorization=paste0("token ", Sys.getenv("TRAVIS_TOKEN")), @@ -133,9 +133,9 @@ if (!file.exists(lasfile)) { ## Reading GEDI data ```{r, eval=FALSE} # Reading GEDI data -gedilevel1b<-readLevel1B(level1Bpath = paste0(outdir,"/GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.h5")) -gedilevel2a<-readLevel2A(level2Apath = paste0(outdir,"/GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.h5")) -gedilevel2b<-readLevel2B(level2Bpath = paste0(outdir,"/GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5")) +gedilevel1b<-readLevel1B(level1Bpath = file.path(outdir, "GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.h5")) +gedilevel2a<-readLevel2A(level2Apath = file.path(outdir, "GEDI02_A_2019108080338_O01964_T05337_02_001_01_sub.h5")) +gedilevel2b<-readLevel2B(level2Bpath = file.path(outdir, "GEDI02_B_2019108080338_O01964_T05337_02_001_01_sub.h5")) ``` ```{r, echo=FALSE} # Reading GEDI data @@ -283,9 +283,9 @@ ymin = -13.75831 ymax = -13.71244 ## clipping GEDI data within boundary box -level1b_clip_bb <- clipLevel1B(gedilevel1b, xmin, xmax, ymin, ymax,output=paste0(outdir,"//level1b_clip_bb.h5")) -level2a_clip_bb <- clipLevel2A(gedilevel2a, xmin, xmax, ymin, ymax, output=paste0(outdir,"//level2a_clip_bb.h5")) -level2b_clip_bb <- clipLevel2B(gedilevel2b, xmin, xmax, ymin, ymax,output=paste0(outdir,"//level2b_clip_bb.h5")) +level1b_clip_bb <- clipLevel1B(gedilevel1b, xmin, xmax, ymin, ymax,output=file.path(outdir, "level1b_clip_bb.h5")) +level2a_clip_bb <- clipLevel2A(gedilevel2a, xmin, xmax, ymin, ymax, output=file.path(outdir, "level2a_clip_bb.h5")) +level2b_clip_bb <- clipLevel2B(gedilevel2b, xmin, xmax, ymin, ymax,output=file.path(outdir, "level2b_clip_bb.h5")) ## Clipping GEDI data by geometry # specify the path to shapefile for the study area @@ -315,9 +315,9 @@ split_by="id" split_by="id" # Clipping h5 files -level1b_clip_gb <- clipLevel1BGeometry(gedilevel1b,polygon_spdf,output=paste0(outdir,"//level1b_clip_gb.h5"), split_by=split_by) -level2a_clip_gb <- clipLevel2AGeometry(gedilevel2a,polygon_spdf,output=paste0(outdir,"//level2a_clip_gb.h5"), split_by=split_by) -level2b_clip_gb <- clipLevel2BGeometry(gedilevel2b,polygon_spdf,output=paste0(outdir,"//level2b_clip_gb.h5"), split_by=split_by) +level1b_clip_gb <- clipLevel1BGeometry(gedilevel1b,polygon_spdf,output=file.path(outdir, "level1b_clip_gb.h5"), split_by=split_by) +level2a_clip_gb <- clipLevel2AGeometry(gedilevel2a,polygon_spdf,output=file.path(outdir, "level2a_clip_gb.h5"), split_by=split_by) +level2b_clip_gb <- clipLevel2BGeometry(gedilevel2b,polygon_spdf,output=file.path(outdir, "level2b_clip_gb.h5"), split_by=split_by) ``` @@ -561,8 +561,8 @@ xcenter_cerrado = mean(las_cerrado@bbox[1,]) ycenter_cerrado = mean(las_cerrado@bbox[2,]) # Simulating GEDI full-waveform -wf_amazon<-gediWFSimulator(input=lasfile_amazon,output=paste0(getwd(),"//gediWF_amazon_simulation.h5"),coords = c(xcenter_amazon, ycenter_amazon)) -wf_cerrado<-gediWFSimulator(input=lasfile_cerrado,output=paste0(getwd(),"//gediWF_cerrado_simulation.h5"),coords = c(xcenter_cerrado, ycenter_cerrado)) +wf_amazon<-gediWFSimulator(input=lasfile_amazon,output=file.path(getwd(),"/gediWF_amazon_simulation.h5")),coords = c(xcenter_amazon, ycenter_amazon) +wf_cerrado<-gediWFSimulator(input=lasfile_cerrado,output=file.path(getwd(),"/gediWF_cerrado_simulation.h5")),coords = c(xcenter_cerrado, ycenter_cerrado) # Plot ALS and GEDI simulated full-waveform par(mfrow=c(2,2), mar=c(4,4,0,0), oma=c(0,0,1,1),cex.axis = 1.2) @@ -585,8 +585,8 @@ grid() # Extracting GEDI full-waveform derived metrics ```{r, results=FALSE} -wf_amazon_metrics<-gediWFMetrics(input=wf_amazon,outRoot=getwd()) -wf_cerrado_metrics<-gediWFMetrics(input=wf_cerrado,outRoot=getwd()) +wf_amazon_metrics<-gediWFMetrics(input=wf_amazon,outRoot=file.path(getwd(), "amazon")) +wf_cerrado_metrics<-gediWFMetrics(input=wf_cerrado,outRoot=file.path(getwd(), "cerrado")) metrics<-rbind(wf_amazon_metrics,wf_cerrado_metrics) rownames(metrics)<-c("Amazon","Cerrado")