From 13b4117d75f57cd46a003e384e39d98b05a05345 Mon Sep 17 00:00:00 2001 From: yarnom Date: Thu, 25 Sep 2025 17:42:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/imdroid_radar.html | 80 ++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/templates/imdroid_radar.html b/templates/imdroid_radar.html index 7ca5a4b..6454fcd 100644 --- a/templates/imdroid_radar.html +++ b/templates/imdroid_radar.html @@ -128,6 +128,7 @@ maybeCalcSector(); maybePlotSquare(); maybeCalcNearbyRain(); + maybeCalcTileRegionStats(); } async function loadTileAt(z, y, x, dtStr) { @@ -160,6 +161,7 @@ maybeCalcSector(); maybePlotSquare(); maybeCalcNearbyRain(); + maybeCalcTileRegionStats(); } function fmtDTLocal(dt){ @@ -436,6 +438,75 @@ }catch(e){ /* ignore */ } } + // 计算并展示:扇形区域与8km圆形区域的 >=40 和 >=30 dBZ 点数与累计值 + function maybeCalcTileRegionStats(){ + try{ + const s40CntEl = document.getElementById('sector_ge40_cnt'); + if(!s40CntEl) return; // 元素不存在则不计算 + // 先清空展示 + const ids=[ + 'sector_ge40_cnt','sector_ge40_sum','sector_ge30_cnt','sector_ge30_sum', + 'circle_ge40_cnt','circle_ge40_sum','circle_ge30_cnt','circle_ge30_sum' + ]; + ids.forEach(id=>{ const el=document.getElementById(id); if(el) el.textContent='-'; }); + + if(!gTileValues || !gXs || !gYs || gStLat===null || gStLon===null) return; + const h=gTileValues.length, w=gTileValues[0].length; + + // 扇形区域定义:风向 ±30°,半径 = 3 小时移动距离 + const hasWind = (gWindFromDeg!==null && gWindSpeedMS!==null && gWindSpeedMS>0); + const halfAngle=30; + const rangeM = hasWind ? (gWindSpeedMS*3*3600) : 0; + + // 圆形区域:半径 8km + const circleR = 8000; + + let sec40Cnt=0, sec40Sum=0, sec30Cnt=0, sec30Sum=0; + let cir40Cnt=0, cir40Sum=0, cir30Cnt=0, cir30Sum=0; + + for(let r=0;r=40){ cir40Cnt++; cir40Sum+=dbz; } + if(dbz>=30){ cir30Cnt++; cir30Sum+=dbz; } + } + + // 扇形区域统计(需要风向风速) + if(hasWind){ + if(dist<=rangeM){ + const brg=bearingDeg(gStLat,gStLon,lat,lon); + if(angDiff(brg,gWindFromDeg)<=halfAngle){ + if(dbz>=40){ sec40Cnt++; sec40Sum+=dbz; } + if(dbz>=30){ sec30Cnt++; sec30Sum+=dbz; } + } + } + } + } + } + + // 更新展示 + const set = (id, val)=>{ const el=document.getElementById(id); if(el) el.textContent=String(val); }; + if(hasWind){ + set('sector_ge40_cnt', sec40Cnt); set('sector_ge40_sum', sec40Sum.toFixed(1)); + set('sector_ge30_cnt', sec30Cnt); set('sector_ge30_sum', sec30Sum.toFixed(1)); + } else { + // 无风场信息时显示提示 + set('sector_ge40_cnt', '无风场'); set('sector_ge40_sum', '-'); + set('sector_ge30_cnt', '无风场'); set('sector_ge30_sum', '-'); + } + set('circle_ge40_cnt', cir40Cnt); set('circle_ge40_sum', cir40Sum.toFixed(1)); + set('circle_ge30_cnt', cir30Cnt); set('circle_ge30_sum', cir30Sum.toFixed(1)); + }catch(e){ /* ignore */ } + } + async function main() { await loadStations(); // 初始化时间范围为最近24小时 @@ -605,6 +676,7 @@ +
@@ -615,6 +687,14 @@
正方形裁减区域
+
+
扇形区域统计
+ ≥40 dBZ:点数 -,累计 - + | ≥30 dBZ:点数 -,累计 - +
圆形区域统计
+ ≥40 dBZ:点数 -,累计 - + | ≥30 dBZ:点数 -,累计 - +