Skip to content

Problem with parameterList during runLPJ.  #55

@Mareena0409

Description

@Mareena0409

Dear developers,
I am trying to run the rLPJGUESS v.1.1.0 using the LPJ-GUESS v.3.1 (as suggested in the r package). But I get the following error that parameter list is invalid. the expected class of parameterList object is Matrix but it returns both Matrix and array as its class. I have not changed any settings as of now and I am trying to do the test run using the given code and files. Any help would be greatly appreciated.
Thank you

graphics.off()
rm(list = ls())
library(rLPJGUESS)
typeList <- c("cmass", "lai")
scaleLPJ_SPP <- "europe"
scaleLPJ_PFT <- "global"
LPJparameters_SPP <- getParameterList(scale = scaleLPJ_SPP, list = F)
LPJparameters_PFT <- as.matrix(getParameterList(scale = scaleLPJ_PFT, list = F))
setwd("E:/Testcode/Testcode")
mainDir <- file.path(getwd(), "LPJrunTest")
LPJsettings_PFT <- list(file.co2 = file.path(mainDir, "crudata",

  •                                          "co2_1765-2500_RCP3.txt"), file.cru = file.path(mainDir, 
    
  •                                                                                          "crudata", "cru_1901_2006.bin"), file.cru.misc = file.path(mainDir, 
    
  •                                                                                                                                                     "crudata", "cru_1901_2006misc.bin"), file.ndep = file.path(mainDir, 
    
  •                                                                                                                                                                                                                "crudata", "GlobalNitrogenDeposition.bin"), file.temp = file.path(mainDir, 
    
  •                                                                                                                                                                                                                                                                                  "temp.nc"), file.prec = file.path(mainDir, "prec.nc"), file.insol = file.path(mainDir, 
    
  •                                                                                                                                                                                                                                                                                                                                                                "rad.nc"), variable.temp = "temp", variable.insol = "rad", 
    
  •                     variable.prec = "prec", delete = F, save = F, processing = T, 
    
  •                     plot.data = F, save.plots = F, scale = scaleLPJ_PFT, mode = "cf", 
    
  •                     gridList = "gridlist.txt")
    

designLPJ <- getDesign(scale = scaleLPJ_PFT, list = T)
class(designLPJ)
[1] "list"
designLPJ$run_vegmode <- "cohort"
designLPJ$run_ifcentury <- 0
designLPJ$run_iffire <- 0
designLPJ$run_ifnlim <- 0
designLPJ$run_ifstochestab <- 0
designLPJ$run_ifstochmort <- 0
designLPJ$run_patcharea <- 25^2
designLPJ$run_npatch <- 1
designLPJ$run_ifdisturb <- 0
designLPJ$run_nyear_spinup <- 1
designLPJ$run_freenyears <- 0
designLPJ$run_save_state <- 0
designLPJ$run_restart <- 0
designLPJ$run_state_path <- mainDir
LPJsettings_PFT$design <- designLPJ
LPJsetup <- mainDir
spp <- as.matrix(LPJparameters_PFT[grep("_include", rownames(LPJparameters_PFT)),

  • ])

class(spp)
[1] "matrix" "array"
PFTs <- c("TeNE", "TeBS", "IBS", "TeBE", "C3G")
PFTsRows <- c()
for (i in PFTs) PFTsRows <- c(PFTsRows, grep(i, rownames(spp)))
spp[-PFTsRows, 1] <- 0
parameterStandard_PFT <- as.matrix(LPJparameters_PFT[-grep("_include",

  •                                                        rownames(LPJparameters_PFT)), ])
    

parameterStandard_PFT <- rbind(parameterStandard_PFT, spp)
parameterStandard_PFT <- as.matrix(parameterStandard_PFT)
class(parameterStandard_PFT)
[1] "matrix" "array"
ptm <- proc.time()
results_PFT <- runLPJ(x = mainDir, parameterList = parameterStandard_PFT,

  •                   typeList = typeList, settings = LPJsettings_PFT)
    

Using package template (template 1)
Saving package template in the mainDir
Using package template (template 2)
Saving package template in the mainDir
Error in if (class(parameterList) == "matrix") { :
the condition has length > 1
In addition: Warning messages:
1: In createSingleObject(x, typeList, settings) :
The file.wetdays has not been provided
2: In createSingleObject(x, typeList, settings) :
The file.minTemp has not been provided
3: In createSingleObject(x, typeList, settings) :
The file.maxTemp has not been provided
4: In createSingleObject(x, typeList, settings) :
The variable.wetdays has not been provided
5: In createSingleObject(x, typeList, settings) :
The variable.minTemp has not been provided
6: In createSingleObject(x, typeList, settings) :
The variable.maxTemp has not been provided
Error in runLPJ(x = mainDir, parameterList = parameterStandard_PFT, typeList = typeList, :
Invalid parameterList provided

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions