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

Calculations fail on years with no flow #2

Open
wknoben opened this issue May 2, 2024 · 2 comments
Open

Calculations fail on years with no flow #2

wknoben opened this issue May 2, 2024 · 2 comments

Comments

@wknoben
Copy link

wknoben commented May 2, 2024

Description
This is an arid basin with long periods of no flow. In such cases the standard deviation of certain years is 0 and the correlation for such years is undefined. As a result, all metrics are calculated (partly) on NaN values and return NA.

I don't know if any clear solutions exist to make the computations succeed in these cases (maybe just hard-code solutions for the specific cases where obs and/or sim are all zero, or try to detect these and exit with a specific message?), but it seemed good to document this behaviour at least.

image

Sample data: gumboot_issue.csv

Sample code

df <- read.csv("gumboot_issue.csv")
bootjack(df)

Output

  GOF_stat seJack seBoot p05 p50 p95 score biasJack biasBoot seJab
1              NA     NA  NA  NA  NA    NA       NA       NA    NA
Warning messages:
1: In bootjack(df) : NAs introduced by coercion
2: In bootjack(df) : NAs introduced by coercion
3: In bootjack(df) : NAs introduced by coercion
@KevinShook
Copy link
Collaborator

Thanks for finding this. I'll get to it when I can, but won't be able to do anything until June.
It might be possible to use na.rm = TRUE for some functions, but it might not work for everything.

@wknoben
Copy link
Author

wknoben commented May 2, 2024

Cool :) It only happens in 4 cases for what I'm currently doing but it seemed good to document this in case anyone else comes looking.

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

No branches or pull requests

2 participants