COMPASS-DOE / TEMPEST

Terrestrial Ecosystem Manipulation to Probe Effects of Storm Treatments
MIT License
7 stars 2 forks source link

Time handling and assumptions #82

Open bpbond opened 2 years ago

bpbond commented 2 years ago

Currently before process_teros() returns data, it filters to the last five days:

teros_primitive %>%
        mutate(diff = difftime(Sys.time(), TIMESTAMP, units = "days")) %>%
        filter(diff < 5)

Conversely, process_sapflow() doesn't do any filtering at all.

The dashboard graphs display the last X hours of data in the dataset, not (contrary to what the comment below says) from the current system time:

# TODO: back from present? Or back from latest timestamp in data?
GRAPH_TIME_WINDOW <- 3 * 24   # hours back from present
FLAG_TIME_WINDOW <- 1         # hours back from present

               + coord_cartesian(xlim = c(latest_ts - GRAPH_TIME_WINDOW * 60 * 60, latest_ts)) ->

The out-of-limits computation for the sapflow badge also uses last X hours from last timestamp, not present:

        sapflow %>%
            filter(Timestamp > (max(Timestamp) - FLAG_TIME_WINDOW * 60 * 60)) %>%
            summarise(flag_sensors(Value, limits = SAPFLOW_RANGE)) ->
            sapflow_bdg

So we have a fair amount of inconsistency. Flagging this for discussion.