Skip to content
GitLab
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
2daf88e9
Commit
2daf88e9
authored
Jan 19, 2022
by
Daniela Rabe
Browse files
Merge branch 'save_samplepoints' into 'master'
Save samplepoints See merge request
!32
parents
d44137fb
884fe901
Pipeline
#37449
passed with stages
in 15 minutes and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
R-package/R/save_files.r
View file @
2daf88e9
...
...
@@ -66,7 +66,7 @@ save_kml <- function(outPath, step, raster, overwrite) {
#' @param output_format format (character) of output; whether shp (default) or geojson
#' @param ref_samples list of reference sample points
#' @param ref_switch vector with switch values
#' @param num_models number of models used for the classification of a habitat
#' @param num_models
threshold +
number of models used for the classification of a habitat
#' @param dummy_raster raster with probabilities for each pixel
#' @param overwrite overwrite file (default TRUE)
#'
...
...
@@ -83,13 +83,14 @@ saveSamplePoints <-
output_format
=
c
(
"shp"
,
"geojson"
),
ref_samples
,
ref_switch
,
num_models
,
num_models
,
# threshold + num_models
dummy_raster
,
overwrite
=
TRUE
)
{
collect
<-
list
()
j
<-
0
dummy_raster
[
dummy_raster
==
num_models
]
<-
NA
dummy_raster
[
dummy_raster
>
num_models
]
<-
1
dummy_raster
[
dummy_raster
<
num_models
]
<-
NA
dummy_raster
[
dummy_raster
>=
num_models
]
<-
1
###extract only class samples
for
(
i
in
1
:
length
(
ref_samples
))
{
...
...
@@ -106,7 +107,7 @@ saveSamplePoints <-
}
}
}
result
<-
do.call
(
rbind
,
collect
)
if
(
!
is.null
(
result
))
{
res
<-
raster
::
extract
(
dummy_raster
,
result
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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