Spaces:
Sleeping
Sleeping
Pavan Kumar Jonnakuti commited on
Commit Β·
4c5b11a
1
Parent(s): fa4dd61
Replace width='stretch' with use_container_width=True for backward compatibility
Browse files- Code/argo_dashboard.py +4 -4
- streamlit/dashboard.py +18 -18
- streamlit/dashboard_example.py +4 -4
- streamlit/hello.py +2 -2
Code/argo_dashboard.py
CHANGED
|
@@ -239,7 +239,7 @@ with col1:
|
|
| 239 |
for _, r in totals.iterrows():
|
| 240 |
fig_bar.add_annotation(x=r['Year'], y=r['Total_Floats'], text=str(int(r['Total_Floats'])), showarrow=False, yshift=10)
|
| 241 |
fig_bar.update_layout(barmode='stack', xaxis=dict(dtick=1), height=520)
|
| 242 |
-
st.plotly_chart(fig_bar,
|
| 243 |
|
| 244 |
# Donut chart: age distribution of alive floats (bio dataset)
|
| 245 |
with col2:
|
|
@@ -255,7 +255,7 @@ with col2:
|
|
| 255 |
if not age_counts.empty:
|
| 256 |
fig_donut = px.pie(age_counts, names='Age_Years', values='Count', hole=0.55, title='Age (years) distribution of alive floats')
|
| 257 |
fig_donut.update_traces(textinfo='percent+label')
|
| 258 |
-
st.plotly_chart(fig_donut,
|
| 259 |
else:
|
| 260 |
st.write("No alive float age groups available for selected filters.")
|
| 261 |
else:
|
|
@@ -331,7 +331,7 @@ else:
|
|
| 331 |
)
|
| 332 |
|
| 333 |
fig_map.update_layout(height=650)
|
| 334 |
-
st.plotly_chart(fig_map,
|
| 335 |
# ------------------------------
|
| 336 |
# DAC summary table (bio dataset) - bottom
|
| 337 |
# Live = age_days >= 90, Dead = age_days < 90, Total = unique floats
|
|
@@ -352,7 +352,7 @@ summary_table = g.groupby('DAC').agg(
|
|
| 352 |
|
| 353 |
# present in requested order: DAC | Live | Dead | Total
|
| 354 |
summary_table = summary_table[['DAC','Live','Dead','Total']]
|
| 355 |
-
st.dataframe(summary_table,
|
| 356 |
|
| 357 |
# Compact text lines
|
| 358 |
st.markdown("**Compact summary (DAC β Live / Dead / Total)**")
|
|
|
|
| 239 |
for _, r in totals.iterrows():
|
| 240 |
fig_bar.add_annotation(x=r['Year'], y=r['Total_Floats'], text=str(int(r['Total_Floats'])), showarrow=False, yshift=10)
|
| 241 |
fig_bar.update_layout(barmode='stack', xaxis=dict(dtick=1), height=520)
|
| 242 |
+
st.plotly_chart(fig_bar, use_container_width=True)
|
| 243 |
|
| 244 |
# Donut chart: age distribution of alive floats (bio dataset)
|
| 245 |
with col2:
|
|
|
|
| 255 |
if not age_counts.empty:
|
| 256 |
fig_donut = px.pie(age_counts, names='Age_Years', values='Count', hole=0.55, title='Age (years) distribution of alive floats')
|
| 257 |
fig_donut.update_traces(textinfo='percent+label')
|
| 258 |
+
st.plotly_chart(fig_donut, use_container_width=True)
|
| 259 |
else:
|
| 260 |
st.write("No alive float age groups available for selected filters.")
|
| 261 |
else:
|
|
|
|
| 331 |
)
|
| 332 |
|
| 333 |
fig_map.update_layout(height=650)
|
| 334 |
+
st.plotly_chart(fig_map, use_container_width=True)
|
| 335 |
# ------------------------------
|
| 336 |
# DAC summary table (bio dataset) - bottom
|
| 337 |
# Live = age_days >= 90, Dead = age_days < 90, Total = unique floats
|
|
|
|
| 352 |
|
| 353 |
# present in requested order: DAC | Live | Dead | Total
|
| 354 |
summary_table = summary_table[['DAC','Live','Dead','Total']]
|
| 355 |
+
st.dataframe(summary_table, use_container_width=True)
|
| 356 |
|
| 357 |
# Compact text lines
|
| 358 |
st.markdown("**Compact summary (DAC β Live / Dead / Total)**")
|
streamlit/dashboard.py
CHANGED
|
@@ -793,29 +793,29 @@ def show_float_details(wmo):
|
|
| 793 |
c1, c2, c3 = st.columns(3)
|
| 794 |
with c1:
|
| 795 |
fig = plot_utils.create_ts_diagram(cycles, temp, psal, wmo, title=f"T/S Diagram<br><sup>{date_suffix}</sup>")
|
| 796 |
-
st.plotly_chart(fig,
|
| 797 |
with c2:
|
| 798 |
fig = plot_utils.create_section_chart(dates, pres, temp, "Temperature (Β°C)", f"Section chart TEMP<br><sup>{date_suffix}</sup>", wmo)
|
| 799 |
-
st.plotly_chart(fig,
|
| 800 |
with c3:
|
| 801 |
fig = plot_utils.create_section_chart(dates, pres, psal, "Salinity (PSU)", f"Section chart PSAL<br><sup>{date_suffix}</sup>", wmo)
|
| 802 |
-
st.plotly_chart(fig,
|
| 803 |
|
| 804 |
c4, c5, c6 = st.columns(3)
|
| 805 |
with c4:
|
| 806 |
fig = plot_utils.create_section_chart(dates, pres, rho, "Potential Density (kg/mΒ³)", f"Section chart RHO<br><sup>{date_suffix}</sup>", wmo)
|
| 807 |
-
st.plotly_chart(fig,
|
| 808 |
with c5:
|
| 809 |
fig = plot_utils.create_overlaid_profiles(temp, pres, cycles, "Temperature (Β°C)", f"Overlaid profiles TEMP<br><sup>{date_suffix}</sup>", wmo)
|
| 810 |
-
st.plotly_chart(fig,
|
| 811 |
with c6:
|
| 812 |
fig = plot_utils.create_overlaid_profiles(psal, pres, cycles, "Salinity (PSU)", f"Overlaid profiles PSAL<br><sup>{date_suffix}</sup>", wmo)
|
| 813 |
-
st.plotly_chart(fig,
|
| 814 |
|
| 815 |
c7, c8, c9 = st.columns(3)
|
| 816 |
with c7:
|
| 817 |
fig = plot_utils.create_overlaid_profiles(rho, pres, cycles, "Potential Density (kg/mΒ³)", f"Overlaid profiles RHO<br><sup>{date_suffix}</sup>", wmo)
|
| 818 |
-
st.plotly_chart(fig,
|
| 819 |
else:
|
| 820 |
st.info("No valid profile data available for technical plots.")
|
| 821 |
except Exception as e:
|
|
@@ -941,7 +941,7 @@ with st.sidebar:
|
|
| 941 |
st.markdown("## π Filters")
|
| 942 |
|
| 943 |
# ββ Refresh ββ
|
| 944 |
-
if st.button("π Refresh Data",
|
| 945 |
for f in CACHE_DIR.glob("*.parquet"):
|
| 946 |
f.unlink()
|
| 947 |
st.cache_data.clear()
|
|
@@ -1384,7 +1384,7 @@ with col_left:
|
|
| 1384 |
)
|
| 1385 |
|
| 1386 |
fig_map.update_layout(height=620)
|
| 1387 |
-
st.plotly_chart(fig_map,
|
| 1388 |
|
| 1389 |
if selected_wmo_from_map:
|
| 1390 |
if st.button(f"π View Info for Float {selected_wmo_from_map}"):
|
|
@@ -1476,7 +1476,7 @@ with col_right:
|
|
| 1476 |
margin=dict(l=50, r=20, t=80, b=40),
|
| 1477 |
)
|
| 1478 |
)
|
| 1479 |
-
st.plotly_chart(fig_bar,
|
| 1480 |
else:
|
| 1481 |
st.info("No active float data for bar chart.")
|
| 1482 |
else:
|
|
@@ -1579,7 +1579,7 @@ with col_tree:
|
|
| 1579 |
**_dark_layout(margin=dict(l=0, r=0, t=10, b=0)),
|
| 1580 |
coloraxis_showscale=False,
|
| 1581 |
)
|
| 1582 |
-
st.plotly_chart(fig_tree,
|
| 1583 |
else:
|
| 1584 |
st.info("No active floats in the last 1 day for current filters.")
|
| 1585 |
else:
|
|
@@ -1661,7 +1661,7 @@ with col_donut:
|
|
| 1661 |
bgcolor="rgba(0,0,0,0)",
|
| 1662 |
),
|
| 1663 |
)
|
| 1664 |
-
st.plotly_chart(fig_donut,
|
| 1665 |
else:
|
| 1666 |
st.info("No age data available.")
|
| 1667 |
else:
|
|
@@ -1726,7 +1726,7 @@ with col_profiler:
|
|
| 1726 |
bgcolor="rgba(0,0,0,0)",
|
| 1727 |
),
|
| 1728 |
)
|
| 1729 |
-
st.plotly_chart(fig_ptype,
|
| 1730 |
st.caption(f"π {len(df_meta):,} floats across {df_meta['profiler_name'].nunique()} instrument models (source: ar_index_global_meta.txt)")
|
| 1731 |
else:
|
| 1732 |
st.info("No metadata available.")
|
|
@@ -1776,7 +1776,7 @@ with col_fleet:
|
|
| 1776 |
margin=dict(l=50, r=20, t=60, b=40),
|
| 1777 |
),
|
| 1778 |
)
|
| 1779 |
-
st.plotly_chart(fig_fleet,
|
| 1780 |
st.caption("Shows how the fleet instrument mix has evolved per deployment year")
|
| 1781 |
else:
|
| 1782 |
st.info("No deployment data available.")
|
|
@@ -1876,7 +1876,7 @@ if len(df_prof) > 0:
|
|
| 1876 |
height=160,
|
| 1877 |
)
|
| 1878 |
)
|
| 1879 |
-
st.plotly_chart(fig_global,
|
| 1880 |
|
| 1881 |
with col_dac2:
|
| 1882 |
st.markdown("### π‘ Float Status Summary")
|
|
@@ -2176,7 +2176,7 @@ with st.expander("π View Raw Data", expanded=False):
|
|
| 2176 |
tab1, tab2, tab3 = st.tabs(["Core Profiles", "BGC Profiles", "Float Metadata"])
|
| 2177 |
with tab1:
|
| 2178 |
st.dataframe(
|
| 2179 |
-
filt_prof.head(200),
|
| 2180 |
)
|
| 2181 |
st.caption(
|
| 2182 |
f"Showing {min(200, len(filt_prof)):,} of {len(filt_prof):,} records"
|
|
@@ -2190,7 +2190,7 @@ with st.expander("π View Raw Data", expanded=False):
|
|
| 2190 |
)
|
| 2191 |
with tab2:
|
| 2192 |
st.dataframe(
|
| 2193 |
-
filt_bio.head(200),
|
| 2194 |
)
|
| 2195 |
st.caption(
|
| 2196 |
f"Showing {min(200, len(filt_bio)):,} of {len(filt_bio):,} records"
|
|
@@ -2204,7 +2204,7 @@ with st.expander("π View Raw Data", expanded=False):
|
|
| 2204 |
)
|
| 2205 |
with tab3:
|
| 2206 |
st.dataframe(
|
| 2207 |
-
df_meta.head(500),
|
| 2208 |
)
|
| 2209 |
st.caption(
|
| 2210 |
f"Showing {min(500, len(df_meta)):,} of {len(df_meta):,} float metadata records (source: ar_index_global_meta.txt)"
|
|
|
|
| 793 |
c1, c2, c3 = st.columns(3)
|
| 794 |
with c1:
|
| 795 |
fig = plot_utils.create_ts_diagram(cycles, temp, psal, wmo, title=f"T/S Diagram<br><sup>{date_suffix}</sup>")
|
| 796 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 797 |
with c2:
|
| 798 |
fig = plot_utils.create_section_chart(dates, pres, temp, "Temperature (Β°C)", f"Section chart TEMP<br><sup>{date_suffix}</sup>", wmo)
|
| 799 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 800 |
with c3:
|
| 801 |
fig = plot_utils.create_section_chart(dates, pres, psal, "Salinity (PSU)", f"Section chart PSAL<br><sup>{date_suffix}</sup>", wmo)
|
| 802 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 803 |
|
| 804 |
c4, c5, c6 = st.columns(3)
|
| 805 |
with c4:
|
| 806 |
fig = plot_utils.create_section_chart(dates, pres, rho, "Potential Density (kg/mΒ³)", f"Section chart RHO<br><sup>{date_suffix}</sup>", wmo)
|
| 807 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 808 |
with c5:
|
| 809 |
fig = plot_utils.create_overlaid_profiles(temp, pres, cycles, "Temperature (Β°C)", f"Overlaid profiles TEMP<br><sup>{date_suffix}</sup>", wmo)
|
| 810 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 811 |
with c6:
|
| 812 |
fig = plot_utils.create_overlaid_profiles(psal, pres, cycles, "Salinity (PSU)", f"Overlaid profiles PSAL<br><sup>{date_suffix}</sup>", wmo)
|
| 813 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 814 |
|
| 815 |
c7, c8, c9 = st.columns(3)
|
| 816 |
with c7:
|
| 817 |
fig = plot_utils.create_overlaid_profiles(rho, pres, cycles, "Potential Density (kg/mΒ³)", f"Overlaid profiles RHO<br><sup>{date_suffix}</sup>", wmo)
|
| 818 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 819 |
else:
|
| 820 |
st.info("No valid profile data available for technical plots.")
|
| 821 |
except Exception as e:
|
|
|
|
| 941 |
st.markdown("## π Filters")
|
| 942 |
|
| 943 |
# ββ Refresh ββ
|
| 944 |
+
if st.button("π Refresh Data", use_container_width=True, type="primary"):
|
| 945 |
for f in CACHE_DIR.glob("*.parquet"):
|
| 946 |
f.unlink()
|
| 947 |
st.cache_data.clear()
|
|
|
|
| 1384 |
)
|
| 1385 |
|
| 1386 |
fig_map.update_layout(height=620)
|
| 1387 |
+
st.plotly_chart(fig_map, use_container_width=True, key="main_map", on_select="rerun", config={"toImageButtonOptions": {"format": "png", "scale": 2, "filename": "argo_float_map"}})
|
| 1388 |
|
| 1389 |
if selected_wmo_from_map:
|
| 1390 |
if st.button(f"π View Info for Float {selected_wmo_from_map}"):
|
|
|
|
| 1476 |
margin=dict(l=50, r=20, t=80, b=40),
|
| 1477 |
)
|
| 1478 |
)
|
| 1479 |
+
st.plotly_chart(fig_bar, use_container_width=True, key="bar_chart", on_select="rerun", config={"toImageButtonOptions": {"format": "png", "scale": 2, "filename": "argo_annual_floats"}})
|
| 1480 |
else:
|
| 1481 |
st.info("No active float data for bar chart.")
|
| 1482 |
else:
|
|
|
|
| 1579 |
**_dark_layout(margin=dict(l=0, r=0, t=10, b=0)),
|
| 1580 |
coloraxis_showscale=False,
|
| 1581 |
)
|
| 1582 |
+
st.plotly_chart(fig_tree, use_container_width=True, key="treemap", config={"toImageButtonOptions": {"format": "png", "scale": 2, "filename": "argo_last1day_treemap"}})
|
| 1583 |
else:
|
| 1584 |
st.info("No active floats in the last 1 day for current filters.")
|
| 1585 |
else:
|
|
|
|
| 1661 |
bgcolor="rgba(0,0,0,0)",
|
| 1662 |
),
|
| 1663 |
)
|
| 1664 |
+
st.plotly_chart(fig_donut, use_container_width=True, key="donut", config={"toImageButtonOptions": {"format": "png", "scale": 2, "filename": "argo_age_distribution"}})
|
| 1665 |
else:
|
| 1666 |
st.info("No age data available.")
|
| 1667 |
else:
|
|
|
|
| 1726 |
bgcolor="rgba(0,0,0,0)",
|
| 1727 |
),
|
| 1728 |
)
|
| 1729 |
+
st.plotly_chart(fig_ptype, use_container_width=True, key="profiler_donut", config={"toImageButtonOptions": {"format": "png", "scale": 2, "filename": "argo_profiler_types"}})
|
| 1730 |
st.caption(f"π {len(df_meta):,} floats across {df_meta['profiler_name'].nunique()} instrument models (source: ar_index_global_meta.txt)")
|
| 1731 |
else:
|
| 1732 |
st.info("No metadata available.")
|
|
|
|
| 1776 |
margin=dict(l=50, r=20, t=60, b=40),
|
| 1777 |
),
|
| 1778 |
)
|
| 1779 |
+
st.plotly_chart(fig_fleet, use_container_width=True, key="fleet_composition", config={"toImageButtonOptions": {"format": "png", "scale": 2, "filename": "argo_fleet_composition"}})
|
| 1780 |
st.caption("Shows how the fleet instrument mix has evolved per deployment year")
|
| 1781 |
else:
|
| 1782 |
st.info("No deployment data available.")
|
|
|
|
| 1876 |
height=160,
|
| 1877 |
)
|
| 1878 |
)
|
| 1879 |
+
st.plotly_chart(fig_global, use_container_width=True, key="global_status_bar", config={"displayModeBar": False})
|
| 1880 |
|
| 1881 |
with col_dac2:
|
| 1882 |
st.markdown("### π‘ Float Status Summary")
|
|
|
|
| 2176 |
tab1, tab2, tab3 = st.tabs(["Core Profiles", "BGC Profiles", "Float Metadata"])
|
| 2177 |
with tab1:
|
| 2178 |
st.dataframe(
|
| 2179 |
+
filt_prof.head(200), use_container_width=True, hide_index=True
|
| 2180 |
)
|
| 2181 |
st.caption(
|
| 2182 |
f"Showing {min(200, len(filt_prof)):,} of {len(filt_prof):,} records"
|
|
|
|
| 2190 |
)
|
| 2191 |
with tab2:
|
| 2192 |
st.dataframe(
|
| 2193 |
+
filt_bio.head(200), use_container_width=True, hide_index=True
|
| 2194 |
)
|
| 2195 |
st.caption(
|
| 2196 |
f"Showing {min(200, len(filt_bio)):,} of {len(filt_bio):,} records"
|
|
|
|
| 2204 |
)
|
| 2205 |
with tab3:
|
| 2206 |
st.dataframe(
|
| 2207 |
+
df_meta.head(500), use_container_width=True, hide_index=True
|
| 2208 |
)
|
| 2209 |
st.caption(
|
| 2210 |
f"Showing {min(500, len(df_meta)):,} of {len(df_meta):,} float metadata records (source: ar_index_global_meta.txt)"
|
streamlit/dashboard_example.py
CHANGED
|
@@ -239,7 +239,7 @@ with col1:
|
|
| 239 |
for _, r in totals.iterrows():
|
| 240 |
fig_bar.add_annotation(x=r['Year'], y=r['Total_Floats'], text=str(int(r['Total_Floats'])), showarrow=False, yshift=10)
|
| 241 |
fig_bar.update_layout(barmode='stack', xaxis=dict(dtick=1), height=520)
|
| 242 |
-
st.plotly_chart(fig_bar,
|
| 243 |
|
| 244 |
# Donut chart: age distribution of alive floats (bio dataset)
|
| 245 |
with col2:
|
|
@@ -255,7 +255,7 @@ with col2:
|
|
| 255 |
if not age_counts.empty:
|
| 256 |
fig_donut = px.pie(age_counts, names='Age_Years', values='Count', hole=0.55, title='Age (years) distribution of alive floats')
|
| 257 |
fig_donut.update_traces(textinfo='percent+label')
|
| 258 |
-
st.plotly_chart(fig_donut,
|
| 259 |
else:
|
| 260 |
st.write("No alive float age groups available for selected filters.")
|
| 261 |
else:
|
|
@@ -331,7 +331,7 @@ else:
|
|
| 331 |
)
|
| 332 |
|
| 333 |
fig_map.update_layout(height=650)
|
| 334 |
-
st.plotly_chart(fig_map,
|
| 335 |
# ------------------------------
|
| 336 |
# DAC summary table (bio dataset) - bottom
|
| 337 |
# Live = age_days >= 90, Dead = age_days < 90, Total = unique floats
|
|
@@ -352,7 +352,7 @@ summary_table = g.groupby('DAC').agg(
|
|
| 352 |
|
| 353 |
# present in requested order: DAC | Live | Dead | Total
|
| 354 |
summary_table = summary_table[['DAC','Live','Dead','Total']]
|
| 355 |
-
st.dataframe(summary_table,
|
| 356 |
|
| 357 |
# Compact text lines
|
| 358 |
st.markdown("**Compact summary (DAC β Live / Dead / Total)**")
|
|
|
|
| 239 |
for _, r in totals.iterrows():
|
| 240 |
fig_bar.add_annotation(x=r['Year'], y=r['Total_Floats'], text=str(int(r['Total_Floats'])), showarrow=False, yshift=10)
|
| 241 |
fig_bar.update_layout(barmode='stack', xaxis=dict(dtick=1), height=520)
|
| 242 |
+
st.plotly_chart(fig_bar, use_container_width=True)
|
| 243 |
|
| 244 |
# Donut chart: age distribution of alive floats (bio dataset)
|
| 245 |
with col2:
|
|
|
|
| 255 |
if not age_counts.empty:
|
| 256 |
fig_donut = px.pie(age_counts, names='Age_Years', values='Count', hole=0.55, title='Age (years) distribution of alive floats')
|
| 257 |
fig_donut.update_traces(textinfo='percent+label')
|
| 258 |
+
st.plotly_chart(fig_donut, use_container_width=True)
|
| 259 |
else:
|
| 260 |
st.write("No alive float age groups available for selected filters.")
|
| 261 |
else:
|
|
|
|
| 331 |
)
|
| 332 |
|
| 333 |
fig_map.update_layout(height=650)
|
| 334 |
+
st.plotly_chart(fig_map, use_container_width=True)
|
| 335 |
# ------------------------------
|
| 336 |
# DAC summary table (bio dataset) - bottom
|
| 337 |
# Live = age_days >= 90, Dead = age_days < 90, Total = unique floats
|
|
|
|
| 352 |
|
| 353 |
# present in requested order: DAC | Live | Dead | Total
|
| 354 |
summary_table = summary_table[['DAC','Live','Dead','Total']]
|
| 355 |
+
st.dataframe(summary_table, use_container_width=True)
|
| 356 |
|
| 357 |
# Compact text lines
|
| 358 |
st.markdown("**Compact summary (DAC β Live / Dead / Total)**")
|
streamlit/hello.py
CHANGED
|
@@ -115,7 +115,7 @@ with col1:
|
|
| 115 |
mapbox=dict(center=dict(lat=-10, lon=80), zoom=3)
|
| 116 |
)
|
| 117 |
|
| 118 |
-
st.plotly_chart(fig_map,
|
| 119 |
|
| 120 |
# ---------------- KPI ----------------
|
| 121 |
with col2:
|
|
@@ -148,4 +148,4 @@ fig_bar = px.bar(
|
|
| 148 |
y="count"
|
| 149 |
)
|
| 150 |
|
| 151 |
-
st.plotly_chart(fig_bar,
|
|
|
|
| 115 |
mapbox=dict(center=dict(lat=-10, lon=80), zoom=3)
|
| 116 |
)
|
| 117 |
|
| 118 |
+
st.plotly_chart(fig_map, use_container_width=True)
|
| 119 |
|
| 120 |
# ---------------- KPI ----------------
|
| 121 |
with col2:
|
|
|
|
| 148 |
y="count"
|
| 149 |
)
|
| 150 |
|
| 151 |
+
st.plotly_chart(fig_bar, use_container_width=True)
|