Commit ac040c62 authored by Manuela's avatar Manuela

fix urls

parent 6539dee1
......@@ -10,4 +10,4 @@
^.fun_stoch_sim_wave_diff_margins$
R/todo.R
R/fun_stoch_sim_wave_diff_margins.R
## R_LIBS=../lib
R_LIBS=C:/Users/mbrunner/Documents/R/win-library/4.0
R_LIBS=../lib
## R_LIBS='C:/Users/mbrunner/Documents/R/win-library/4.0'
## Environmental variables to simulate R-devel CRAN errors
R_KEEP_PKG_SOURCE=yes
......
......@@ -5,7 +5,7 @@ Version: 1.3-1
Date: 2021-01-05
Authors@R: c(person("Manuela", "Brunner", role = c("aut", "cre"),
email = "manuela.i.brunner@gmail.com",
comment = c(ORCID = "0000-0001-8824-877X")),
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")))
......@@ -24,15 +24,15 @@ Description: Provides a simulation framework to simulate streamflow time series
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 <https://www.hydrol-earth-syst-sci.net/23/3175/2019/>.
and an application example can be found in <https://hess.copernicus.org/articles/23/3175/2019/>.
A detailed description and evaluation of the wavelet-based multi-site approach
can be found in <https://doi.org/10.5194/hess-24-3967-2020>.
can be found in <https://hess.copernicus.org/articles/24/3967/2020/>.
URL: https://git.math.uzh.ch/reinhard.furrer/PRSim-devel
BugReports: https://git.math.uzh.ch/reinhard.furrer/PRSim-devel
License: GPL-3
Encoding: UTF-8
LazyData: true
Depends: R (>= 3.5.0), homtest, goftest, wavScalogram, splus2R
Suggests: lattice, ismev, evd, GB2
Imports: stats, methods
Suggests: lattice, ismev, evd, GB2, boot, MASS
Imports: stats, methods, lmomco, mev
RoxygenNote: 7.0.2
......@@ -6,7 +6,8 @@ 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("ismev","gev.fit")
# importFrom("evd","rgev","pgev")
# importFrom("GB2","mlfit.gb2","rgb2","pgb2")
......
No preview for this file type
This diff is collapsed.
......@@ -2,3 +2,5 @@ PRSim Simulating runoff (Fourier-based)
PRSim-validate Validation of simulated runoff (Fourier-based)
PRSim_wave Simulating runoff for multiple sites (wavelet-based)
PRSim_wave-validate Validation of simulated runoff for multiple sites (wavelet-based)
PRSim_weather Simulating temperature and precipitation for multiple sites (wavelet-based)
PRSim_weather-validate Validation of simulated temperature and precipitation for multiple sites (wavelet-based)
###===============================###===============================###
### 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',out)
# save(file='weather_sim_multi_sites.rda',weather_sim_multi_sites)
### (2) example with alternative distributions
### rCDF and CDF_fit need to be defined
......
......@@ -7,7 +7,9 @@
Applies the wavelet-based weather simulation algorithm to multiple sites (single site possible as well)
}
\usage{
prsim.weather(data_p, data_t, station_id_p="Precip",station_id_t="Temp", number_sim=1, win_h_length=15, n_wave=100,verbose=TRUE,t_margin='sep',p_margin='egpd',...)
prsim.weather(data_p, data_t, station_id_p="Precip",
station_id_t="Temp", number_sim=1, win_h_length=15,
n_wave=100,verbose=TRUE,t_margin='sep',p_margin='egpd',...)
}
\arguments{
\item{data_p}{list of precipitation data frames. One list entry, i.e. data frame, corresponds to one station/grid cell. Each data frame contains the time indications and precipitation of one station. See \sQuote{Details}.}
......
......@@ -31,13 +31,14 @@ The preciptation data were downloaded from ERA5-Land
Brunner, M. I., and E. Gilleland (2021). Spatial compound hot-dry events in the United States: assessment using a multi-site multi-variable weather generator, in preparation.
}
\examples{
data(weater_multi_sites)
str(weather_multi_sites)
weather_multi_sites[[1]]$timestamp <- paste(weather_multi_sites[[1]]$YYYY,
weather_multi_sites[[1]]$MM, weather_multi_sites[[1]]$DD, sep=" ")
weather_multi_sites[[1]]$timestamp <-
as.POSIXct(strptime(weather_multi_sites[[1]]$timestamp,format="\%Y \%m \%d", tz="GMT"))
plot(weather_multi_sites[[1]]$timestamp[1:1000], weather_multi_sites[[1]]$Qobs[1:1000], type="l",
xlab="Time [d]", ylab=expression(paste("Temperature [degrees]")))
data(weather_multi_sites)
weather_multi_sites[[1]][[1]]$timestamp <- paste(weather_multi_sites[[1]][[1]]$YYYY,
weather_multi_sites[[1]][[1]]$MM, weather_multi_sites[[1]][[1]]$DD, sep=" ")
weather_multi_sites[[1]][[1]]$timestamp <-
as.POSIXct(strptime(weather_multi_sites[[1]][[1]]$timestamp,
format="\%Y \%m \%d", tz="GMT"))
plot(weather_multi_sites[[1]][[1]]$timestamp[1:1000],
weather_multi_sites[[1]][[1]]$Qobs[1:1000], type="l",
xlab="Time [d]", ylab=expression(paste("Temperature [degrees]")))
}
\keyword{datasets}
......@@ -35,6 +35,8 @@ The data has been generated with
Brunner, M. I., and E. Gilleland (2021). Spatial compound hot-dry events in the United States: assessment using a multi-site multi-variable weather generator, in preparation.
}
\examples{
data(weather_sim_multi_sites)
sim <- weather_sim_multi_sites
### define plotting colors
col_sim <- adjustcolor("#fd8d3c",alpha=0.8)
col_sim_tran <- adjustcolor("#fd8d3c",alpha=0.2)
......@@ -51,13 +53,20 @@ 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')
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:4){
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])
# 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')
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:4){
lines(sim[[l]][[1]]$r1[1:1000],col=col_vect_sim[l])
}
......@@ -66,13 +75,20 @@ for(l in 2:4){
### 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')
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:4){
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])
# 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')
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:4){
lines(sim[[l]][[2]]$r1[1:1000],col=col_vect_sim[l])
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment