Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Habitat Sampler
HabitatSampler
Commits
20fbb72b
Commit
20fbb72b
authored
Jun 08, 2021
by
Johannes Knoch
Committed by
Romulo Pereira Goncalves
Jun 08, 2021
Browse files
Fixes for
#20
and improvements like suggested in
#22
parent
d2e29a93
Changes
3
Hide whitespace changes
Inline
Side-by-side
R-package/R/outer_procedure.r
View file @
20fbb72b
...
...
@@ -366,6 +366,7 @@ multi_Class_Sampling <- function(in.raster,
g
=
RGB
[
2
],
b
=
RGB
[
3
],
num_models
=
num_models
,
nb_models
=
nb_models
,
acc
=
acc
,
color
=
color
,
outPath
=
outPath
,
...
...
@@ -473,6 +474,7 @@ multi_Class_Sampling <- function(in.raster,
g
=
RGB
[
2
],
b
=
RGB
[
3
],
num_models
=
num_models
,
nb_models
=
nb_models
,
acc
=
acc
,
color
=
color
,
outPath
=
outPath
,
...
...
@@ -519,9 +521,7 @@ multi_Class_Sampling <- function(in.raster,
raster
::
KML
(
kml
,
paste
(
outPath
,
paste
(
"step_"
,
ni
,
sep
=
""
),
sep
=
""
),
overwrite
=
overwrite
)
thres
<-
as.numeric
(
decision
)
dummy
<-
maFo_rf
@
layer
[[
1
]]
max_prob
<-
raster
::
cellStats
(
dummy
,
"max"
)
thres
<-
(
max_prob
/
100
)
*
thres
thres
<-
thres
+
num_models
dummy
[
dummy
<
thres
]
<-
1
dummy
[
dummy
>=
thres
]
<-
NA
in.raster
<-
in.raster
*
dummy
...
...
@@ -532,7 +532,7 @@ multi_Class_Sampling <- function(in.raster,
out.raster
<<-
in.raster
remove
(
dummy
)
remove
(
maFo_rf
)
print
(
paste
(
paste
(
"Habitat"
,
i
),
"Done"
))
colnames
(
reference
)
<-
names
(
in.raster
)
...
...
R-package/R/plot_interactive.r
View file @
20fbb72b
...
...
@@ -10,6 +10,7 @@
#' @param b blue channel (integer)
#' @param acc predictive accuracy (integer)
#' @param num_models number of selected models
#' @param nb_models number of models (independent classifiers) for the specification in the legend
#' @param color color pallet
#' @param outPath file path for '.html export (character)
#' @param plot_on_browser plot on the browser or inline in a notebook (default TRUE)
...
...
@@ -24,6 +25,7 @@ iplot <- function(x,
b
,
acc
,
num_models
,
nb_models
,
color
,
outPath
,
plot_on_browser
=
TRUE
)
{
...
...
@@ -125,11 +127,10 @@ iplot <- function(x,
######
rr
<-
x
raster
::
values
(
rr
)
<-
1
:
raster
::
ncell
(
rr
)
max
<-
raster
::
cellStats
(
x
,
"max"
)
-
num_models
x
<-
raster
::
calc
(
x
,
fun
=
function
(
y
)
round
((
(
y
-
num_models
)
/
max
)
*
100
,
digits
=
2
)
(
y
-
num_models
)
)
##############################################################################
##[2] Create Leaflet Html output for Webbrowser
...
...
@@ -166,16 +167,28 @@ iplot <- function(x,
layerId
=
HaTy
,
prefix
=
"Habitat Type"
)
mv
<-
leaflet
::
addLegend
(
map
=
mv
,
"bottomright"
,
pal
=
pal
,
labFormat
=
leaflet
::
labelFormat
(
suffix
=
"%"
,),
values
=
c
(
0
,
100
),
title
=
paste
(
"Habitat Type Probability<br>(for "
,
num_models
,
" models)"
,
sep
=
""
),
opacity
=
1
)
if
(
num_models
<
11
)
{
mv
<-
leaflet
::
addLegend
(
map
=
mv
,
"bottomright"
,
pal
=
pal
,
labFormat
=
leaflet
::
labelFormat
(
suffix
=
" Models"
,
transform
=
function
(
x
)
seq
(
0
,
num_models
,
1
)),
values
=
c
(
0
,
num_models
),
title
=
paste
(
"Number of models ("
,
num_models
,
" out of "
,
nb_models
,
")<br>predicting class "
,
HaTy
,
sep
=
""
),
opacity
=
1
)
}
else
{
mv
<-
leaflet
::
addLegend
(
map
=
mv
,
"bottomright"
,
pal
=
pal
,
labFormat
=
leaflet
::
labelFormat
(
suffix
=
" Models"
),
values
=
c
(
0
,
num_models
),
title
=
paste
(
"Number of models ("
,
num_models
,
" out of "
,
nb_models
,
")<br>predicting class "
,
HaTy
,
sep
=
""
),
opacity
=
1
)
}
mv
<-
leaflet
::
addLayersControl
(
map
=
mv
,
overlayGroups
=
c
(
"RGB Composite"
,
HaTy
))
...
...
R-package/man/iplot.Rd
View file @
20fbb72b
...
...
@@ -13,6 +13,7 @@ iplot(
b,
acc,
num_models,
nb_models,
color,
outPath,
plot_on_browser = TRUE
...
...
@@ -35,6 +36,8 @@ iplot(
\item{num_models}{number of selected models}
\item{nb_models}{number of models (independent classifiers) for the specification in the legend}
\item{color}{color pallet}
\item{outPath}{file path for '.html export (character)}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment