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
8286db60
Commit
8286db60
authored
Sep 24, 2021
by
Romulo Pereira Goncalves
Browse files
Fix incomplete commit, rast is not anymore used in this function.
parent
42fa9b17
Pipeline
#28193
passed with stages
in 7 minutes and 39 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
R-package/R/model_opt.r
View file @
8286db60
...
...
@@ -49,10 +49,10 @@ model_opt_r <- function(k,
if
(
sample_type
==
"random"
)
{
set.seed
(
seed2
[
k
])
pbt
<-
raster
::
sampleRandom
(
rast
,
size
=
sample_size
,
sp
=
T
)
raster
::
sampleRandom
(
rast
er
,
size
=
sample_size
,
sp
=
T
)
}
if
(
sample_type
==
"regular"
)
{
pbt
<-
raster
::
sampleRegular
(
rast
,
size
=
sample_size
,
sp
=
T
)
pbt
<-
raster
::
sampleRegular
(
rast
er
,
size
=
sample_size
,
sp
=
T
)
}
f
<-
which
(
is.na
(
pbt
@
data
[
1
]))
if
(
length
(
f
)
!=
0
)
{
...
...
@@ -146,12 +146,12 @@ model_opt_r <- function(k,
byid
=
TRUE
)
test1
<-
na.omit
(
raster
::
as.matrix
(
fasterize
::
fasterize
(
sf
::
st_as_sf
(
poly
),
rast
[[
1
]])
*
rast
))
na.omit
(
raster
::
as.matrix
(
fasterize
::
fasterize
(
sf
::
st_as_sf
(
poly
),
rast
er
[[
1
]])
*
rast
er
))
nam
<-
as.vector
(
fasterize
::
fasterize
(
sf
::
st_as_sf
(
poly
),
rast
[[
1
]],
field
=
"V1"
))[
-
attr
(
test1
,
"na.action"
)]
as.vector
(
fasterize
::
fasterize
(
sf
::
st_as_sf
(
poly
),
rast
er
[[
1
]],
field
=
"V1"
))[
-
attr
(
test1
,
"na.action"
)]
co
<-
raster
::
xyFromCell
(
rast
,
c
(
1
:
raster
::
ncell
(
rast
))[
-
attr
(
test1
,
"na.action"
)])
co
<-
raster
::
xyFromCell
(
rast
er
,
c
(
1
:
raster
::
ncell
(
rast
er
))[
-
attr
(
test1
,
"na.action"
)])
pbtn1
<-
as.data.frame
(
cbind
(
nam
,
co
))
sp
::
coordinates
(
pbtn1
)
<-
c
(
"x"
,
"y"
)
...
...
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