BoulderCodeHub / RWDataPlyr

R package to read and manipulate data from RiverWareTM
3 stars 5 forks source link

Should rwd_agg() return error if trying to sum certain periods? #101

Closed rabutler-usbr closed 4 years ago

rabutler-usbr commented 5 years ago

If the period is eocy or Jan, should there be an error if the summary is set to sum or anything else really?

Ex:

zz <- data.frame(
  file = "KeySlots.rdf",
  slot = "x.y",
  period = "asis",
  summary = "sum",
  eval = NA,
  t_s = NA,
  variable = "this",
  stringsAsFactors = FALSE
)

rwd_agg(zz)

returns the following error:

Error: If the period is specified as 'asis', then the summary must be NA.

But


zz <- data.frame(
  file = "KeySlots.rdf",
  slot = "x.y",
  period = "eocy",
  summary = "sum",
  eval = NA,
  t_s = NA,
  variable = "this",
  stringsAsFactors = FALSE
)

rwd_agg(zz)

does not return an error.

Maybe it should return an error for eocy because that would go all the way to a single timestep regardless of timestep of the model, while Jan would select 31 days in a daily model that could then be summarized with sum, etc.

rabutler-usbr commented 4 years ago

Man page says that it should error for eocy. Will fix this.