Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makeAnnualStat array code doesn't handle custom FUN #123

Closed
bpbond opened this issue May 19, 2015 · 4 comments
Closed

makeAnnualStat array code doesn't handle custom FUN #123

bpbond opened this issue May 19, 2015 · 4 comments
Assignees
Labels

Comments

@bpbond
Copy link
Member

bpbond commented May 19, 2015

...as far as I can see. The test code passes weighted.mean into makeAnnualStat and is getting back the unweighted mean.

@ktoddbrown
Copy link
Contributor

Is it resolved now?

@bpbond
Copy link
Member Author

bpbond commented May 20, 2015

Hmm, no:

1. Failure(@test_makeAnnualStat.R#151): makeAnnualStat handles custom function and dots -------
RCMIP5:::vals(res1) not equal to ans$value
Mean relative difference: 0.2777778
array

The test code that gets executed:

years <- 1850:1851
llsize <- 2
d <- cmip5data(years, lonsize=llsize, latsize=llsize, loadAs="array")
        # All data 1, except December, which is 2
d$val <- array(1, dim=dim(d$val))
d$val[,,,round(d$time %% 1, 3)==.958] <- 2                
        # Weights are all 1 except December, which is 11
w <- c(rep(1, 11), 11)
res1 <- makeAnnualStat(d, verbose=F, sortData=F, filterNum=T, FUN=weighted.mean, w)

...which (wrongly) returns 1.083, the unweighted mean.

@ktoddbrown
Copy link
Contributor

On it.

@ktoddbrown
Copy link
Contributor

Done, see d1202b1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants