diff --git a/PRSim/DESCRIPTION b/PRSim/DESCRIPTION index 76a9bf5563474518bb4f1be9115015cf3fbee1b5..49ba54b33347c105d746173024de6fe5833d76b6 100644 --- a/PRSim/DESCRIPTION +++ b/PRSim/DESCRIPTION @@ -2,7 +2,7 @@ Package: PRSim Type: Package Title: Stochastic Simulation of Streamflow Time Series using Phase Randomization Version: 1.4-3 -Date: 2023-06-12 +Date: 2023-06-13 Authors@R: c(person("Manuela", "Brunner", role = c("aut", "cre"), email = "manuela.brunner@env.ethz.ch", comment = c(ORCID = "0000-0001-8824-877X")), @@ -38,4 +38,4 @@ LazyData: true Depends: R (>= 3.5.0) Suggests: lattice, ismev, evd, GB2, boot, MASS Imports: stats, methods, lmomco, mev, goftest, wavScalogram, splus2R -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.3 diff --git a/PRSim/man/PRSim-package.Rd b/PRSim/man/PRSim-package.Rd index 17b92427aea102b470b0c7ecdce9b491600bf222..e3e179e7095ae91046d4a106d554c9b667d6a463 100644 --- a/PRSim/man/PRSim-package.Rd +++ b/PRSim/man/PRSim-package.Rd @@ -36,7 +36,7 @@ Brunner, M. I., and E. Gilleland (2021). Spatial compound hot-dry events in the } \keyword{ package } \examples{ -\dontrun{ +\run_dontrun{ demo("PRSim") demo("PRSim-validate") demo("PRSim_wave") diff --git a/PRSim/man/fun_stoch_sim.Rd b/PRSim/man/fun_stoch_sim.Rd index 86c17bae99cdef8482dac1868a7ab24e6b0d21a2..8c177b94d52638d425e203273c45e6be7467d050 100644 --- a/PRSim/man/fun_stoch_sim.Rd +++ b/PRSim/man/fun_stoch_sim.Rd @@ -67,17 +67,19 @@ rGEV <- function(n, theta) rgev(n, theta[1], theta[2], theta[3]) pGEV <- function(x, theta) pgev(x, theta[1], theta[2], theta[3]) GEV_fit <- function( xdat, ...) gev.fit( xdat, ...)$mle -\dontrun{ # The following call requires 5 seconds to execute +\run_dontrun{ # The following call requires 5 seconds to execute out <- prsim( runoff[ runoff$YYYY<1978, ], "Qobs", 1, marginal="GEV", n_par=3, verbose=FALSE, marginalpar=FALSE, show=FALSE) # Supress 'gev.fit' output. } ## (2) example with generalized Beta distribution of the second kind +\run_dontrun{ require( "GB2") rGB2 <- function(n, theta) rgb2(n, theta[1], theta[2], theta[3], theta[4]) pGB2 <- function(x, theta) pgb2(x, theta[1], theta[2], theta[3], theta[4]) GB2_fit <- function( xdat, ...) ml.gb2( xdat, ...)$opt1$par +} \dontrun{ # The following call requires half minute or so to execute. Some warnings are issued out <- prsim( runoff[ runoff$YYYY<1987, ], "Qobs", 1, suppWarn=TRUE, diff --git a/PRSim/man/fun_stoch_sim_wave.Rd b/PRSim/man/fun_stoch_sim_wave.Rd index f690c89025a224699e9ce27681577478c2e12f82..97ab4eaf65a7279d17836d6801e3ecbd8f124e52 100644 --- a/PRSim/man/fun_stoch_sim_wave.Rd +++ b/PRSim/man/fun_stoch_sim_wave.Rd @@ -69,7 +69,7 @@ rGEV <- function(n, theta) rgev(n, theta[1], theta[2], theta[3]) pGEV <- function(x, theta) pgev(x, theta[1], theta[2], theta[3]) GEV_fit <- function( xdat, ...) gev.fit( xdat, ...)$mle -\dontrun{ # The following call requires 5 seconds to execute +\run_dontrun{ # The following call requires 5 seconds to execute prsim.wave(runoff_multi_sites, "Qobs", 1, marginal="GEV", n_par=3, verbose=FALSE, marginalpar=FALSE, show=FALSE) @@ -77,12 +77,14 @@ prsim.wave(runoff_multi_sites, "Qobs", 1, } ## (2) example with generalized Beta distribution of the second kind +\run_dontrun{ require( "GB2") rGB2 <- function(n, theta) rgb2(n, theta[1], theta[2], theta[3], theta[4]) pGB2 <- function(x, theta) pgb2(x, theta[1], theta[2], theta[3], theta[4]) GB2_fit <- function( xdat, ...) ml.gb2( xdat, ...)$opt1$par +} -\dontrun{ # The following call requires half minute or so to execute. +\run_dontrun{ # The following call requires half minute or so to execute. Some warnings are issued prsim.wave(runoff_multi_sites, "Qobs", 1, suppWarn=TRUE, marginal="GB2") diff --git a/PRSim/man/fun_stoch_sim_weather.Rd b/PRSim/man/fun_stoch_sim_weather.Rd index 083c685910e850a01a1f0ca647118c778e2a1f7e..fd0ab259f6064079863b5345e87805a44e7b6061 100644 --- a/PRSim/man/fun_stoch_sim_weather.Rd +++ b/PRSim/man/fun_stoch_sim_weather.Rd @@ -45,12 +45,12 @@ Manuela Brunner \examples{ data(weather_multi_sites) -\dontrun{ # The following call requires half minute or so to execute. +\run_dontrun{ # The following call requires half minute or so to execute. prsim.weather(data_p=data_p, data_t=data_t, number_sim=1, p_margin='egpd',t_margin='sep') } -\dontrun{ # The following call requires 5 seconds to execute +\run_dontrun{ # The following call requires 5 seconds to execute ### define normal distribution library(fitdistrplus) rNORM <- function(n, theta) rnorm(n, theta[1], theta[2]) diff --git a/lib/PRSim/DESCRIPTION b/lib/PRSim/DESCRIPTION new file mode 100644 index 0000000000000000000000000000000000000000..3e35e99b9f9a42699422a16b469fa3ff153049df --- /dev/null +++ b/lib/PRSim/DESCRIPTION @@ -0,0 +1,44 @@ +Package: PRSim +Type: Package +Title: Stochastic Simulation of Streamflow Time Series using Phase + Randomization +Version: 1.4-3 +Date: 2023-06-13 +Authors@R: c(person("Manuela", "Brunner", role = c("aut", "cre"), + email = "manuela.brunner@env.ethz.ch", + comment = c(ORCID = "0000-0001-8824-877X")), + person("Reinhard", "Furrer", role = c("aut"), + email = "reinhard.furrer@math.uzh.ch", + comment = c(ORCID = "0000-0002-6319-2332"))) +Author: Manuela Brunner [aut, cre] (<https://orcid.org/0000-0001-8824-877X>), + Reinhard Furrer [aut] (<https://orcid.org/0000-0002-6319-2332>) +Maintainer: Manuela Brunner <manuela.brunner@env.ethz.ch> +Description: Provides a simulation framework to simulate streamflow time series with similar + main characteristics as observed data. These characteristics include the distribution of daily + streamflow values and their temporal correlation as expressed by short- and long-range + dependence. The approach is based on the randomization of the phases of the Fourier + transform or the phases of the wavelet transform. The function prsim() is applicable + to single site simulation and uses the Fourier transform. + The function prsim.wave() extends the approach to multiple sites + and is based on the complex wavelet transform. The function prsim.weather() + extends the approach to multiple variables for weather generation. + We further use the flexible four-parameter Kappa distribution, + which allows for the extrapolation to yet unobserved low and high flows. + Alternatively, the empirical or any other distribution can be used. + A detailed description of the simulation approach for single sites + and an application example can be found in <doi:10.5194/hess-23-3175-2019>. + A detailed description and evaluation of the wavelet-based multi-site approach + can be found in <doi:10.5194/hess-24-3967-2020>. + A detailed description and evaluation of the multi-variable and multi-site + weather generator can be found in <doi:10.5194/esd-12-621-2021>. +URL: https://git.math.uzh.ch/reinhard.furrer/PRSim-devel +BugReports: https://git.math.uzh.ch/reinhard.furrer/PRSim-devel/-/issues +License: GPL-3 +Encoding: UTF-8 +LazyData: true +Depends: R (>= 3.5.0) +Suggests: lattice, ismev, evd, GB2, boot, MASS +Imports: stats, methods, lmomco, mev, goftest, wavScalogram, splus2R +RoxygenNote: 7.2.3 +Built: R 4.2.2; x86_64-w64-mingw32; 2023-06-13 07:49:59 UTC; windows +Archs: x64 diff --git a/lib/PRSim/INDEX b/lib/PRSim/INDEX new file mode 100644 index 0000000000000000000000000000000000000000..75adc89eda4e619c3cb77791dada0d6860a379a8 --- /dev/null +++ b/lib/PRSim/INDEX @@ -0,0 +1,20 @@ +PRSim-package Stochastic Simulation of Streamflow Time Series + using Phase Randomization +PRsim Simulate for one station +PRsim.wave Simulate for multiple stations +PRsim.weather Weather simulation (temperature and + precipitation) for multiple stations +runoff Sample runoff of a catchment +runoff_multi_site_T Sample runoff and temperature data of two + catchments with a similar discharge regime +runoff_multi_sites Sample runoff of four catchments with a similar + discharge regime +simulations Simulated runoff +simulations_multi_sites + Simulated runoff for four catchments +weather_multi_sites Sample temperature and precipitation of four + catchments derived from the ERA5-Land gridded + dataset +weather_sim_multi_sites + Simulated temperature and precipitation for two + grid cells diff --git a/lib/PRSim/Meta/Rd.rds b/lib/PRSim/Meta/Rd.rds new file mode 100644 index 0000000000000000000000000000000000000000..3b3479980f2b0e00802480d5f73af377ca9db7b7 Binary files /dev/null and b/lib/PRSim/Meta/Rd.rds differ diff --git a/lib/PRSim/Meta/data.rds b/lib/PRSim/Meta/data.rds new file mode 100644 index 0000000000000000000000000000000000000000..ed5427f39c884e3dc45460ef99e8964eef3409e4 Binary files /dev/null and b/lib/PRSim/Meta/data.rds differ diff --git a/lib/PRSim/Meta/demo.rds b/lib/PRSim/Meta/demo.rds new file mode 100644 index 0000000000000000000000000000000000000000..af7112ef524a94bd378bca6086a43f7ab1b7a297 Binary files /dev/null and b/lib/PRSim/Meta/demo.rds differ diff --git a/lib/PRSim/Meta/features.rds b/lib/PRSim/Meta/features.rds new file mode 100644 index 0000000000000000000000000000000000000000..848ce62a649aec5b5647ef7647d8f5a1318d8425 Binary files /dev/null and b/lib/PRSim/Meta/features.rds differ diff --git a/lib/PRSim/Meta/hsearch.rds b/lib/PRSim/Meta/hsearch.rds new file mode 100644 index 0000000000000000000000000000000000000000..fff2fb28b41731a0af645760af0c33b9aa0a53d3 Binary files /dev/null and b/lib/PRSim/Meta/hsearch.rds differ diff --git a/lib/PRSim/Meta/links.rds b/lib/PRSim/Meta/links.rds new file mode 100644 index 0000000000000000000000000000000000000000..f7f080b5ea6592ad625cd365c7dc474fa4991f37 Binary files /dev/null and b/lib/PRSim/Meta/links.rds differ diff --git a/lib/PRSim/Meta/nsInfo.rds b/lib/PRSim/Meta/nsInfo.rds new file mode 100644 index 0000000000000000000000000000000000000000..8193d81f504ea581ad933932e7a68b9d78474427 Binary files /dev/null and b/lib/PRSim/Meta/nsInfo.rds differ diff --git a/lib/PRSim/Meta/package.rds b/lib/PRSim/Meta/package.rds new file mode 100644 index 0000000000000000000000000000000000000000..1bd958f25c4fb0ea1ba7166e01247c7abbb5823a Binary files /dev/null and b/lib/PRSim/Meta/package.rds differ diff --git a/lib/PRSim/NAMESPACE b/lib/PRSim/NAMESPACE new file mode 100644 index 0000000000000000000000000000000000000000..79f7b11e1ca6afa3eba59d1397d1fddb35d8971b --- /dev/null +++ b/lib/PRSim/NAMESPACE @@ -0,0 +1,22 @@ +# importFrom("homtest", "Lmoments", "rand.kappa", "par.kappa", "F.kappa") ### make independent of homtest as homtest produces error (as of 25.3.2022) +importFrom("stats", "rnorm", "runif", "fft", + "aggregate", "density", "ks.test", "lm", + "na.omit", "predict") +importFrom("graphics", "hist", "abline", "lines") +importFrom("goftest", "ad.test") +importFrom('splus2R', 'ifelse1') +importFrom("methods", "as") +importFrom("stats", "deltat", "time") +importFrom('wavScalogram', 'cwt_wst') +importFrom('mev','fit.extgp','rextgp') +importFrom('lmomco','lmoms','lmom2par','rlmomco') +importFrom("stats", "optim") +# importFrom("ismev","gev.fit") +# importFrom("evd","rgev","pgev") +# importFrom("GB2","mlfit.gb2","rgb2","pgb2") + +export("prsim") +export("prsim.wave") +export("prsim.weather") + +useDynLib(PRSim, .registration = TRUE) diff --git a/lib/PRSim/NEWS.md b/lib/PRSim/NEWS.md new file mode 100644 index 0000000000000000000000000000000000000000..faa5ea46c6775faded400fb2f10c1717a5dcc813 --- /dev/null +++ b/lib/PRSim/NEWS.md @@ -0,0 +1,15 @@ +# PRSim 1.4.3 + +USER-VISIBLE CHANGES + +* added `NEWS.md` file + + + +INTERNAL CHANGES + +* improved repository structure, new `Makefile`. + +* Including example output in `tests/Examples/PRSim-Ex.Rout.save` + +* updated e-mail address \ No newline at end of file diff --git a/lib/PRSim/R/PRSim b/lib/PRSim/R/PRSim new file mode 100644 index 0000000000000000000000000000000000000000..6686156321de4dbdb52db7e32cd99961007f56e2 --- /dev/null +++ b/lib/PRSim/R/PRSim @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/lib/PRSim/R/PRSim.rdb b/lib/PRSim/R/PRSim.rdb new file mode 100644 index 0000000000000000000000000000000000000000..ab2d9dd4641a60ab6614fd8cfeb0524404ea34e8 Binary files /dev/null and b/lib/PRSim/R/PRSim.rdb differ diff --git a/lib/PRSim/R/PRSim.rdx b/lib/PRSim/R/PRSim.rdx new file mode 100644 index 0000000000000000000000000000000000000000..75ba63c3d83081f8958f6ee159ee185d660128ea Binary files /dev/null and b/lib/PRSim/R/PRSim.rdx differ diff --git a/lib/PRSim/data/Rdata.rdb b/lib/PRSim/data/Rdata.rdb new file mode 100644 index 0000000000000000000000000000000000000000..fbe38130690b02ef78120ce3aada7779c1b386f4 Binary files /dev/null and b/lib/PRSim/data/Rdata.rdb differ diff --git a/lib/PRSim/data/Rdata.rds b/lib/PRSim/data/Rdata.rds new file mode 100644 index 0000000000000000000000000000000000000000..9cd581ce0197f648a216d3d28b6e5e39b9c383bc Binary files /dev/null and b/lib/PRSim/data/Rdata.rds differ diff --git a/lib/PRSim/data/Rdata.rdx b/lib/PRSim/data/Rdata.rdx new file mode 100644 index 0000000000000000000000000000000000000000..280b120b6771818b8ce71e8e540d48d943094869 Binary files /dev/null and b/lib/PRSim/data/Rdata.rdx differ diff --git a/lib/PRSim/demo/PRSim-validate.R b/lib/PRSim/demo/PRSim-validate.R new file mode 100644 index 0000000000000000000000000000000000000000..e299208c069fc0ca2689c3c8bf8606dd4b9f5812 --- /dev/null +++ b/lib/PRSim/demo/PRSim-validate.R @@ -0,0 +1,91 @@ +# short demo +data(simulations) + +sim <- simulations$simulation + +# periodogram of deseasonalized +kern <- kernel("modified.daniell",c(10,10)) +sp1 <- spec.pgram(sim$Qobs, k=kern, taper=0, log="no", plot=FALSE) +sp2 <- spec.pgram(sim$des, k=kern, taper=0, log="no", plot=FALSE) +plot(sp1, xlim=c(0,.05)) +plot( sp2, add=T, col=2) + +# Peaks correspond to the following cycles: +1/sp1$freq[head(order(sp1$spec, decreasing=TRUE))] + +# compare periodogram of simulated series +plot(sp1, xlim=c(0,.05)) # would be nice to identify the peaks... +for (i in grep("r",names(sim))) { + spi <- spec.pgram(sim[,i], k=kern, taper=0, log="no", plot=FALSE) + plot( spi, add=T, col="gray") +} + +sp3 <- spec.pgram(sim$Qobs, taper=0, log="no", plot=FALSE) +1/sp3$freq[head(order(sp3$spec, decreasing=TRUE))] +# Annual, 6 months and 4 months + + +### plot mean regime for each simulation run and compare to observed regime +### define plotting colors +col_sim <- adjustcolor("#fd8d3c",alpha=0.8) +col_sim_tran <- adjustcolor("#fd8d3c",alpha=0.2) +col_obs <- adjustcolor( "black", alpha.f = 0.2) + +year <- unique(sim$YYYY) + +### compute mean runoff hydrograph +sim$day_id <- rep(seq(1:365),times=length(year)) +mean_hydrograph_obs <- aggregate(sim$Qobs, by=list(sim$day_id), FUN=mean,simplify=FALSE) +plot(unlist(mean_hydrograph_obs[,2]), lty=1, lwd=1, col="black", ylab=expression(paste("Discharge [m"^3,"/s]")), + xlab="Time [d]", main="Mean hydrographs", ylim=c(0,max(unlist(mean_hydrograph_obs[,2]))*1.5),type="l") + +### add mean runoff hydrographs +for(r in 7:(length(names(sim))-1)){ + mean_hydrograph <- aggregate(sim[,r], by=list(sim$day_id), FUN=mean,simplify=FALSE) + lines(mean_hydrograph, lty=1, lwd=1, col=col_sim) +} +### redo observed mean +lines(mean_hydrograph_obs, lty=1, lwd=1, col="black") + +### autocorrelation +acf_mare <- list() +acf_obs <- acf(sim$Qobs, plot=FALSE) +plot(acf_obs$acf, type="l", xlab="Lag", main="Autocorrelation", ylab="ACF") +for(r in 7:(length(names(sim))-2)){ + acf_sim <- acf(sim[,r], plot=FALSE) + lines(acf_sim$acf, col=col_sim, type="l") + ### compute mean relative error in the acf + acf_mare[[r]]<- mean(abs((acf_obs$acf-acf_sim$acf)/acf_obs$acf)) +} +lines(acf_obs$acf) + + +### partial autocorrelation function +pacf_obs <- pacf(sim$Qobs, plot=FALSE) +pacf_mare <- list() +plot(pacf_obs$acf, type="l", xlab="Lag", main="Partial autocorrelation", ylab="PACF") +for(r in 7:(length(names(sim))-2)){ + pacf_sim <- pacf(sim[,r], plot=FALSE) + lines(pacf_sim$acf, col=col_sim, type="l") + ### compute mean relative error in the acf + pacf_mare[[r]] <- mean(abs((pacf_obs$acf-pacf_sim$acf)/pacf_obs$acf)) +} +lines(pacf_obs$acf) + +### compute seasonal statistics +### Q50,Q05,Q95, boxplots +### define seasons: Winter:12,1,2; spring:3,4,5; summer: 6,7,8; fall: 9,10,11 +sim$season <- "winter" +sim$season[which(sim$MM%in%c(3,4,5))] <- "spring" +sim$season[which(sim$MM%in%c(6,7,8))] <- "summer" +sim$season[which(sim$MM%in%c(9,10,11))] <- "fall" + +### all simulated series show the same seasonal statistics. plot only one +boxplot(sim$Qobs[which(sim$season=="winter")], sim$r1[which(sim$season=="winter")], + sim$Qobs[which(sim$season=="spring")], sim$r1[which(sim$season=="spring")], + sim$Qobs[which(sim$season=="summer")], sim$r1[which(sim$season=="summer")], + sim$Qobs[which(sim$season=="fall")], sim$r1[which(sim$season=="fall")], + border=c("black", col_sim, "black", col_sim, "black", col_sim, "black", col_sim), + xaxt="n", main="Seasonal statistics", outline=FALSE) +mtext(side=1, text=c("Winter", "Spring", "Summer", "Fall"), at=c(1.5,3.5,5.5,7.5)) + diff --git a/lib/PRSim/demo/PRSim.R b/lib/PRSim/demo/PRSim.R new file mode 100644 index 0000000000000000000000000000000000000000..296f1e881103c235be4acea7e6ec024dbacd2572 --- /dev/null +++ b/lib/PRSim/demo/PRSim.R @@ -0,0 +1,26 @@ +# short demo +data(runoff) + +out <- prsim(data=runoff, number_sim=1, marginal="empirical") +out <- prsim(data=runoff, number_sim=1, marginal="kappa", GoFtest = "KS") + +### GEV distribution +require("evd") +require("ismev") +rGEV <- function(n, theta) rgev(n, theta[1], theta[2], theta[3]) +pGEV <- function(x, theta) pgev(x, theta[1], theta[2], theta[3]) +GEV_fit <- function( xdat, ...) gev.fit( xdat, show=FALSE, ...)$mle + + +### GEV +out <- prsim(data=runoff, number_sim=1, marginal="GEV", GoFtest = "KS", n_par=3) + +sim <- out$simulation +# p_val <- out$p_val +par(mai=c(.9,.9,.1,.1)) +plot(sim$timestamp[1:1000], sim$Qobs[1:1000], type="l", + xlab="Time [d]", ylab=expression(paste("Discharge [m"^3,"/s]"))) +matlines(sim$timestamp[1:1000], sim[1:1000, grep("r", names(sim))], + lty=1, col="gray") + + diff --git a/lib/PRSim/demo/PRSim_wave-validate.R b/lib/PRSim/demo/PRSim_wave-validate.R new file mode 100644 index 0000000000000000000000000000000000000000..e458f92866f1e8eea7124bf69b4c012b11801598 --- /dev/null +++ b/lib/PRSim/demo/PRSim_wave-validate.R @@ -0,0 +1,68 @@ +# short demo +### load data for four stations +data(simulations_multi_sites) +sim <- simulations_multi_sites +### loads simulations_multi_sites +# sim <- list() +# load("~/PRSim-devel/data/simulations_multi_sites/1_stoch_sim.rda") +# sim[[1]] <- out_list$simulation +# load("~/PRSim-devel/data/simulations_multi_sites/2_stoch_sim.rda") +# sim[[2]] <- out_list$simulation +# load("~/PRSim-devel/data/simulations_multi_sites/3_stoch_sim.rda") +# sim[[3]] <- out_list$simulation +# load("~/PRSim-devel/data/simulations_multi_sites/3_stoch_sim.rda") +# sim[[4]] <- out_list$simulation + +# setwd("~/PRSim-devel/data") +# save(simulations_multi_sites,file='simulations_multi_sites.rda') + +### define plotting colors +col_sim <- adjustcolor("#fd8d3c",alpha=0.8) +col_sim_tran <- adjustcolor("#fd8d3c",alpha=0.2) +col_obs <- adjustcolor( "black", alpha.f = 0.2) +### greys +col_vect_obs <- c('#cccccc','#969696','#636363','#252525') +### oranges +col_vect_sim <- c('#fdbe85','#fd8d3c','#e6550d','#a63603') + +### plot time series for multiple sites +par(mfrow=c(2,1),mar=c(3,3,2,1)) +### determine ylim +ylim_max <- max(sim[[1]]$Qobs)*1.5 +### observed +plot(sim[[1]]$Qobs[1:1000],ylab=expression(bold(paste("Specific discharge [mm/d]"))),xlab="Time [d]",type="l",col=col_vect_obs[1],ylim=c(0,ylim_max),main='Observations') +for(l in 2:4){ + lines(sim[[l]]$Qobs[1:1000],col=col_vect_obs[l]) +} +# legend('topleft',legend=c('Station 1','Station 2','Station 3','Station 4'),lty=1,col=col_vect_obs[1:4]) +### simulated (one run) +plot(sim[[1]]$r1[1:1000],ylab=expression(bold(paste("Specific discharge [mm/d]"))),xlab="Time [d]",type="l",col=col_vect_sim[1],ylim=c(0,ylim_max),main='Stochastic simulations') +for(l in 2:4){ + lines(sim[[l]]$r1[1:1000],col=col_vect_sim[l]) +} + + +### plot cross-correlation function +par(mfrow=c(4,4),mar=c(0,0,0,0)) +### run through each station comtination +for(j in 1:4){ + for(i in 1:4){ + ### ccf of observations + data_mat <- matrix(unlist(lapply(sim, "[", , "Qobs")),ncol=length(sim)) + ccf_obs <- ccf(data_mat[,i],data_mat[,j],plot=FALSE) + ### plot ccfs of observations + plot(ccf_obs$lag,ccf_obs$acf,col=col_obs,type="l",ylim=c(0,1),main='',xaxt='n',yaxt='n') + + ### simulated ccf + ### run through each simulation run + for(r in 1:2){ + data_mat_sim <- matrix(unlist(lapply(sim, "[", , paste("r",r,sep=""))),ncol=length(sim)) + ccf_sim <- ccf(na.omit(cbind(data_mat_sim[,i],data_mat_sim[,j]))[,1],na.omit(cbind(data_mat_sim[,i],data_mat_sim[,j]))[,2],plot=FALSE) + ### add one ccf plot per simulation run + lines(ccf_obs$lag,ccf_sim$acf,col=col_sim) + } + ### overplot observations again + lines(ccf_obs$lag,ccf_obs$acf,col="black",lwd=2) + } +} + diff --git a/lib/PRSim/demo/PRSim_wave.R b/lib/PRSim/demo/PRSim_wave.R new file mode 100644 index 0000000000000000000000000000000000000000..bfe351cd2361e424297f714396d39554a25b5b3a --- /dev/null +++ b/lib/PRSim/demo/PRSim_wave.R @@ -0,0 +1,173 @@ +###===============================###===============================### +### Application of PRSim.wave for different (extreme value) distributions +###===============================###===============================### + +### (1) Empirical distribution +### does not allow for extrapolation to yet unobserved values +###===============================###===============================### +out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="empirical") + +### (2) Kappa distribution (default) +### 4 parameters and flexible. Found to be performing best for +### a set of 671 nearly natural catchments in the United States (Brunner and Gilleland 2020) +###===============================###===============================### +out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="kappa", GoFtest = "KS") +# out <- prsim.wave(data=runoff_multi_sites, number_sim=5, marginal="kappa", +# GoFtest = NULL,pars=NULL, p_val=NULL) +# simulations_multi_sites<-list(out[[1]]$simulation,out[[2]]$simulation,out[[3]]$simulation,out[[4]]$simulation) +# setwd("C:/Users/mbrunner/Documents/PRSim-devel/data") +# save(simulations_multi_sites,file='simulations_multi_sites.rda') + +### (3) GEV distribution +### 3 parameters, classical extreme value distribution (Coles 2001) +###===============================###===============================### +# require("evd") +# require("ismev") +# rGEV <- function(n, theta) rgev(n, theta[1], theta[2], theta[3]) +# pGEV <- function(x, theta) pgev(x, theta[1], theta[2], theta[3]) +# GEV_fit <- function( xdat, ...) gev.fit(xdat, show=FALSE, ...)$mle + + +### simulate using GEV +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="GEV", GoFtest = "KS", n_par=3) + +### visualize simulations +### store stochastically simulated time series +### station 2 +sim <- out[[2]]$simulation + +### plot example of simulated time series +par(mai=c(.9,.9,.1,.1)) +### observed time series +plot(sim$timestamp[1:1000], sim$Qobs[1:1000], type="l", + xlab="Time [d]", ylab=expression(paste("Discharge [m"^3,"/s]"))) +### add simulations +matlines(sim$timestamp[1:1000], sim[1:1000, grep("r", names(sim))], + lty=1, col="gray") + +### compare distributions without outliers +### without outliers +boxplot(sim$Qobs,sim$r1,outline=F,col=c('black','grey'),names=c('Obs','Sim')) +### with outliers +boxplot(sim$Qobs,sim$r1,col=c('black','grey'),names=c('Obs','Sim')) + + +### (4) generalized Beta distribution of the second kind (Mielke 1974) +### 4 parameters: can lead to very extreme outliers, which are potentially implausible +###===============================###===============================### +# require( "GB2") +# rGB2 <- function(n, theta) rgb2(n, theta[1], theta[2], theta[3], theta[4]) +# pGB2 <- function(x, theta) pgb2(x, theta[1], theta[2], theta[3], theta[4]) +# GB2_fit <- function( xdat, ...) ml.gb2( xdat, ...)$opt1$par +# +# ### simulate using GB2 +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="GB2", GoFtest = "KS", n_par=4) + + +### (5) Normal distribution (just as a reference, will not perform well because it is not extreme) +### 2 parameters, not flexible enough for daily flow +###===============================###===============================### +# library(fitdistrplus) +# rNORM <- function(n, theta) rnorm(n, theta[1], theta[2]) +# pNORM <- function(x, theta) pnorm(x, theta[1], theta[2]) +# NORM_fit <- function( xdat, ...) fitdistr( xdat, 'normal', show=FALSE, ...)$estimate +# +# ### run simulations using normal distribution +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="NORM", GoFtest = "KS", n_par=2) + +### (6) generalized Gamma distribution (Prentice 1974) +### 3 parameters +### non-stable in optimization +###===============================###===============================### +# library(flexsurv) +# rGENGAM <- function(n, theta) rgengamma(n, theta[1], theta[2], theta [3]) +# pGENGAM <- function(x, theta) pgengamma(x, theta[1], theta[2], theta [3]) +# GENGAM_fit <- function( xdat, ...) fitdistr(xdat, dgengamma, start=list("mu"=0,"sigma"=0.9,"Q"=0.5))$estimate +# ### depending on your data, it may be necessary to experiment with different start values +# ### as optimization may produce some 'random' errors. +# ### As optimization is not very stable, this distribution is maybe not +# ### very useful for stochastic simulation. +# +# ### run simulations with generalized Gamma +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="GENGAM", GoFtest = "KS", n_par=3) + +### (7) Burr type XII distribution (Burr 1942) +### 3 parameters +### according to my test simulations performing very poorly. +###===============================###===============================### +# library(actuar) +# rBURR <- function(n, theta) rburr(n, theta[1], theta[2], theta [3]) +# pBURR <- function(x, theta) pburr(x, theta[1], theta[2], theta [3]) +# BURR_fit <- function( xdat, ...) fitdist(xdat, 'burr', start = list(shape1 = 0.3, shape2 = 0.9, rate = 0.9),method='mge')$estimate +# ### using maximum gooness-of-fit estimation instead of maximum likelihood estimation +# ### because the latter is numerically unstable. +# ### run simulations with Burr type XII distribution +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="BURR", GoFtest = "KS", n_par=3) + + +### (8) Wakeby distribution (Hosking 1986) +### 5 parameters, very flexible +###===============================###===============================### +# library(lmomco) +# rWAK <- function(n, theta) rlmomco(n, list(type='wak',para=theta,source='pwarwak',ifail=0,ifailtext="Successful parameter estimation.")) +# pWAK <- function(x, theta) pdfwak(x, list(type='wak',para=theta,source='pwarwak',ifail=0,ifailtext="Successful parameter estimation.")) +# WAK_fit <- function( xdat, ...){ +# lmom_X <- lmoms(xdat) +# ### fit Wakeby distribution +# wakeby_X <- parwak(lmom_X)$para +# return(wakeby_X) +# } +# +# ### run simulations with Wakeby distribution +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="WAK", GoFtest = "KS", n_par=5) + +### (9) Generalized Pareto +###===============================###===============================### +# ### produces NA values +# rGPD <- function(n, theta) rgpd(n, theta[1], theta[2], theta[3]) +# pGPD <- function(x, theta) pgpd(x, theta[1], theta[2], theta[3]) +# GPD_fit <- function( xdat, ...){ +# param <- gpd.fit( xdat, threshold=min(xdat)) +# theta <- c(param$threshold,param$mle) +# return(theta) +# } +# +# ### run simulations with Wakeby distribution +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="GPD", GoFtest = "KS", n_par=3) + + +### (10) Lognormal distribution +###===============================###===============================### +# rLNORM <- function(n, theta) rlnorm(n, theta[1], theta[2]) +# pLNORM <- function(x, theta) plnorm(x, theta[1], theta[2]) +# LNORM_fit <- function( xdat, ...) fitdistr( xdat, 'lognormal', show=FALSE, ...)$estimate +# +# ### run simulations with Wakeby distribution +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="LNORM", GoFtest = "KS", n_par=2) + + +### (11) Generalized logistic +### 3 parameters +### not worth testing as it produced negative values +###===============================###===============================### +# library(glogis) +# rGLOGIS <- function(n, theta) rglogis(n, theta[1], theta[2], theta[3]) +# pGLOGIS <- function(x, theta) plnorm(x, theta[1], theta[2], theta[3]) +# GLOGIS_fit <- function(xdat, ...) glogisfit(xdat)$coefficients +# +# ### run simulations with Wakeby distribution +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="GLOGIS", GoFtest = "KS", n_par=3) + + +### (12) Pearson type III +###===============================###===============================### +# library(FAdist) +# rPEARSON <- function(n, theta) rgamma3(n, theta[1], theta[2], theta[3]) +# pPEARSON <- function(x, theta) pgamma3(x, theta[1], theta[2], theta[3]) +# PEARSON_fit <- function( xdat, ...) fitdist(xdat, 'gamma3',start=list(shape=0.9,scale=0.9,thres=mean(xdat)),method='mge')$estimate +# ### using maximum gooness-of-fit estimation instead of maximum likelihood estimation +# ### because the latter is numerically unstable. +# +# ### run simulations with Wakeby distribution +# out <- prsim.wave(data=runoff_multi_sites, number_sim=1, marginal="PEARSON", GoFtest = "KS", n_par=3) + diff --git a/lib/PRSim/demo/PRSim_weather-validate.R b/lib/PRSim/demo/PRSim_weather-validate.R new file mode 100644 index 0000000000000000000000000000000000000000..4624b9bfdb1aa4c40ab84d243e1c00bd9ba8719f --- /dev/null +++ b/lib/PRSim/demo/PRSim_weather-validate.R @@ -0,0 +1,48 @@ +# short demo for prsim.weather +### load data for four stations +data(weather_sim_multi_sites) +sim <- weather_sim_multi_sites +# weather_sim_multi_sites <- list(weather_sim_multi_sites[[1]],weather_sim_multi_sites[[2]]) +# save(file='weather_sim_multi_sites.rda', weather_sim_multi_sites) + +### define plotting colors +col_sim <- adjustcolor("#fd8d3c",alpha=0.8) +col_sim_tran <- adjustcolor("#fd8d3c",alpha=0.2) +col_obs <- adjustcolor( "black", alpha.f = 0.2) +### greys +col_vect_obs <- c('#cccccc','#969696','#636363','#252525') +### oranges +col_vect_sim <- c('#fdbe85','#fd8d3c','#e6550d','#a63603') + +### plot time series for multiple sites + +### Temperature (first list entry) +par(mfrow=c(2,1),mar=c(3,3,2,1)) +### determine ylim +ylim_max <- max(sim[[1]][[1]]$Temp)*1.5 +### observed +plot(sim[[1]][[1]]$Temp[1:1000],ylab=expression(bold(paste("Temperature [degrees]"))),xlab="Time [d]",type="l",col=col_vect_obs[1],ylim=c(0,ylim_max),main='Observations') +for(l in 2){ + lines(sim[[l]][[1]]$Temp[1:1000],col=col_vect_obs[l]) +} +# legend('topleft',legend=c('Station 1','Station 2','Station 3','Station 4'),lty=1,col=col_vect_obs[1:4]) +### simulated (one run) +plot(sim[[1]][[1]]$r1[1:1000],ylab=expression(bold(paste("Temperature [degrees]"))),xlab="Time [d]",type="l",col=col_vect_sim[1],ylim=c(0,ylim_max),main='Stochastic simulations') +for(l in 2){ + lines(sim[[l]][[1]]$r1[1:1000],col=col_vect_sim[l]) +} + + +### precipitation (second list entry) +ylim_max <- max(sim[[1]][[2]]$Prec)*1 +### observed +plot(sim[[1]][[2]]$Prec[1:1000],ylab=expression(bold(paste("Precipitation [mm/d]"))),xlab="Time [d]",type="l",col=col_vect_obs[1],ylim=c(0,ylim_max),main='Observations') +for(l in 2){ + lines(sim[[l]][[2]]$Prec[1:1000],col=col_vect_obs[l]) +} +# legend('topleft',legend=c('Station 1','Station 2','Station 3','Station 4'),lty=1,col=col_vect_obs[1:4]) +### simulated (one run) +plot(sim[[1]][[2]]$r1[1:1000],ylab=expression(bold(paste("Precipitation [mm/d]"))),xlab="Time [d]",type="l",col=col_vect_sim[1],ylim=c(0,ylim_max),main='Stochastic simulations') +for(l in 2){ + lines(sim[[l]][[2]]$r1[1:1000],col=col_vect_sim[l]) +} diff --git a/lib/PRSim/demo/PRSim_weather.R b/lib/PRSim/demo/PRSim_weather.R new file mode 100644 index 0000000000000000000000000000000000000000..a9c83c43973f69335e0ce1c6f0b1eec55357ede3 --- /dev/null +++ b/lib/PRSim/demo/PRSim_weather.R @@ -0,0 +1,48 @@ +###===============================###===============================### +### Application of PRSim.weather for temperature and precipitation +###===============================###===============================### +### load data for four stations +data(weather_multi_sites) ### loads data_p and data_t +# weather_multi_sites <- rep(list(rep(list(NA),times=2)),times=4) +# weather_multi_sites[[1]][[1]] <- data_t[[1]] +# weather_multi_sites[[1]][[2]] <- data_p[[1]] +# weather_multi_sites[[2]][[1]] <- data_t[[2]] +# weather_multi_sites[[2]][[2]] <- data_p[[2]] +# weather_multi_sites[[3]][[1]] <- data_t[[3]] +# weather_multi_sites[[3]][[2]] <- data_p[[3]] +# weather_multi_sites[[4]][[1]] <- data_t[[4]] +# weather_multi_sites[[4]][[2]] <- data_p[[4]] +# setwd("~/PRSim-devel/data") +# save(file='weather_multi_sites.rda',weather_multi_sites) + +### (1) apply function with default distributions +### temperature: SEP, precipitation: E-GPD +### does not allow for extrapolation to yet unobserved values +###===============================###===============================### +data_t <- sapply(weather_multi_sites,function(x) x[1]) +data_p <- sapply(weather_multi_sites,function(x) x[2]) +# out <- prsim.weather(data_p=data_p, data_t=data_t, number_sim=5, p_margin='egpd',t_margin='sep') +### save example simulation data +# weather_sim_multi_sites <- out +# setwd("~/PRSim-devel/data") +# save(file='weather_sim_multi_sites.rda',weather_sim_multi_sites) + +### (2) example with alternative distributions +### rCDF and CDF_fit need to be defined +### temperature: normal, precipitation: GEV +###===============================###===============================### +### define normal distribution +# library(fitdistrplus) +# rNORM <- function(n, theta) rnorm(n, theta[1], theta[2]) +# pNORM <- function(x, theta) pnorm(x, theta[1], theta[2]) +# NORM_fit <- function( xdat, ...) fitdistr(xdat, 'normal', show=FALSE, ...)$estimate +# ### define GEV distribution +# require("evd") +# require("ismev") +# rGEV <- function(n, theta) rgev(n, theta[1], theta[2], theta[3]) +# pGEV <- function(x, theta) pgev(x, theta[1], theta[2], theta[3]) +# GEV_fit <- function( xdat, ...) gev.fit(xdat, show=FALSE, ...)$mle +# +# ### apply function using alternative distributions +# out <- prsim.weather(data_p=data_p, data_t=data_t, number_sim=1,p_margin='GEV',t_margin='NORM') +# out <- prsim.weather(data_p=data_p, data_t=data_t, number_sim=1,p_margin='NORM',t_margin='NORM') diff --git a/lib/PRSim/help/AnIndex b/lib/PRSim/help/AnIndex new file mode 100644 index 0000000000000000000000000000000000000000..60f553feab7843f328b49aae3def8f165129c78c --- /dev/null +++ b/lib/PRSim/help/AnIndex @@ -0,0 +1,22 @@ +PRSim-package PRSim-package +PRSim PRSim-package +PRsim fun_stoch_sim +prsim fun_stoch_sim +PRsim.wave fun_stoch_sim_wave +prsim.wave fun_stoch_sim_wave +PRsim.weather fun_stoch_sim_weather +prsim.weather fun_stoch_sim_weather +prsim_wave fun_stoch_sim_wave +prsim_weather fun_stoch_sim_weather +runoff runoff +runoff multi site T runoff_multi_site_T +runoff multi sites runoff_multi_sites +runoff_multi_sites runoff_multi_sites +runoff_multi_site_T runoff_multi_site_T +simulations simulations +simulations.multi.sites simulations_multi_sites +simulations_multi_sites simulations_multi_sites +weather multi sites weather_multi_sites +weather.sim.multi.sites weather_sim_multi_sites +weather_multi_sites weather_multi_sites +weather_sim_multi_sites weather_sim_multi_sites diff --git a/lib/PRSim/help/PRSim.rdb b/lib/PRSim/help/PRSim.rdb new file mode 100644 index 0000000000000000000000000000000000000000..0d011e20882d6f9a6c883940508258ea52b0bc6c Binary files /dev/null and b/lib/PRSim/help/PRSim.rdb differ diff --git a/lib/PRSim/help/PRSim.rdx b/lib/PRSim/help/PRSim.rdx new file mode 100644 index 0000000000000000000000000000000000000000..89ba22b6a22872f3d2ec6843c2530e2a86de0b8d Binary files /dev/null and b/lib/PRSim/help/PRSim.rdx differ diff --git a/lib/PRSim/help/aliases.rds b/lib/PRSim/help/aliases.rds new file mode 100644 index 0000000000000000000000000000000000000000..f313d2a2dcd9663629ea4b184525f5717c82ad4f Binary files /dev/null and b/lib/PRSim/help/aliases.rds differ diff --git a/lib/PRSim/help/paths.rds b/lib/PRSim/help/paths.rds new file mode 100644 index 0000000000000000000000000000000000000000..a968b750dfafb08dac48cee161d6b3129311de19 Binary files /dev/null and b/lib/PRSim/help/paths.rds differ diff --git a/lib/PRSim/html/00Index.html b/lib/PRSim/html/00Index.html new file mode 100644 index 0000000000000000000000000000000000000000..aa2199e1cd9a373a857c2eab6ef004a8b198b3da --- /dev/null +++ b/lib/PRSim/html/00Index.html @@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html> +<head><title>R: Stochastic Simulation of Streamflow Time Series using Phase +Randomization</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> +<link rel="stylesheet" type="text/css" href="R.css" /> +</head><body><div class="container"> +<h1> Stochastic Simulation of Streamflow Time Series using Phase +Randomization +<img class="toplogo" src="../../../doc/html/Rlogo.svg" alt="[R logo]" /> +</h1> +<hr/> +<div style="text-align: center;"> +<a href="../../../doc/html/packages.html"><img class="arrow" src="../../../doc/html/left.jpg" alt="[Up]" /></a> +<a href="../../../doc/html/index.html"><img class="arrow" src="../../../doc/html/up.jpg" alt="[Top]" /></a> +</div><h2>Documentation for package ‘PRSim’ version 1.4-3</h2> + +<ul><li><a href="../DESCRIPTION">DESCRIPTION file</a>.</li> +<li><a href="../demo">Code demos</a>. Use <a href="../../utils/help/demo">demo()</a> to run them.</li> +</ul> + +<h2>Help Pages</h2> + + +<table style="width: 100%;"> +<tr><td style="width: 25%;"><a href="PRSim-package.html">PRSim-package</a></td> +<td>Stochastic Simulation of Streamflow Time Series using Phase Randomization</td></tr> +<tr><td style="width: 25%;"><a href="PRSim-package.html">PRSim</a></td> +<td>Stochastic Simulation of Streamflow Time Series using Phase Randomization</td></tr> +<tr><td style="width: 25%;"><a href="fun_stoch_sim.html">PRsim</a></td> +<td>Simulate for one station</td></tr> +<tr><td style="width: 25%;"><a href="fun_stoch_sim.html">prsim</a></td> +<td>Simulate for one station</td></tr> +<tr><td style="width: 25%;"><a href="fun_stoch_sim_wave.html">PRsim.wave</a></td> +<td>Simulate for multiple stations</td></tr> +<tr><td style="width: 25%;"><a href="fun_stoch_sim_wave.html">prsim.wave</a></td> +<td>Simulate for multiple stations</td></tr> +<tr><td style="width: 25%;"><a href="fun_stoch_sim_weather.html">PRsim.weather</a></td> +<td>Weather simulation (temperature and precipitation) for multiple stations</td></tr> +<tr><td style="width: 25%;"><a href="fun_stoch_sim_weather.html">prsim.weather</a></td> +<td>Weather simulation (temperature and precipitation) for multiple stations</td></tr> +<tr><td style="width: 25%;"><a href="fun_stoch_sim_wave.html">prsim_wave</a></td> +<td>Simulate for multiple stations</td></tr> +<tr><td style="width: 25%;"><a href="fun_stoch_sim_weather.html">prsim_weather</a></td> +<td>Weather simulation (temperature and precipitation) for multiple stations</td></tr> +<tr><td style="width: 25%;"><a href="runoff.html">runoff</a></td> +<td>Sample runoff of a catchment</td></tr> +<tr><td style="width: 25%;"><a href="runoff_multi_site_T.html">runoff multi site T</a></td> +<td>Sample runoff and temperature data of two catchments with a similar discharge regime</td></tr> +<tr><td style="width: 25%;"><a href="runoff_multi_sites.html">runoff multi sites</a></td> +<td>Sample runoff of four catchments with a similar discharge regime</td></tr> +<tr><td style="width: 25%;"><a href="runoff_multi_sites.html">runoff_multi_sites</a></td> +<td>Sample runoff of four catchments with a similar discharge regime</td></tr> +<tr><td style="width: 25%;"><a href="runoff_multi_site_T.html">runoff_multi_site_T</a></td> +<td>Sample runoff and temperature data of two catchments with a similar discharge regime</td></tr> +<tr><td style="width: 25%;"><a href="simulations.html">simulations</a></td> +<td>Simulated runoff</td></tr> +<tr><td style="width: 25%;"><a href="simulations_multi_sites.html">simulations.multi.sites</a></td> +<td>Simulated runoff for four catchments</td></tr> +<tr><td style="width: 25%;"><a href="simulations_multi_sites.html">simulations_multi_sites</a></td> +<td>Simulated runoff for four catchments</td></tr> +<tr><td style="width: 25%;"><a href="weather_multi_sites.html">weather multi sites</a></td> +<td>Sample temperature and precipitation of four catchments derived from the ERA5-Land gridded dataset</td></tr> +<tr><td style="width: 25%;"><a href="weather_sim_multi_sites.html">weather.sim.multi.sites</a></td> +<td>Simulated temperature and precipitation for two grid cells</td></tr> +<tr><td style="width: 25%;"><a href="weather_multi_sites.html">weather_multi_sites</a></td> +<td>Sample temperature and precipitation of four catchments derived from the ERA5-Land gridded dataset</td></tr> +<tr><td style="width: 25%;"><a href="weather_sim_multi_sites.html">weather_sim_multi_sites</a></td> +<td>Simulated temperature and precipitation for two grid cells</td></tr> +</table> +</div></body></html> diff --git a/lib/PRSim/html/R.css b/lib/PRSim/html/R.css new file mode 100644 index 0000000000000000000000000000000000000000..2ef6cd60930e9e3a8ceaeba27764a8778e95f463 --- /dev/null +++ b/lib/PRSim/html/R.css @@ -0,0 +1,120 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} diff --git a/lib/PRSim/libs/x64/PRSim.dll b/lib/PRSim/libs/x64/PRSim.dll new file mode 100644 index 0000000000000000000000000000000000000000..42b0524473ed064c9805d407a583247f361100d2 Binary files /dev/null and b/lib/PRSim/libs/x64/PRSim.dll differ