Commit 14e34e19 authored by Laura Mack's avatar Laura Mack
Browse files

release Rcpp (1.0.2 -> 1.0.5), pbapply (1.4-2 -> 1.4-3), therefore changed align statement

parent cc51570f
# This file contains the functions: # This file contains the functions:
# -IDF.agg for the preparing the data # -IDF.agg for preparing the data
# -IDF.plot for plotting of IDF curves at a chosen station # -IDF.plot for plotting of IDF curves at a chosen station
#### IDF.agg #### #### IDF.agg ####
#' Aggregation and annual maxima for choosen durations #' Aggregation and annual maxima for chosen durations
#' @description Aggregates several time series for chosen durations and finds annual maxima #' @description Aggregates several time series for chosen durations and finds annual maxima
#' (either for the whole year or chosen months). Returns data.frame that can be used for #' (either for the whole year or chosen months). Returns data.frame that can be used for
#' the function \code{\link{gev.d.fit}}. #' the function \code{\link{gev.d.fit}}.
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#' standard date format. #' standard date format.
#' @param ds numeric vector of aggregation durations. #' @param ds numeric vector of aggregation durations.
#' (Must be multiples of time resolution at all stations.) #' (Must be multiples of time resolution at all stations.)
#' @param na.accept numeric in [0,1] giving maximum percentage of missing values #' @param na.accept numeric in [0,1) giving maximum percentage of missing values
#' for which block max. should still be calculated #' for which block max. should still be calculated.
#' @param which.stations optional, subset of stations. Either numeric vector or character vector #' @param which.stations optional, subset of stations. Either numeric vector or character vector
#' containing names of elements in data. If not given, all elements in `data` will be used. #' containing names of elements in data. If not given, all elements in `data` will be used.
#' @param which.mon optional, subset of months of which to calculate the annual maxima from. #' @param which.mon optional, subset of months of which to calculate the annual maxima from.
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
# function 1: aggregate over single durations and find annual maxima: # function 1: aggregate over single durations and find annual maxima:
agg.ts <- function(ds){ agg.ts <- function(ds){
runsum = RcppRoll::roll_sum(data.s[,names[2]],ds/dtime,fill=NA) runsum = RcppRoll::roll_sum(data.s[,names[2]],ds/dtime,fill=NA,align='right')
#runmean <- rollapplyr(as.zoo(data.s[,names[2]]),ds/dtime,FUN=sum,fill =NA,align='right') #runmean <- rollapplyr(as.zoo(data.s[,names[2]]),ds/dtime,FUN=sum,fill =NA,align='right')
runsum <- runsum/ds #intensity per hour runsum <- runsum/ds #intensity per hour
max.subset <- lapply(1:length(which.mon),function(m.i){ max.subset <- lapply(1:length(which.mon),function(m.i){
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
return(df) # maxima for single durations return(df) # maxima for single durations
} }
# call function 1 in lapply to aggregate over all durations at single station # call function 1 in lapply to aggregate over all durations at single station
data.agg <- pbapply::pblapply(ds,agg.ts,cl=cl) # data.agg <- pbapply::pblapply(ds,agg.ts,cl=cl)
df <- do.call(rbind,data.agg) df <- do.call(rbind,data.agg)
return(df) # maxima for all durations at one station return(df) # maxima for all durations at one station
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
% Please edit documentation in R/IDF.R % Please edit documentation in R/IDF.R
\name{IDF.agg} \name{IDF.agg}
\alias{IDF.agg} \alias{IDF.agg}
\title{Aggregation and annual maxima for choosen durations} \title{Aggregation and annual maxima for chosen durations}
\usage{ \usage{
IDF.agg( IDF.agg(
data, data,
...@@ -23,8 +23,8 @@ standard date format.} ...@@ -23,8 +23,8 @@ standard date format.}
\item{ds}{numeric vector of aggregation durations. \item{ds}{numeric vector of aggregation durations.
(Must be multiples of time resolution at all stations.)} (Must be multiples of time resolution at all stations.)}
\item{na.accept}{numeric in [0,1] giving maximum percentage of missing values \item{na.accept}{numeric in [0,1) giving maximum percentage of missing values
for which block max. should still be calculated} for which block max. should still be calculated.}
\item{which.stations}{optional, subset of stations. Either numeric vector or character vector \item{which.stations}{optional, subset of stations. Either numeric vector or character vector
containing names of elements in data. If not given, all elements in `data` will be used.} containing names of elements in data. If not given, all elements in `data` will be used.}
......
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