-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
@rburghol I think we should add an argument to om_get_rundata() to pass model data directly as a data frame. This optional argument would be set to FALSE to preserve legacy code that relies on a zoo output. I find zoo frustrating to work with - since it works on matrices it is incapable of holding multiple data types. Our model data thisdate column is always NA as we are forced to convert the entire zoo to numeric by setting the mode(). fn_get_runfile() already has an outaszoo argument that we can leverage. My proposal would be as simple as:
om_get_rundata <- function(elid, runid, site='http://deq2.bse.vt.edu',
cached=FALSE, hydrowarmup=TRUE,
cleanup = FALSE,
outaszoo = FALE) {
# replace this with a single function that grabs
# a hydro model for summarization and slims it down
dat <- fn_get_runfile(elid, runid, 37, site, cached = FALSE, cleanup = cleanup, outaszoo = outaszoo )
syear = as.integer(min(dat$year))
...
#Get the window of interest from the timeseries
if(outaszoo){
dat <- stats::window(dat, start = sdate, end = edate)
#Change mode of zoo to numeric e.g. Convert all fields to numeric
mode(dat) <- 'numeric'
}else{
dat <- dat[dat$timestamp >= sdate & dat$timestamp <= edate,]
}
}If you agree, I'll make these changes next week. It shouldn't impact any existing code as we'll just be adding a new final argument.
Metadata
Metadata
Assignees
Labels
No labels