Skip to content

Commit

Permalink
small fix in anomaly.dat
Browse files Browse the repository at this point in the history
  • Loading branch information
kajsamp committed Dec 20, 2023
1 parent 131c583 commit 85e49f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: esd
Version: 1.10.61
Date: 2023-12-17
Version: 1.10.62
Date: 2023-12-20
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 <rasmus.benestad@met.no>
Expand Down
1 change: 0 additions & 1 deletion R/WG.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ WG.FT.day.t2m <- function(x=NULL,...,amean=NULL,asd=NULL,t=NULL,ip=1:4,
## Or use prescribed projections
amean <- rowMeans(amean,na.rm=TRUE) - mean(amean,na.rm=TRUE)
if(verbose) print(paste('mean(amean)=',mean(amean)))

## Also select annual standard deviations estimated from daly anomalies -
## repeat the same procedure as for the mean.
if (is.null(asd)) asd <- annual(anomaly(x),FUN='sd') else
Expand Down
9 changes: 6 additions & 3 deletions R/anomaly.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ anomaly.default <- function(x,...) {
ref <- arguments$ref
it <- is.element(year(x),ref)
} else {
ref <- range(year(x))
ref <- unique(year(x))
it <- rep(TRUE,length(index(x)))
}
if (verbose) print(paste('ref=',year(x)[it][1],'-',year(x)[it][sum(it)],
Expand Down Expand Up @@ -345,9 +345,12 @@ anomaly.day <- function(x,...) {
t0 <- julian(index(x)[is.element(yr,ref)]) -
julian(as.Date(paste(yr[is.element(yr,ref)],"-01-01",sep="")))
t <- julian(index(x)) - julian(as.Date(paste(yr,"-01-01",sep="")))
x0 <- subset(x, it=ref)
if (is.null(dim(x)))
y <- anomaly.day.1(x=coredata(x),t0=t0,t=t,ref=ref) else
y <- apply(coredata(x),2,FUN='anomaly.day.1',t0=t0,t=t,ref=ref)
y <- anomaly.day.1(x=coredata(x0),t0=t0,t=t,ref=ref) else
y <- apply(coredata(x0),2,FUN='anomaly.day.1',t0=t0,t=t,ref=ref)
#y <- anomaly.day.1(x=coredata(x),t0=t0,t=t,ref=ref) else
#y <- apply(coredata(x),2,FUN='anomaly.day.1',t0=t0,t=t,ref=ref)
y <- zoo(y,order.by=index(x))
y <- attrcp(x,y)
class(y) <- class(x)
Expand Down

0 comments on commit 85e49f5

Please sign in to comment.