From 6e5d02a3e88052892f14c264ae9855299767fce6 Mon Sep 17 00:00:00 2001 From: shunli Date: Wed, 21 Jan 2026 16:37:36 +0800 Subject: [PATCH] feat(ui): add sea_env.modeling parameter input panel for web algorithms --- main.py | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index d4da566..8762662 100644 --- a/main.py +++ b/main.py @@ -372,6 +372,35 @@ def show_scheduling(): with col2: st.subheader("2. 数据与校验") sample_rate = st.number_input("采样率 (Hz)", min_value=1.0, value=1000.0, step=100.0) + + # 检测是否有 web 类型算法需要建模参数 + has_web_algo = any(a.get("type") == "web" for a in st.session_state.pipeline) + + # 声学建模参数面板(仅当链路中包含 web 算法时展开) + with st.expander("🌊 声学建模参数 (Web 算法)", expanded=has_web_algo): + st.caption("以下参数用于 Bellhop/Kraken/RAM 等远程声学建模服务") + + col_freq, col_time = st.columns(2) + with col_freq: + modeling_freq = st.number_input("建模频率 (Hz)", min_value=1.0, value=100.0, step=10.0) + with col_time: + time_types = ["Annual", "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December", + "Winter", "Spring", "Summer", "Autumn"] + modeling_time_type = st.selectbox("时间段", time_types) + + col_src, col_rcv = st.columns(2) + with col_src: + st.markdown("**声源位置**") + source_lat = st.number_input("纬度 (°)", value=19.0, step=0.1, key="src_lat") + source_lon = st.number_input("经度 (°)", value=115.0, step=0.1, key="src_lon") + source_depth = st.number_input("深度 (m)", min_value=0, value=50, step=10, key="src_depth") + with col_rcv: + st.markdown("**接收位置**") + receive_lat = st.number_input("纬度 (°)", value=20.0, step=0.1, key="rcv_lat") + receive_lon = st.number_input("经度 (°)", value=116.0, step=0.1, key="rcv_lon") + receive_depth = st.number_input("深度 (m)", min_value=0, value=3000, step=100, key="rcv_depth") + uploaded_file = st.file_uploader("上传待处理数据 (.npy)", type=["npy"]) auto_apply_template = st.checkbox("自动应用同名接口模板(若存在)", value=True) @@ -383,7 +412,19 @@ def show_scheduling(): sample_rate_unit="Hz", channel_layout="time_first", coordinate_system="WGS84", - collect_time=datetime.now().strftime("%Y-%m-%d %H:%M:%S") + collect_time=datetime.now().strftime("%Y-%m-%d %H:%M:%S"), + sea_env={ + "modeling": { + "freq_hz": float(modeling_freq), + "source_depth_m": int(source_depth), + "receive_depth_m": int(receive_depth), + "source_lat": float(source_lat), + "source_lon": float(source_lon), + "receive_lat": float(receive_lat), + "receive_lon": float(receive_lon), + "time_type": modeling_time_type, + } + } ) # 自动映射 (Phase 2 简化版:直接使用元数据中的映射)