Skip to content

Commit

Permalink
fix lint in readLPJmLInputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Debbora Leip committed Apr 24, 2024
1 parent a0cb693 commit 6420041
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions R/readLPJmLInputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,45 @@

readLPJmLInputs <- function(subtype = "lakeshare") {

files <- c(lakeshare = "glwd_lakes_and_rivers.bin")
file <- toolSubtypeSelect(subtype, files)

# Data settings
if (subtype %in% c("lakeshare")) {

unitTrans <- 0.01
ncells <- 67420
wyears <- 1
syear <- 1
avgRange <- NULL
filetype <- "bin"
bands <- 1
datatype <- integer()
bytes <- 1
monthly <- FALSE
}

# Read in the data
x <- readLPJ(file_name = file,
wyears = wyears,
syear = syear,
averaging_range = avgRange,
ncells = ncells,
file_type = filetype,
bands = bands,
datatype = datatype,
bytes = bytes,
monthly = monthly)

# Unit transformation
x <- x * unitTrans

# Transform to magpie object and add dimension details
class(x) <- "array"
x <- collapseNames(as.magpie(x, spatial = 1))
x <- addLocation(x)
x <- collapseDim(x, dim = "N")
x <- clean_magpie(x)

return(x)
files <- c(lakeshare = "glwd_lakes_and_rivers.bin")
file <- toolSubtypeSelect(subtype, files)

# Data settings
if (subtype %in% c("lakeshare")) {

unitTrans <- 0.01
ncells <- 67420
wyears <- 1
syear <- 1
avgRange <- NULL
filetype <- "bin"
bands <- 1
datatype <- integer()
bytes <- 1
monthly <- FALSE
}

# Read in the data
x <- readLPJ(file_name = file,
wyears = wyears,
syear = syear,
averaging_range = avgRange,
ncells = ncells,
file_type = filetype,
bands = bands,
datatype = datatype,
bytes = bytes,
monthly = monthly)

# Unit transformation
x <- x * unitTrans

# Transform to magpie object and add dimension details
class(x) <- "array"
x <- collapseNames(as.magpie(x, spatial = 1))
x <- addLocation(x)
x <- collapseDim(x, dim = "N")
x <- clean_magpie(x)

return(x)
}

0 comments on commit 6420041

Please sign in to comment.