From f6bc71a2c2ff304c061172425a119ca47d6c4718 Mon Sep 17 00:00:00 2001 From: brasmus Date: Mon, 6 Nov 2023 16:21:27 +0100 Subject: [PATCH] minor fixes to annual and wetmean function to cope with no rainy days --- DESCRIPTION | 4 ++-- R/as.annual.R | 24 ++++++++++++++---------- R/write2ncdf.R | 5 +++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4e074549..5b832d69 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: esd -Version: 1.10.56 -Date: 2023-10-06 +Version: 1.10.57 +Date: 2023-11-05 Title: Climate analysis and empirical-statistical downscaling (ESD) package for monthly and daily data Author: Rasmus E. Benestad, Abdelkader Mezghani, Kajsa M. Parding, Helene B. Erlandsen, Ketil Tunheim, and Cristian Lussana Maintainer: Rasmus E. Benestad diff --git a/R/as.annual.R b/R/as.annual.R index 46751b00..e0ae0445 100644 --- a/R/as.annual.R +++ b/R/as.annual.R @@ -194,7 +194,7 @@ annual.default <- function(x,FUN='mean',na.rm=TRUE, nmin=NULL,start=NULL,..., } else { z <- zoo(matrix(rep(NA,ncol(y)*length(it)), ncol=ncol(y), nrow=length(it)), - order.by=it) + order.by=it) z[is.element(it,index(y)),] <- y } y <- z; rm('z') @@ -233,11 +233,13 @@ annual.default <- function(x,FUN='mean',na.rm=TRUE, nmin=NULL,start=NULL,..., bad <- n