Commit 7eb0dabe authored by Manuela's avatar Manuela

small edits

parent e984e29a
......@@ -2,6 +2,7 @@ importFrom("homtest", "Lmoments", "rand.kappa", "par.kappa", "F.kappa")
importFrom("stats", "rnorm", "runif", "fft", "ks.test")
importFrom("graphics", "hist")
importFrom("goftest", "ad.test")
importFrom('wmtsa')
# importFrom("ismev","gev.fit")
# importFrom("evd","rgev","pgev")
# importFrom("GB2","mlfit.gb2","rgb2","pgb2")
......
......@@ -16,3 +16,4 @@ BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace
......@@ -17,7 +17,7 @@ prsim.wave <- function(data, station_id="Qobs", number_sim=1, win_h_length=15,
dial<-2*2^(0:J*.125)
rec<-rep(NA,(length(x[,1])))
for(l in 1:(length(x[,1]))){
rec[l]<-0.2144548*sum(wt.r[l,]/sqrt(dial))
rec[l]<-0.2144548*sum(wt.r[l,]/sqrt(dial)[1:length(wt.r[l,])])
}
return(rec)
}
......
......@@ -58,7 +58,8 @@ Manuela Brunner
}
\examples{
data(runoff_multi_sites)
prsim.wave(runoff_multi_sites, "Qobs", 1, suppWarn=TRUE, out_dir='~/PRSim-devel/data/simulations_multi_sites')
prsim.wave(runoff_multi_sites, "Qobs", 1, suppWarn=TRUE,
out_dir='~/PRSim-devel/data/simulations_multi_sites')
# warnings() # as a follow-up to `suppWarn=TRUE`
## Specifying particular CDFs:
......@@ -72,7 +73,8 @@ GEV_fit <- function( xdat, ...) gev.fit( xdat, ...)$mle
\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, out_dir='dir_PRsim_wave_data/simulations_multi_sites') # Supress 'gev.fit' output.
show=FALSE, out_dir='dir_PRsim_wave_data/simulations_multi_sites')
# Supress 'gev.fit' output.
}
## (2) example with generalized Beta distribution of the second kind
......@@ -81,7 +83,8 @@ 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
\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", out_dir='dir_PRsim_wave_data/simulations_multi_sites')
......
......@@ -30,8 +30,10 @@ Brunner and Gilleland to be submitted.
\examples{
data(runoff_multi_sites)
str(runoff_multi_sites)
runoff_multi_sites[[1]]$timestamp <- paste(runoff_multi_sites[[1]]$YYYY, runoff_multi_sites[[1]]$MM, runoff_multi_sites[[1]]$DD, sep=" ")
runoff_multi_sites[[1]]$timestamp <- as.POSIXct(strptime(runoff_multi_sites[[1]]$timestamp,format="\%Y \%m \%d", tz="GMT"))
runoff_multi_sites[[1]]$timestamp <- paste(runoff_multi_sites[[1]]$YYYY,
runoff_multi_sites[[1]]$MM, runoff_multi_sites[[1]]$DD, sep=" ")
runoff_multi_sites[[1]]$timestamp <-
as.POSIXct(strptime(runoff_multi_sites[[1]]$timestamp,format="\%Y \%m \%d", tz="GMT"))
plot(runoff_multi_sites[[1]]$timestamp[1:1000], runoff_multi_sites[[1]]$Qobs[1:1000], type="l",
xlab="Time [d]", ylab=expression(paste("Discharge [m"^3,"/s]")))
}
......
......@@ -42,13 +42,15 @@ 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')
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')
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])
}
......
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