Welcome to your static Space!

You can modify this app directly by editing index.html in the Files and versions tab.

Also don't forget to check the Spaces documentation.

import streamlit as st import pandas as pd import numpy as np import plotly.graph_objects as go from metpy.plots import Hodograph import matplotlib.pyplot as plt # CONFIGURACAO DO SITE st.set_page_config( page_title="Storm Analyzer Pro", page_icon="⚡", layout="wide", initial_sidebar_state="expanded" ) # INTERFACE VISUAL (DARK MODE E LEDS) st.markdown(""" """, unsafe_allow_html=True) st.title("⛈️ STORM ANALYZER PRO") st.subheader("Análise Avançada Baseada em Matriz de Ingredientes Combinados") st.markdown("---") # CONTROLES LATERAIS DE DADOS (PAINEL MOBILE) st.sidebar.header("📊 Dados Meteorológicos") st.sidebar.subheader("💧 Termodinâmica") v_cape = st.sidebar.slider("CAPE (J/kg)", 0, 5000, 2200, step=100) v_cin = st.sidebar.slider("CIN (J/kg)", -500, 0, -35, step=5) v_lr = st.sidebar.slider("Lapse Rate 700-500 hPa (°C/km)", 4.0, 11.0, 7.2, step=0.1) st.sidebar.subheader("🌪️ Cinemática") v_shear = st.sidebar.slider("Bulk Shear 0-6 km (kt)", 0, 90, 45, step=5) v_srh = st.sidebar.slider("SRH 0-1 km (m²/s²)", 0, 600, 250, step=10) # CÁLCULO DA MATRIZ POR PONTOS total_pts = 0 pesos = {} # Peso CAPE if v_cape < 500: p_cape = 0 elif 500 <= v_cape < 1500: p_cape = 1 elif 1500 <= v_cape < 3000: p_cape = 2 else: p_cape = 3 total_pts += p_cape pesos["Instabilidade (CAPE)"] = p_cape # Peso Shear if v_shear < 20: p_shear = 0 elif 20 <= v_shear < 35: p_shear = 1 elif 35 <= v_shear < 50: p_shear = 2 else: p_shear = 3 total_pts += p_shear pesos["Cisalhamento (0-6 km)"] = p_shear # Peso SRH if v_srh < 100: p_srh = 0 elif 100 <= v_srh < 200: p_srh = 1 elif 200 <= v_srh < 350: p_srh = 2 else: p_srh = 3 total_pts += p_srh pesos["Helicidade (SRH 0-1 km)"] = p_srh # Peso Lapse Rate if v_lr < 6.0: p_lr = 0 elif 6.0 <= v_lr < 7.5: p_lr = 1 else: p_lr = 2 total_pts += p_lr pesos["Gradiente (Lapse Rate)"] = p_lr # Moderador CIN p_cin = 0 if v_cin < -180: p_cin = -2 total_pts += p_cin pesos["Inibição Convectiva (CIN)"] = p_cin total_pts = max(0, total_pts) # DEFINIÇÃO DO STATUS E LED if 0 <= total_pts <= 3: hex_c, txt_s = "#10B981", "🟢 NÍVEL 0: BAIXO RISCO" elif 4 <= total_pts <= 6: hex_c, txt_s = "#F59E0B", "🟡 NÍVEL 1: ATENÇÃO" elif 7 <= total_pts <= 9: hex_c, txt_s = "#F97316", "🟠 NÍVEL 2: RISCO ELEVADO" elif 10 <= total_pts <= 12: hex_c, txt_s = "#EF4444", "🔴 NÍVEL 3: RISCO SEVERO" else: hex_c, txt_s = "#A855F7", "🟣 NÍVEL 4: RISCO EXTREMO" # MOSTRAR LED NA TELA st.markdown(f"""
{txt_s} ({total_pts} PTS)
""", unsafe_allow_html=True) # DIVISÃO DE COLUNAS col1, col2 = st.columns() with col1: st.markdown("### 📈 Indicadores Visuais") # GRAFICOS GAUGE PROFISSIONAIS fig_g = go.Figure() fig_g.add_trace(go.Indicator( mode = "gauge+number", value = v_cape, domain = {'x': [0, 0.45], 'y': [0, 1]}, title = {'text': "CAPE (Energia Convectiva)"}, gauge = {'axis': {'range': [0, 5000]}, 'bar': {'color': "#34d399"}, 'steps': [{'range': [0, 1500], 'color': "#1e293b"}, {'range': [1500, 3000], 'color': "#334155"}]} )) fig_g.add_trace(go.Indicator( mode = "gauge+number", value = v_srh, domain = {'x': [0.55, 1], 'y': [0, 1]}, title = {'text': "SRH 0-1 km (Helicidade)"}, gauge = {'axis': {'range': [0, 600]}, 'bar': {'color': "#a78bfa"}, 'steps': [{'range': [0, 200], 'color': "#1e293b"}]} )) fig_g.update_layout(template="plotly_dark", paper_bgcolor='rgba(0,0,0,0)', height=250) st.plotly_chart(fig_g, use_container_width=True) # PLOTAGEM DA HODÓGRAFA CIENTÍFICA st.markdown("### 🌪️ Análise Cinematica (Hodógrafa)") scale = v_shear / 4.0 u_comp = np.array([0, 5 * scale, 12 * scale, 22 * scale, 35 * scale]) v_comp = np.array([0, 8 * scale, 18 * scale, 24 * scale, 20 * scale]) fig_h, ax_h = plt.subplots(figsize=(6, 4), facecolor='#0d1117') ax_h.set_facecolor('#161b22') hodo = Hodograph(ax_h, component_range=80) hodo.add_grid(increment=20, color='#30363d') hodo.plot(u_comp, v_comp, color='#f43f5e', linewidth=3) ax_h.tick_params(colors='#c9d1d9', labelsize=8) st.pyplot(fig_h) with col2: st.markdown("### 🧮 Auditoria de Pesos") df_p = pd.DataFrame(list(pesos.items()), columns=['Variável Atmosférica', 'Pontos']) st.dataframe(df_p, hide_index=True, use_container_width=True) st.markdown("### 🔍 Métrica de Dinâmica Combinada") r_cs = round(v_cape / v_shear, 1) if v_shear > 0 else 0 st.markdown(f"""

Razão Dinâmica Convectiva (CAPE / Shear)

{r_cs}

Mapeia o equilíbrio do desenvolvimento severo. Valores intermediários apontam alto potencial supercelular organizado.

""", unsafe_allow_html=True)