generatePrecipitationAmount: Generation of Precipitation Amount

Description Usage Arguments See Also Examples

View source: R/generatePrecipitation.R

Description

Generetion of daily precipitation amount taking into accont a previous generation of precipitation occurence with generate

Usage

1
generatePrecipitationAmount(x, origin = "1961-1-1", par = NULL, ...)

Arguments

x

object of precipitation quantiles returned by generate.YuleWalkerCoefficientBlockmatrices or generate.YuleWalkerCoefficientBlockmatricesPerEachMonth with option precipitation.indicator==TRUE

origin

character string containing the date releted to the first row of x. Default is "1961-1-1".

par

fitdistrForEachStationForEachMonth-class or fitdistrForEachStation-class object returned by fitdistrForPrecipitation

...

further arguments

See Also

qqfit,fitdistrForPrecipitation,generate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
## # Not Run in the examples, uncomment to run the following lines

#library(RMRAINGEN)
#
#set.seed(1233)
#data(trentino)
#
#year_min <- 1987
#year_max <- 1990
#
#period <- PRECIPITATION$year>=year_min & PRECIPITATION$year<=year_max
#station <- names(PRECIPITATION)[!(names(PRECIPITATION) %in% c("day","month","year"))]
#prec_mes <- PRECIPITATION[period,station]
#
### removing nonworking stations (e.g. time series with NA)
#accepted <- array(TRUE,length(names(prec_mes)))
#names(accepted) <- names(prec_mes)
#for (it in names(prec_mes)) {
#		 accepted[it]  <- (length(which(!is.na(prec_mes[,it])))==length(prec_mes[,it]))
#}

#prec_mes <- prec_mes[,accepted]
### the dateset is reduced!!!
#prec_mes <- prec_mes[,1:2]
#
#fit  <- fitdistrForPrecipitation(data=prec_mes,dname="exp",start=NULL,sample=NULL)
#
#origin <- paste(year_min,1,1,sep="-")
#
### Fitting of Probability Distribution of Precipitation Amount
#fit_monthly   <- fitdistrForPrecipitation(data=prec_mes,dname="gamma",
#                 start=NULL,sample="monthly",origin=origin)
#
### Estimate coefficients for Precipitation Occurence Modeling
### (using generate.YuleWalkerCoefficientBlockmatrices)
#coeff_monthly <- CoeffYWeq(data=prec_mes,p=1,tolerance=0.001,sample="monthly",origin=origin)
#
#generation_monthly <- generate(coeff_monthly,year_min=year_min,year_max=year_max,
#					  names=names(prec_mes),precipitation.indicator=TRUE)
#
#prec_gen <- generatePrecipitationAmount(x=generation_monthly,origin=origin,par=fit_monthly)
#
### Estimate coefficients for Precipitation Occurence Modeling  (using generate.CCGammaObject)
#CCGamma_monthly <- CCGamma(data=prec_mes,lag=0,tolerance=0.001,only.matrix=FALSE,
#					sample="monthly",origin=origin)
#
#generation_monthly_2 <- generate(CCGamma_monthly,year_min=year_min,year_max=year_max,
#						names=names(prec_mes),precipitation.indicator=TRUE)
#
#prec_gen_2 <- generatePrecipitationAmount(x=generation_monthly_2,origin=origin,par=fit_monthly)
#
### Check Q-Q plots between observations and generations
#idst <- names(prec_mes)[2]
#month <- 6 ## June
#momth <- c(12,1,2) # Winter
#
#prec_mes <- adddate(prec_mes,origin=origin)
#prec_gen <- adddate(prec_gen,origin=origin)
#prec_gen_2 <- adddate(prec_gen_2,origin=origin)
#
#
#qqplot(prec_mes[prec_mes$month %in% month,idst],prec_gen[prec_gen$month %in% month,idst])
#abline(0,1)
#qqplot(prec_mes[prec_mes$month %in% month,idst],prec_gen_2[prec_gen_2$month %in% month,idst])
#abline(0,1)
#
### Not Run in the examples, uncomment to run the following line
### CCGamma_monthly_gen <- CCGamma(data=prec_gen,lag=0,tolerance=0.001,
###                                only.matrix=FALSE,sample="monthly",origin=origin)
### CCGamma_monthly_gen_2 <- CCGamma(data=prec_gen_2,lag=0,tolerance=0.001,
###                                only.matrix=FALSE,sample="monthly",origin=origin)
#
#

ecor/RMRAINGEN documentation built on May 13, 2017, 1:02 p.m.