Last active
July 25, 2025 07:56
-
-
Save cavedave/a11fa410a471b4fb50b656e76e3edbe0 to your computer and use it in GitHub Desktop.
staircase.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) find every record‐breaking year ≥ 1980 | |
post80 = ts.where(ts.index >= 1980) | |
current_max = -np.inf | |
record_years = [] | |
record_values = [] | |
for yr, val in post80.items(): | |
if np.isnan(val): | |
continue | |
if val >= current_max: | |
current_max = val | |
record_years.append(yr) | |
record_values.append(val) | |
# 2) build ALL steps | |
all_steps = [(s, e, y) for s, e, y in zip(record_years, record_years[1:], record_values)] | |
# 3) filter to only multi‑year “flat” periods (>=3 yr) | |
steps = [(s, e, y) for (s, e, y) in all_steps if (e - s) >= 3] | |
# 4) pre‑compute limits & frame list | |
xmin, xmax = ts.index.min(), ts.index.max() | |
ymin, ymax = ts.min() - 0.1, ts.max() + 0.1 | |
frame_files = [] |
Author
cavedave
commented
Jul 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment