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)
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: