change_climate: Simple climate change

Description Usage Arguments Author(s) Examples

Description

The funcion reads a LandClim climate file and adds a constant to temperature and precipitation.

Usage

1
  change_climate(inputPath, outputPath, dt = 0, dn = 0)

Arguments

inputPath

Path to LandClim climate file.

outputPath

Path to LandClim climate changed file.

dt

Temperature in K to add. Also negative values allowed.

dn

Precipitation to add in mm. Also negative values allowed.

Author(s)

Klara Dolos

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  ## The function is currently defined as
  function (inputPath, outputPath, dt = 0, dn = 0) {
    header <- readLines(inputPath)
    header <- header[1:14]
    clim <- read.table(inputPath, skip = 11)
    clim[, 2:13] <- clim[, 2:13] + dt
    clim[, 14:25] <- clim[, 14:25] + dn
    clim[, 14:25][clim[, 14:25] < 0] <- 0
    writeLines(header, outputPath)
    write.table(clim, outputPath, append = TRUE, row.names = FALSE,
        col.names = FALSE)
  }

KIT-IfGG/LandClimTools documentation built on May 8, 2019, 4:46 p.m.