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

event_cluster_timing_summary_by_period doesn't work now that we_hydro_stats has $obs #114

Open
towlere opened this issue Jun 24, 2020 · 0 comments

Comments

@towlere
Copy link

towlere commented Jun 24, 2020

Now that we_hydro_stats creates an object with the obs information (streamflow, volume, max, etc), it messes up the event_cluster_timing_summary_by_period function, but there's an easy fix. It seems like if we just add these lines after, to separate the obs from the model object out, it is ok:
we_stats_obs = we_stats$obs # This is now all the obs info
we_stats$obs = NULL # this removes the obs info, so we_stats works with everything coming later.

This is the line in event_cluster_timing_summary_by_period that is complaining, with the traceback:

for(mm in names(we_stats)) {
        names(we_stats[[mm]]$xwt$event_timing)
        plot_data[[mm]] =
            plyr::ldply(we_stats[[mm]]$xwt$event_timing[c("cluster_mean", "cluster_max")])
        plot_data[[mm]]$version = mm
    }
Error in `$<-.data.frame`(`*tmp*`, "version", value = "obs"): replacement has 1 row, data has 0
Traceback:

1. `$<-`(`*tmp*`, "version", value = "obs")
2. `$<-.data.frame`(`*tmp*`, "version", value = "obs")
3. stop(sprintf(ngettext(N, "replacement has %d row, data has %d", 
 .     "replacement has %d rows, data has %d"), N, nrows), domain = NA)
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

1 participant