Skip to content

Commit 5b99c00

Browse files
committed
Fix some issues.
1 parent 97c11f7 commit 5b99c00

File tree

10 files changed

+51
-77
lines changed

10 files changed

+51
-77
lines changed

models/lpjguess/NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export(write_binary_LPJGUESS)
1616
export(write_restart.LPJGUESS)
1717
importFrom(PEcAn.utils,days_in_year)
1818
importFrom(Rcpp,sourceCpp)
19-
importFrom(dplyr,"%>%")
2019
importFrom(ncdf4,nc_close)
2120
importFrom(ncdf4,ncatt_get)
2221
importFrom(ncdf4,ncatt_put)

models/lpjguess/R/read_restart.LPJGUESS.R

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
#' @return X_tmp vector of forecasts
1111
#' @export
1212
#' @examples
13-
#' # example code
14-
#' outdir = "/fs/data2/output//PEcAn_1000010473/out"
15-
#' runid = 1002656839
16-
#' stop.time = "1960-12-31 23:59:59 UTC"
17-
#' load("/fs/data2/output/PEcAn_1000010473/SDAsettings_develop.Rdata")
18-
#' var.names = c("AGB.pft", "TotSoilCarb")
19-
#' load("/fs/data2/output/PEcAn_1000010473/SDAparams_develop.Rdata")
13+
#' \dontrun{
14+
#' rx <- read_restart.LPJGUESS(
15+
#' outdir = "/projectnb/…/LPJ_output",
16+
#' runid = "123456",
17+
#' stop.time = as.POSIXct("2001-12-31 23:59:59", tz = "UTC"),
18+
#' settings = settings,
19+
#' var.names = c("AGB.pft"),
20+
#' params = params)
21+
#' }
2022
#' @author Istem Fer, Yinghao Sun
2123
read_restart.LPJGUESS <- function(outdir, runid, stop.time, settings, var.names, params){
2224

models/lpjguess/R/read_state.R

Lines changed: 24 additions & 33 deletions
Large diffs are not rendered by default.

models/lpjguess/R/write.config.LPJGUESS.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ write.insfile.LPJGUESS <- function(settings, trait.values, rundir, outdir, run.i
205205
# when using cru input, lpjguess will not use these clim files
206206
cru.file <- settings$run$inputs$met$path
207207
misc.file <- sub("\\.bin$", "misc.bin", cru.file)
208-
guessins <- gsub("@SOIL_FILE@", cru.file, guessins)
208+
guessins <- gsub("@MET_AND_SOIL_FILE@", cru.file, guessins)
209209
guessins <- gsub("@MISC_FILE@", misc.file, guessins)
210210

211211
# create and write CO2 file
@@ -247,8 +247,7 @@ write.insfile.LPJGUESS <- function(settings, trait.values, rundir, outdir, run.i
247247
# version check
248248
if(!is.null(settings$model$revision)){
249249
if(settings$model$revision == "PalEON"){
250-
#rm_inds <- which(grepl("@@@@@ Remove in PalEON version @@@@@", paramsins))
251-
rm_inds <- which(grepl("##### Remove in PalEON version #####", paramsins))
250+
rm_inds <- which(grepl("@@@@@ Remove in PalEON version @@@@@", paramsins))
252251
paramsins <- paramsins[-(rm_inds[1]:rm_inds[2])]
253252
}
254253
}

models/lpjguess/R/write_restart.LPJGUESS.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ write_restart.LPJGUESS <- function(outdir, runid,
3333
file.path(outdir, runid, paste0("lpjguess.", as.Date(start.time), ".out")))
3434
system(paste("rm", file.path(rundir, runid, "lpjguess.clim")))
3535
} else {
36-
print(paste("Files not renamed -- Need to rerun timestep", start.time, "before next time step"))
36+
PEcAn.logger::logger.severe(paste("rename = FALSE: Restart cannot proceed without output file",
37+
"lpjguess.out being renamed for", start.time))
38+
stop("RENAME flag is FALSE. Must rerun this timestep before continuing.")
3739
}
3840

3941
settings$run$start.date <- start.time
@@ -47,8 +49,6 @@ write_restart.LPJGUESS <- function(outdir, runid,
4749
pos_list <- new.params$LPJGUESS_state$pos_list
4850
siz_list <- new.params$LPJGUESS_state$siz_list
4951

50-
51-
5252
## ---- Build PFT parameter table from new.params ----
5353
# TODO: find accurate parameters; read params from settings
5454
pft_par_table <- data.frame()
@@ -90,7 +90,7 @@ write_restart.LPJGUESS <- function(outdir, runid,
9090
## --- Update state ---
9191
# choose a minimum diameter
9292
min.diam = 0.5
93-
Gridcell_updated <- update_state_LPJGUESS(Gridcell, pft_par_table,
93+
Gridcell_updated <- update_state_LPJGUESS(Gridcell, pft_par_table,
9494
dens.init, dens.targ,
9595
agb.init, agb.targ,
9696
AbvGrndWood.epsilon = 0.05,

models/lpjguess/inst/pecan.ins

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ run_pasture 0 ! whether to simulate pasture (1) or not (0)
133133
run_natural 1 ! whether to simulate natural vegetation (1) or not (0)
134134
run_peatland 1 ! whether to simulate peatland (1) or not (0)
135135

136-
! Remove in PalEON version
136+
@@@@@ Remove in PalEON version @@@@@
137137
lcfrac_fixed 0 ! use landcover fractions (%) below (1) or read from input file (0)
138138
lc_fixed_urban 0 ! URBAN
139139
lc_fixed_cropland 50 ! CROPLAND
@@ -142,7 +142,7 @@ lc_fixed_forest 0 ! FOREST
142142
lc_fixed_natural 25 ! NATURAL
143143
lc_fixed_peatland 25 ! PEATLAND
144144
equal_landcover_area 0 ! divide gridcell into equal active landcover fractions
145-
! Remove in PalEON version
145+
@@@@@ Remove in PalEON version @@@@@
146146
!///////////////////////////////////////////////////////////////////////////////////////
147147

148148

models/lpjguess/inst/template.ins

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ coordinates_precision 2
1717
param "file_gridlist" (str "@GRID_FILE@")
1818

1919
param "file_co2" (str "@CO2_FILE@")
20-
param "file_cru" (str "@SOIL_FILE@")
20+
param "file_cru" (str "@MET_AND_SOIL_FILE@")
2121
param "file_cru_misc" (str "@MISC_FILE@")
2222

2323
! N deposition (blank string to use constant pre-industrial level of 2 kgN/ha/year)

models/lpjguess/man/find_closing.Rd

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

models/lpjguess/man/make_key.Rd

Lines changed: 0 additions & 18 deletions
This file was deleted.

models/lpjguess/man/read_restart.LPJGUESS.Rd

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)