To upload files, please first save the app
import streamlit as st
import pandas as pd
import numpy as np
# Przygotowanie przykładowych danych hydrologicznych
dates = pd.date_range(start='2015-01-01', end='2025-01-01', freq='M')
water_levels = np.random.normal(loc=125, scale=2, size=len(dates))
# Tytuł aplikacji
st.title('🌊 Hydrological Monitoring of the Masurian Lakes')
st.write('Welcome! This app analyzes hydrological changes in the Mazury region using sample data.')
# Filtry w panelu bocznym
st.sidebar.header('🔎 Filters')
start_date = st.sidebar.date_input('Start date', dates.min())
end_date = st.sidebar.date_input('End date', dates.max())
lake = st.sidebar.selectbox('Select lake', ['Śniardwy', 'Mamry', 'Niegocin', 'Tałty', 'Bełdany'])
# Filtrowanie danych według wybranej daty
mask = (dates >= pd.to_datetime(start_date)) & (dates <= pd.to_datetime(end_date))
filtered_dates = dates[mask]
filtered_levels = water_levels[mask]
# Wyświetlenie danych
st.subheader(f'📈 Water Level Data for {lake}')
df = pd.DataFrame({
'Date': filtered_dates,
'Water Level (m)': filtered_levels
})
st.dataframe(df)
# Wykresy
st.subheader('📉 Line Chart - Water Level Over Time')
st.line_chart(df.set_index('Date'))
st.subheader('🏞️ Area Chart - Water Level Over Time')
st.area_chart(df.set_index('Date'))
# Element interaktywny - symulacja scenariusza
st.subheader('🔮 Climate Scenario Simulation')
temp_increase = st.slider('Temperature increase (°C)', 0.0, 5.0, 2.0, 0.5)
rain_decrease = st.slider('Rainfall decrease (%)', 0, 50, 20, 5)
# Symulacja wpływu zmian klimatycznych
adjusted_levels = filtered_levels - (temp_increase * 0.5) - (rain_decrease * 0.05)
st.subheader('📊 Simulated Water Levels')
df_simulated = pd.DataFrame({
'Date': filtered_dates,
'Simulated Water Level (m)': adjusted_levels
})
st.dataframe(df_simulated)
# Wykres symulacji
st.line_chart(df_simulated.set_index('Date'))
# Przywitanie użytkownika
st.sidebar.subheader('👤 User Info')
name = st.sidebar.text_input('Enter your name')
if name:
st.sidebar.write(f'Hello {name}!')
# Stopka
st.markdown("---")
st.caption('Demo version using random data. In a real project, connect real satellite and hydrological datasets.')
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?