Skip to content

Commit de9350c

Browse files
committed
Small changes, including to dated sequence
1 parent c3ca0a6 commit de9350c

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Imports:
1818
tools,
1919
purrr,
2020
lhs,
21-
readr
21+
readr,
22+
tibble
2223
RoxygenNote: 6.0.1
2324
Suggests: testthat,
2425
knitr,

R/generate_input_files.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ generate_input_files <- function(input_rhessys,
1414
option_sets_def_par,
1515
option_sets_par,
1616
option_sets_hdr,
17-
option_sets_dated_seq,
18-
world_hdr_prefix,
19-
world_file){
17+
option_sets_dated_seq){
2018

2119

2220
# ---------------------------------------------------------------------
@@ -36,7 +34,7 @@ generate_input_files <- function(input_rhessys,
3634
for (bb in seq_along(option_sets_def_par[[aa]]$group_id)){
3735

3836
change_def_file(def_file = names(option_sets_def_par)[aa],
39-
par_sets = dplyr::select(option_sets_def_par[[aa]], -group_id)[bb,],
37+
par_sets = as_tibble(dplyr::select(option_sets_def_par[[aa]], -group_id))[bb,],
4038
file_name_ext = as.character(option_sets_def_par[[aa]]$group_id[bb]))
4139
}
4240
print(paste("New def files written for file", names(option_sets_def_par)[aa]))

R/make_clim_base_file.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ make_clim_base_file <- function(input_clim_base,
2323
path <- dirname(clim_base_path)
2424
name_no_ext <- tools::file_path_sans_ext(basename(clim_base_path))
2525
ext <- tools::file_ext(clim_base_path)
26-
dated_name_ext <- paste(input_dated_seq$name, "_", clim_dated_ext, sep="")
26+
dated_name_ext <- unique(paste(input_dated_seq$name, "_", clim_dated_ext, sep=""))
2727
path_new <- file.path(path, name_no_ext)
2828
dated_path_name_ext <- file.path(path_new,dated_name_ext)
2929
dated_file_name <- paste(dated_name_ext, ".", input_dated_seq$type, sep="")
@@ -44,8 +44,12 @@ make_clim_base_file <- function(input_clim_base,
4444

4545
# Make and output dated sequence file
4646
dated_seq_file <- file.path(path_new, dated_file_name)
47-
make_dated_seq(input_dated_seq = dplyr::select(input_dated_seq,-name,-type), dated_seq_file = dated_seq_file)
48-
47+
for (aa in seq_along(dated_file_type)){
48+
tmp = input_dated_seq %>%
49+
dplyr::filter(type==dated_file_type[aa]) %>%
50+
dplyr::select(-name,-type)
51+
make_dated_seq(input_dated_seq = tmp, dated_seq_file = dated_seq_file[aa])
52+
}
4953
} else {
5054

5155
# Output standard clim file

R/run_rhessys.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ run_rhessys <- function(parameter_method = c("all_combinations", "lhc", "monte_c
4848
option_sets_def_par = option_sets$option_sets_def_par,
4949
option_sets_par = option_sets$option_sets_par,
5050
option_sets_hdr = option_sets$option_sets_hdr,
51-
option_sets_dated_seq = option_sets$option_sets_dated_seq,
52-
world_hdr_prefix = world_hdr_prefix,
53-
world_file = world_file)
51+
option_sets_dated_seq = option_sets$option_sets_dated_seq)
5452

5553
# ---------------------------------------------------------------------
5654

man/generate_input_files.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)