News:

If you want to report a bug 🐞 please contact dpost@mvc.on.ca

Main Menu

Create an Agent that Converts 24h Cumulative precip to mm/hr

Started by cmcguire, October 13, 2016, 11:08:19 AM

Previous topic - Next topic

cmcguire

OPG precipitation gauges cumulate precipitation for 24hr increments and then reset.  We need a time series that stores the data in mm/hr.  We tried using the Copy Time Series agent with the Decumulation transformation but this would create incorrect values at the reset.  Has anyone set up an agent to convert 24hr cumulative date to mm/hr?

cmcguire

Noah from Kisters recommended using this KiScript but I can't get it to work with the KiScript agent.  Does anyone know how to set this up? @cvance

function calculate() : Boolean
  src.sync(greaterequal)
Float preval = 0.0
  src.skip(-1)
    preval = src.value
  src.skip(1)
  if src.value < preval then
    result.value = src.value
  elseif src.value > preval then
    result.value = src.value - preval
  elseif src.value = preval then
    result.value = 0.0
  endif
  if src.isMissing() then
    result.setMissing()
    return
  endif
  result.status = src.status
  result.interpolation = src.interpolation
  calculate = true
  isappend = true
endfunc

cmcguire

Noah sent us a revised code that is up and running as a KiScript agent under "24 hr Precipitation Decumulation".  @mjones

DMcNiece

I'm actually starting to roll out Precipitation Intensity as a parameter.  I think it will be useful in distinguishing the shorter but more intense rain events we are seeing with climate change.  Before seeing this post, I worked with Noah at Kisters Support to come up with this simple transformation to change the unit of measure from Precip in (mm) to (mm/hr).  I'm also totaling the precip per hour off the 02.Edited time series.  This should work regardless if the rain gauge is tipping bucket giving 15 min totals or the more accurate accumulators.

I'm developing a web page for our flood duty officers that is responsive (viewable on a cell phone browser) and gets the latest values via Kiwis calls...

http://waterdata.quinteconservation.ca/KiWIS/qc_flood.html

What do you think?
David M