meas_daily_roc Rain during the last 24 hours, Rate of change measurements

meas_daily_roc.py

meas_daily_roc.differential_reading(meas_label, period_sec, allow_negative)

Computes the difference between the most recent reading of the specified measurement, and an older reading of the same measurement. Routine reads the log looking for the older reading.

This is a generic version of the precip_last_24_hours routine.

Parameters:
  • meas_label (str) – the label of the measurement in question
  • period_sec (int) – how long ago the old reading was made in seconds
  • allow_negative (bool) – should a negative difference be allowed? set to False for rain accumulation
Returns:

the difference between the two readings

Return type:

float

meas_daily_roc.measurement_previous()

Gets the previous measurement from the log using the measurement schedule Must be called by an @MEASUREMENT function

Make sure to check the quality of the returned reading!

Returns:previously logged measurement
Return type:Reading
meas_daily_roc.precip_last_24_hours(inval)
Computes rainfall during the last 24 hours.
If called at 5PM today, it tells you how much rain fell since 5PM yesterday. If called at 8:15AM today, gives rain since 8:15AM yesterday.
  • Reads the current precip accumulation.
  • Reads the precip accumulation from 24 hours ago.
  • Computes result based on difference.

Must have a measurement setup to log precip accumulation on same schedule as this measurement. It must have a specific label (see below). Here is the required setup (interval may be adjusted):

!M2 Active=On
!M2 Label=RAIN ACCU
!M2 Meas Type=Precip Accumulation
!M2 Accumulation Reset=Off
!M2 Meas Interval=00:15:00
!M3 Active=On
!M3 Label=RAIN 24h
!M3 Meas Type=Manual Entry
!M3 Meas Interval=00:15:00
!M3 Use Script=On
!M3 Script Function=precip_last_24_hours
Parameters:inval – this value is ignored
Returns:precip during last 24 hours
Return type:float
meas_daily_roc.precip_last_hour(inval)
Computes the precipitation during the last hour.
Please see precip_last_24_hours. This example uses differential_reading. Another measurement labeled RAIN ACCU must be recording precip accumulation.
meas_daily_roc.rate_of_change_1meas_setup(inval)

Computes rate of change for the measurement setup with this script. This never logs the value of the sensor. Instead, it remembers the sensor reading and uses it the next time it computes the rate of change.

meas_daily_roc.rate_of_change_2meas_setup(meas_index_or_label)
Computes the change between the current and the previous readings.
This script needs to reference another measurement which logs sensor readings.
Please note that it takes two measurements to compute rate of change.
The first measurement needs to log the sensor values. The second measurement will compute the difference of two sensor values.
meas_daily_roc.roc_m1(inval)

Computes rate of change for measurement M1. This script must be associated with a measurement other than M1.