forked from carlos-alberto-silva/rGEDI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.Rd
124 lines (102 loc) · 4.28 KB
/
plot.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/class.gedi.R
\name{plot}
\alias{plot}
\alias{plot,gedi.fullwaveform,missing-method}
\alias{plot,gedi.level1bSim,missing-method}
\title{Plot GEDI* object}
\usage{
plot(x, y, ...)
\S4method{plot}{gedi.fullwaveform,missing}(x, relative = FALSE, polygon = FALSE, ...)
\S4method{plot}{gedi.level1bSim,missing}(x, relative = FALSE, polygon = FALSE, method = "RXWAVEINT", ...)
}
\arguments{
\item{x}{An object of class "gedi.fullwaveform". (output of \code{\link[rGEDI:getLevel1BWF]{getLevel1BWF}} function)}
\item{y}{not used (inherited from R base)}
\item{...}{will be passed to the main plot}
\item{relative}{if TRUE, the Wavform Amplitude will be showed in percentage (\%)}
\item{polygon}{if TRUE, polygon will be added to the plot}
\item{method}{methods used for simulating the GEDI full-waveform ("RXWAVEINT","RXWAVEINT" or "RXWAVEINT"). Default is "RXWAVECOUNT".}
}
\description{
for gedi.fullwaveform: will plot the full waveform\cr\cr
for gedi.level1bSim: will plot the simulated waveform
}
\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)
# extract the desired information into a dataframe
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="", ylab="Elevation (m)")
plot(wf, relative=TRUE, polygon=TRUE, type="l", lwd=2, col="forestgreen",
xlab="Waveform Amplitude (\%)", ylab="Elevation (m)")
close(level1b)
\dontshow{
rm(list=ls())
}
zipfile_amazon <- system.file("extdata", "Amazon.zip", package="rGEDI")
zipfile_Savanna <- system.file("extdata", "Savanna.zip", package="rGEDI")
lasfile_amazon <- unzip(zipfile_amazon)
lasfile_Savanna <- unzip(zipfile_Savanna)
# 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(
getwd(),
"gediWF_amazon_simulation.h5"
),
coords = c(xcenter_amazon, ycenter_amazon))
wf_Savanna<-gediWFSimulator(
input=lasfile_Savanna,
output=file.path(
getwd(),
"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)
}
}