From 48f80295f1a9c3b2a7172f845ed3e2fb656fe4f4 Mon Sep 17 00:00:00 2001 From: AdamTheisen Date: Tue, 29 Oct 2024 15:34:20 -0500 Subject: [PATCH] ENH: Adding example --- examples/plotting/plot_stripes.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 examples/plotting/plot_stripes.py diff --git a/examples/plotting/plot_stripes.py b/examples/plotting/plot_stripes.py new file mode 100644 index 0000000000..c6def32e80 --- /dev/null +++ b/examples/plotting/plot_stripes.py @@ -0,0 +1,28 @@ +""" +Example plot using stripes +-------------------------- + +Plot up climate stripes plots from already +existing climatologies from ARM data. +Author: Adam Theisen + +""" + +import act +import matplotlib.pyplot as plt + +# SGP E13 MET data has already been processed to yearly averages, +# removing data flagged by embedded qc and DQRs +url = 'https://raw.githubusercontent.com/AdamTheisen/ARM-Climatologies/refs/heads/main/results/sgpmetE13.b1_temp_mean_Y.csv' +col_names = ['time', 'temperature', 'count'] +ds = act.io.read_csv(url, column_names=col_names, index_col=0, parse_dates=True) + +# Drop years with less than 500000 samples +ds = ds.where(ds['count'] > 500000) + +# Create plot display +display = act.plotting.TimeSeriesDisplay(ds, figsize=(10, 2)) +reference = ['2003-01-01', '2013-01-01'] +display.plot_stripes('temperature', reference_period=reference) + +plt.show()