Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
manuscript_code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maria Voigt
manuscript_code
Commits
fd5a8f80
Commit
fd5a8f80
authored
8 years ago
by
Maria Voigt
Browse files
Options
Downloads
Patches
Plain Diff
including alternative to have focal predictors and name suffixes
parent
7b9e5d1f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/prediction/abundance_prediction.R
+15
-10
15 additions, 10 deletions
src/prediction/abundance_prediction.R
with
15 additions
and
10 deletions
src/prediction/abundance_prediction.R
+
15
−
10
View file @
fd5a8f80
...
@@ -106,6 +106,9 @@ print(paste("for year to predict" , year_to_predict))
...
@@ -106,6 +106,9 @@ print(paste("for year to predict" , year_to_predict))
exclude_year
<-
as.numeric
(
options
$
exclude_year
)
exclude_year
<-
as.numeric
(
options
$
exclude_year
)
if
(
is_verbose
){
print
(
paste
(
"exclude year"
,
exclude_year
))}
if
(
is_verbose
){
print
(
paste
(
"exclude year"
,
exclude_year
))}
focal_change_predictor
<-
options
$
focal_change_predictor
if
(
is_verbose
){
print
(
paste
(
"focal_change_predictor"
,
focal_change_predictor
))}
if
(
is_verbose
){
print
(
paste
(
Sys.time
(),
"0. start run"
))}
if
(
is_verbose
){
print
(
paste
(
Sys.time
(),
"0. start run"
))}
#------------------------#
#------------------------#
# command line arguments #
# command line arguments #
...
@@ -116,10 +119,12 @@ indir_fun <- "~/orangutan_density_distribution/src/functions/"
...
@@ -116,10 +119,12 @@ indir_fun <- "~/orangutan_density_distribution/src/functions/"
crs_aea
<-
"+proj=aea +lat_1=7 +lat_2=-32 +lat_0=-15 +lon_0=125 +x_0=0
crs_aea
<-
"+proj=aea +lat_1=7 +lat_2=-32 +lat_0=-15 +lon_0=125 +x_0=0
+y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
# final projection
+y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
# final projection
if
(
is.na
(
exclude_year
)){
if
(
!
is.na
(
exclude_year
)){
name_suffix
<-
""
}
else
{
name_suffix
<-
paste0
(
exclude_year
,
"_"
)
name_suffix
<-
paste0
(
exclude_year
,
"_"
)
}
}
else
{
if
(
!
is.na
(
focal_change_predictor
)){
name_suffix
<-
paste0
(
focal_change_predictor
,
"_"
)
}
else
{
name_suffix
<-
""
}}
#----------------#
#----------------#
# Load functions #
# Load functions #
...
@@ -181,10 +186,15 @@ if(is_verbose){print(paste("this is predictors path", predictors_path))}
...
@@ -181,10 +186,15 @@ if(is_verbose){print(paste("this is predictors path", predictors_path))}
predictors
<-
readRDS
(
predictors_path
)
predictors
<-
readRDS
(
predictors_path
)
# import here the already z-transformed or not
# import here the already z-transformed or not
if
(
!
is.na
(
exclude_year
)){
predictors_obs_path
<-
path.to.current
(
indir
,
predictors_obs_path
<-
path.to.current
(
indir
,
paste0
(
"predictors_observation_scaled_"
,
paste0
(
"predictors_observation_scaled_"
,
name_suffix
),
name_suffix
),
"rds"
)
"rds"
)}
else
{
predictors_obs_path
<-
path.to.current
(
indir
,
"predictors_observation_scaled_"
,
"rds"
)}
if
(
is_verbose
){
print
(
paste
(
"this is predictors-obs path"
,
predictors_obs_path
))}
if
(
is_verbose
){
print
(
paste
(
"this is predictors-obs path"
,
predictors_obs_path
))}
predictors_obs
<-
readRDS
(
predictors_obs_path
)
predictors_obs
<-
readRDS
(
predictors_obs_path
)
...
@@ -227,7 +237,7 @@ if(!is.na(focal_change_predictor)){
...
@@ -227,7 +237,7 @@ if(!is.na(focal_change_predictor)){
# load 1999 value to add the values, but use the scaled table
# load 1999 value to add the values, but use the scaled table
predictors_grid_1999_path
<-
path.to.current
(
indir
,
predictors_grid_1999_path
<-
path.to.current
(
indir
,
paste0
(
"predictors_grid_scaled_"
,
paste0
(
"predictors_grid_scaled_"
,
name_suffix
,
1999
),
1999
),
"rds"
)
"rds"
)
predictors_grid_1999
<-
readRDS
(
predictors_grid_1999_path
)
predictors_grid_1999
<-
readRDS
(
predictors_grid_1999_path
)
change_predictors
<-
c
(
"year"
,
"peatswamp"
,
change_predictors
<-
c
(
"year"
,
"peatswamp"
,
...
@@ -298,11 +308,6 @@ print(paste(Sys.time(),
...
@@ -298,11 +308,6 @@ print(paste(Sys.time(),
sum
(
pred_per_cell
$
abundance_pred
>
10
)))
sum
(
pred_per_cell
$
abundance_pred
>
10
)))
if
(
is.na
(
exclude_year
)){
name_suffix
<-
""
}
else
{
name_suffix
<-
paste0
(
exclude_year
,
"_"
)
}
saveRDS
(
pred_per_cell
,
saveRDS
(
pred_per_cell
,
file
=
file.path
(
outdir
,
file
=
file.path
(
outdir
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment