The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Modify Weather File

This vignette shows how to apply monthly changes into a weather file for climate scenarios.

library(weaana)

The daily weather records are stored in the apsim format.

file <- system.file("extdata/WeatherRecordsDemo1.met", package = "weaana")
# Read weather file
met <- readWeatherRecords(file)
# Get records in data.frame
records <- getWeatherRecords(met)
# Calculate month from weather records
month <- as.numeric(format(records$date, '%m'))
   

The monthly changes of future climate can be obtained from future climate scenarios.

set.seed(1)
# maximum and minimum temperature changes are absolute values
tasmax <- (runif(12) - 0.5) * 2
tasmin <- (runif(12) - 0.5) * 2
# rain changes are a ratio
pr <- (runif(12) - 0.5) / 10

Add the monthly changes into weather records

new_maxt <- records$maxt + tasmax[month]
new_mint <- records$mint + tasmin[month]
new_rain <- records$rain * pr[month]
changeWeatherRecords(met, maxt = new_maxt)
changeWeatherRecords(met, mint = new_mint)
changeWeatherRecords(met, rain = new_rain)

Finally the new met file is saved into a new file

writeWeatherRecords(met, "new-file.met")

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.