Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic monitoring #25

Open
mankoff opened this issue Apr 28, 2021 · 1 comment
Open

Automatic monitoring #25

mankoff opened this issue Apr 28, 2021 · 1 comment

Comments

@mankoff
Copy link
Member

mankoff commented Apr 28, 2021

To support auto-updating with minimal human interaction, we should implement some level of automatic monitoring.

  • Implement some algorithm that looks at the last timestamp relative to previous ones, and flags out of limit values
    • e.g. if latest discharge is > 2 sigma from historical, flag it
  • Mail graphic and/or tabular summaries to key personnel
  • Delay pushing (or publishing?) the update to the Dataverse by ~24 hours, giving key personnel an opportunity to stop the update if necessary.
@mankoff
Copy link
Member Author

mankoff commented Apr 28, 2021

Example algorithm: If the changes in the most recent update are more than 20 % over the max historical (last 3 year) change, flag it.

import xarray as xr
import numpy as np

ds = xr.open_dataset('./out/gate.nc')
df = ds['discharge'].T.to_dataframe().unstack()

past = df[df.index > df.index[-1] - pd.DateOffset(years=3)]

flag = np.abs(past.diff().iloc[-1]) > np.abs(past.diff().iloc[:-1].max()*1.20)
flag = flag[flag == True]

if flag.size == 0:
    print("No flags")
else:
    df[flag.index].loc['2016':].plot(drawstyle='steps-post')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant