# NOT RUN {
# Specifying the path to GEDI level1B data (zip file)
outdir = tempdir()
level1B_fp_zip <- system.file("extdata",
"GEDI01_B_2019108080338_O01964_T05337_02_003_01_sub.zip",
package="rGEDI")
# Unzipping GEDI level1B data
level1Bpath <- unzip(level1B_fp_zip,exdir = outdir)
# Reading GEDI level1B data (h5 file)
level1b<-readLevel1B(level1Bpath=level1Bpath)
# Extracting GEDI Full-Waveform
wf <- getLevel1BWF(level1b, shot_number="19640521100108408")
# Plotting GEDI Full-waveform
oldpar<-par()
par(mfrow = c(1,2), cex.axis = 1.5)
plot(wf, relative=FALSE, polygon=TRUE, type="l", lwd=2, col="forestgreen",
xlab="", ylab="Elevation (m)")
plot(wf, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="forestgreen",
xlab="Waveform Amplitude (%)", ylab="Elevation (m)")
par(oldpar)
close(level1b)
outdir <- tempdir()
zipfile_amazon <- system.file("extdata", "Amazon.zip", package="rGEDI")
zipfile_Savanna <- system.file("extdata", "Savanna.zip", package="rGEDI")
lasfile_amazon <- unzip(zipfile_amazon,exdir=outdir)
lasfile_Savanna <- unzip(zipfile_Savanna,exdir=outdir)
# Reading and plot ALS file
libsAvailable = require(lidR) && require(plot3D)
if (libsAvailable) {
las_amazon<-readLAS(lasfile_amazon)
las_Savanna<-readLAS(lasfile_Savanna)
# Extracting plot center geolocations
xcenter_amazon = mean(las_amazon@bbox[1,])
ycenter_amazon = mean(las_amazon@bbox[2,])
xcenter_Savanna = mean(las_Savanna@bbox[1,])
ycenter_Savanna = mean(las_Savanna@bbox[2,])
# Simulating GEDI full-waveform
wf_amazon<-gediWFSimulator(
input=lasfile_amazon,
output=file.path(
outdir,
"gediWF_amazon_simulation.h5"
),
coords = c(xcenter_amazon, ycenter_amazon))
wf_Savanna<-gediWFSimulator(
input=lasfile_Savanna,
output=file.path(
outdir,
"gediWF_Savanna_simulation.h5"
),
coords = c(xcenter_Savanna, ycenter_Savanna))
# Plot Full-waveform
par(mfrow=c(2,2), mar=c(4,4,0,0), oma=c(0,0,1,1),cex.axis = 1.2)
scatter3D(
las_amazon@data$X,
las_amazon@data$Y,
las_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(
las_Savanna@data$X,las_Savanna@data$Y,las_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()
close(wf_amazon)
close(wf_Savanna)
}
# }
Run the code above in your browser using DataLab