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
59f66cab
Commit
59f66cab
authored
Sep 14, 2021
by
Romulo Pereira Goncalves
Browse files
Remove all the NaNs from the input raster.
parent
f425b983
Changes
1
Hide whitespace changes
Inline
Side-by-side
R-package/R/model_opt.r
View file @
59f66cab
...
...
@@ -42,6 +42,7 @@ model_opt_r <- function(k,
points
<-
NULL
models
<-
NULL
oobe
<-
matrix
(
NA
,
nrow
=
n
,
ncol
=
1
)
rast
<-
raster
::
mask
(
rast
,
raster
::
calc
(
rast
,
fun
=
sum
))
for
(
j
in
1
:
n
)
{
###Vorbereitung Klassifizierung
if
(
j
==
1
)
{
...
...
@@ -54,10 +55,10 @@ model_opt_r <- function(k,
if
(
sample_type
==
"regular"
)
{
pbt
<-
raster
::
sampleRegular
(
raster
,
size
=
sample_size
,
sp
=
T
)
}
f
<-
which
(
is.na
(
pbt
@
data
[
1
]))
if
(
length
(
f
)
!=
0
)
{
pbt
<-
pbt
[
-
f
,]
}
#
f <- which(is.na(pbt@data[1]))
#
if (length(f) != 0) {
#
pbt <- pbt[-f,]
#
}
set.seed
(
seed2
[
k
])
classes
<-
as.factor
(
sample
(
c
(
1
:
2
),
size
=
nrow
(
pbt
),
replace
=
T
))
...
...
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