Description Usage Arguments Author(s) Examples
The funcion reads a LandClim climate file and adds a constant to temperature and precipitation.
1 | change_climate(inputPath, outputPath, dt = 0, dn = 0)
|
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. |
Klara Dolos
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.