Commit 68233032 authored by Haffenden Austin's avatar Haffenden Austin
Browse files

Initial commit to gitlab

parents
^.*\.Rproj$
^\.Rproj\.user$
paste0(curr_site, "_swhc.asc"))))
nitrogen_r[i] <- raster::getValues(raster::raster( file.path(source_land_dir, curr_site,
paste0(curr_site, "_nitrogen.asc"))))
getValues(soil_r)
getValues(nitrogen_r)
no_sim_years
tmp_sim_years <- ifelse(no_sim_years < 10, 10, no_sim_years)
tmp_sim_years
file_prefix
i
site_r[i]
curr_site <- site_r[i]
source_clim_dir
curr_data <- read_climate_file(source_clim_dir, curr_site)
curr_data
curr_elev_r <- raster::raster(file.path(source_land_dir, curr_site,
paste0(curr_sites[i],
"_elevation.asc")))
adj_data <- lapse_adjust_climate(curr_data, raster::getValues(curr_elev_r))
adj_data
adj_data_plus_rowcol <- row_col_to_clim_SED(site_r, i, adj_data)
adj_data_plus_rowcol
source_is_dir
sim_xml_dir
library(landclimSetup)
ls()
site_r
ncell(site_r)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
nrow <- 1
ncol <- 1
value <- 280.0854
matrix(value, nrow = nrows, ncol = ncols)
matrix(value, nrow = nrow, ncol = ncol)
as.matrix(value)
library(raster)
help("extract")
9995*0.24
2398-1784
library(landclimSetup)
load("/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/sysdata.rda")
for_pars
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
21.6*283.7771
1.58559*3696.778
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
help(assert)
help(asert)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
return(all_spp)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
help("as.data.frame")
help("as.matrix")
library(landclimSetup)
help(transform)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
all_spp[, c("foliageWeightExponent", "foliageWeightFactor")] <- IFN_forrester_foliage_pars(all_spp[,"name"],
all_spp[,"leafHabit"])
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
ls()
rm(list=ls())
#=============
# FUNCTIONS
#==========
# Starting libraries
library(rhelpers)
#detach("package:landclimSetup", unload = TRUE) # during package building
library(landclimSetup)
# library(BayesianTools)
# library(R.utils)
#detach("package:ifnHelpers", unload = TRUE) # during package building
library(ifnHelpers)
#==============================================================================
# Set directories
#set_paths(mobile = TRUE)
set_paths() # user generated function from {rhelpers}
#==============================================================================
# CODE BODY
#==============================================================================
# Directories
IFN_dir <- file.path(lc_cal_dir, "IFN_single_plots_2008_2011")
IFN_clim_dir <- file.path(IFN_dir, "climate")
IFN_is_dir <- file.path(IFN_dir, "initialstate")
IFN_land_dir <- file.path(IFN_dir, "landscape")
IFN_sim_dir <- file.path(IFN_dir, "simulations")
IFN_xml_dir <- file.path(IFN_dir, "xml_input")
IFN_tree_dir <- file.path(IFN_dir, "tree_data")
calib_root <- file.path(lc_cal_dir, "IFN_single_spp", "castsati_plus_one")
sim_dir <- calib_root
sim_clim_dir <- file.path(sim_dir, "climate")
sim_is_dir <- file.path(sim_dir, "initialstate")
sim_land_dir <- file.path(sim_dir, "landscape")
sim_sim_dir <- file.path(sim_dir, "simulations")
sim_xml_dir <- file.path(sim_dir, "xml_input")
alien_r_dir <- "/home/austin/partage/austin.haffenden/Private/ALIEN/data/data_products/r_data_dir"
targ_spp <- "castsati"
file_root <- paste0("IFN_", targ_spp, "_plots_2008_2011")
plots_df <- readRDS(file.path(alien_r_dir, paste0("IFN_", targ_spp, "_2008_2011_plots_df.RDS")))
# only targ_spp plots
only_targ <- subset(plots_df, num_spp==1)
nrow(only_targ)
# targ plus one
targ_1 <- subset(plots_df, num_spp<=2)
nrow(targ_1)
# 413
sum(targ_1[, targ_spp])
# 1852
# targ plus two
targ_2 <- subset(plots_df, num_spp<=3)
nrow(targ_2)
# 844
sum(targ_2[, targ_spp])
# 3379
# go with targ_1 (target species and one other in plots)
plot_names <- targ_1$plot
length(plot_names)
# 413
# create SED files
no_sim_years <- 5
# this sets up the SED files - need to create a test function that then
# randomly selects cells/rows from the files created and compares them to
# the individually created IFN data
# this also needs to be re-run
detach("package:landclimSetup", unload = TRUE) # during package building
library(landclimSetup)
create_SED_files(file_root, # climate_file_prefix
no_sim_years, # five years for the calibration
sim_dir,
IFN_dir,
plot_names,
skip_landscape = TRUE,
skip_climate = TRUE,
skip_initialstate = TRUE,
skip_XML_input = FALSE,
skip_simulation = FALSE)
library(landclimSetup)
load("/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/sysdata.rda")
ls()
rm(list = ls())
ls()
load("/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/sysdata.rda")
ls()
head(for_pars)
plots_df <- readRDS(file.path(alien_r_dir, paste0("IFN_", targ_spp, "_2008_2011_plots_df.RDS")))
# only targ_spp plots
only_targ <- subset(plots_df, num_spp==1)
nrow(only_targ)
# targ plus one
targ_1 <- subset(plots_df, num_spp<=2)
nrow(targ_1)
# 413
sum(targ_1[, targ_spp])
# 1852
# targ plus two
targ_2 <- subset(plots_df, num_spp<=3)
nrow(targ_2)
# 844
sum(targ_2[, targ_spp])
# 3379
# go with targ_1 (target species and one other in plots)
plot_names <- targ_1$plot
length(plot_names)
# 413
# create SED files
no_sim_years <- 5
# this sets up the SED files - need to create a test function that then
# randomly selects cells/rows from the files created and compares them to
# the individually created IFN data
# this also needs to be re-run
detach("package:landclimSetup", unload = TRUE) # during package building
library(landclimSetup)
create_SED_files(file_root, # climate_file_prefix
no_sim_years, # five years for the calibration
sim_dir,
IFN_dir,
plot_names,
skip_landscape = TRUE,
skip_climate = TRUE,
skip_initialstate = TRUE,
skip_XML_input = FALSE,
skip_simulation = FALSE)
#' @title Selection of IFN plots and creation of SED data for calibration run
#' for castsati species only
#' @description
#==============================================================================
rm(list=ls())
#=============
# FUNCTIONS
#==========
# Starting libraries
library(rhelpers)
#detach("package:landclimSetup", unload = TRUE) # during package building
library(landclimSetup)
# library(BayesianTools)
# library(R.utils)
#detach("package:ifnHelpers", unload = TRUE) # during package building
library(ifnHelpers)
#==============================================================================
# Set directories
#set_paths(mobile = TRUE)
set_paths() # user generated function from {rhelpers}
#==============================================================================
# CODE BODY
#==============================================================================
# Directories
IFN_dir <- file.path(lc_cal_dir, "IFN_single_plots_2008_2011")
IFN_clim_dir <- file.path(IFN_dir, "climate")
IFN_is_dir <- file.path(IFN_dir, "initialstate")
IFN_land_dir <- file.path(IFN_dir, "landscape")
IFN_sim_dir <- file.path(IFN_dir, "simulations")
IFN_xml_dir <- file.path(IFN_dir, "xml_input")
IFN_tree_dir <- file.path(IFN_dir, "tree_data")
calib_root <- file.path(lc_cal_dir, "IFN_single_spp", "castsati_plus_one")
sim_dir <- calib_root
sim_clim_dir <- file.path(sim_dir, "climate")
sim_is_dir <- file.path(sim_dir, "initialstate")
sim_land_dir <- file.path(sim_dir, "landscape")
sim_sim_dir <- file.path(sim_dir, "simulations")
sim_xml_dir <- file.path(sim_dir, "xml_input")
alien_r_dir <- "/home/austin/partage/austin.haffenden/Private/ALIEN/data/data_products/r_data_dir"
targ_spp <- "castsati"
file_root <- paste0("IFN_", targ_spp, "_plots_2008_2011")
plots_df <- readRDS(file.path(alien_r_dir, paste0("IFN_", targ_spp, "_2008_2011_plots_df.RDS")))
# only targ_spp plots
only_targ <- subset(plots_df, num_spp==1)
nrow(only_targ)
# targ plus one
targ_1 <- subset(plots_df, num_spp<=2)
nrow(targ_1)
# 413
sum(targ_1[, targ_spp])
# 1852
# targ plus two
targ_2 <- subset(plots_df, num_spp<=3)
nrow(targ_2)
# 844
sum(targ_2[, targ_spp])
# 3379
# go with targ_1 (target species and one other in plots)
plot_names <- targ_1$plot
length(plot_names)
# 413
# create SED files
no_sim_years <- 5
# this sets up the SED files - need to create a test function that then
# randomly selects cells/rows from the files created and compares them to
# the individually created IFN data
# this also needs to be re-run
detach("package:landclimSetup", unload = TRUE) # during package building
library(landclimSetup)
create_SED_files(file_root, # climate_file_prefix
no_sim_years, # five years for the calibration
sim_dir,
IFN_dir,
plot_names,
skip_landscape = TRUE,
skip_climate = TRUE,
skip_initialstate = TRUE,
skip_XML_input = FALSE,
skip_simulation = FALSE)
#=======================================
library(landclimSetup)
detach("package:landclimSetup", unload = TRUE) # during package building
library(landclimSetup)
create_SED_files(file_root, # climate_file_prefix
no_sim_years, # five years for the calibration
sim_dir,
IFN_dir,
plot_names,
skip_landscape = TRUE,
skip_climate = TRUE,
skip_initialstate = TRUE,
skip_XML_input = FALSE,
skip_simulation = FALSE)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
for_pars
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
in_component = "Leaf area"
curr_dat <- subset(for_pars, Component == in_component)
curr_dat
library(landclimSetup)
9*40
360/60
20*10
200/60
3*40
120/24
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
library(landclimSetup)
[
]
\ No newline at end of file
build-last-errors="[]"
build-last-errors-base-dir="/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/"
build-last-outputs="[{\"output\":\"==> R CMD INSTALL --no-multiarch --with-keep.source landclimSetup\\n\\n\",\"type\":0},{\"output\":\"* installing to library ‘/home/austin/lib/R/library’\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* installing *source* package ‘landclimSetup’ ...\\n\",\"type\":1},{\"output\":\"It is recommended to use ‘given’ instead of ‘middle’.\\n\",\"type\":1},{\"output\":\"It is recommended to use ‘given’ instead of ‘middle’.\\n\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** preparing package for lazy loading\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"** testing if installed package can be loaded\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* DONE (landclimSetup)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]"
compile_pdf_state="{\"errors\":[],\"output\":\"\",\"running\":false,\"tab_visible\":false,\"target_file\":\"\"}"
console_procs="[]"
files.monitored-path=""
find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":true,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOff\":[],\"matchOn\":[]},\"running\":false}"
imageDirtyState="1"
saveActionState="-1"
{"active_set":"","sets":[]}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment