Skip to content
Snippets Groups Projects
Commit d25017b3 authored by Oriol Tintó's avatar Oriol Tintó
Browse files

Minor update in streamlit example.

parent ffdd0c84
No related branches found
No related tags found
1 merge request!18Several changes including chunking and expansion of examples.
Pipeline #19107 passed
import streamlit as st import streamlit as st
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
def plot_comparison(data, slice_selection): def plot_comparison(data, slice_selection):
col1, col2, col3, *others = st.columns(3) col1, col2, col3, *others = st.columns(3)
...@@ -19,7 +20,6 @@ def plot_comparison(data, slice_selection): ...@@ -19,7 +20,6 @@ def plot_comparison(data, slice_selection):
slice_selection = new_slice slice_selection = new_slice
if data.reference_da is not None: if data.reference_da is not None:
print(f"{slice_selection=}")
slice_selection = {key: (value if key != "lat" else slice(value.stop, value.start)) for key, value in slice_selection = {key: (value if key != "lat" else slice(value.stop, value.start)) for key, value in
slice_selection.items()} slice_selection.items()}
...@@ -33,8 +33,8 @@ def plot_comparison(data, slice_selection): ...@@ -33,8 +33,8 @@ def plot_comparison(data, slice_selection):
if non_slices: if non_slices:
reference_slice = reference_slice.sel(**non_slices, method="nearest") reference_slice = reference_slice.sel(**non_slices, method="nearest")
print(reference_slice)
try: try:
plt.figure()
reference_slice.plot() reference_slice.plot()
fig1 = plt.gcf() fig1 = plt.gcf()
with col1: with col1:
...@@ -76,8 +76,5 @@ def plot_comparison(data, slice_selection): ...@@ -76,8 +76,5 @@ def plot_comparison(data, slice_selection):
except TypeError: except TypeError:
pass pass
else: else:
st.text("Compress the data to show the plot!") st.text("Compress the data to show the plot!")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment