feat: 新增雷达图
This commit is contained in:
parent
4fa9822405
commit
6bc0610c2d
@ -10,6 +10,7 @@ import (
|
|||||||
"weatherstation/internal/config"
|
"weatherstation/internal/config"
|
||||||
"weatherstation/internal/database"
|
"weatherstation/internal/database"
|
||||||
"weatherstation/internal/forecast"
|
"weatherstation/internal/forecast"
|
||||||
|
"weatherstation/internal/radarfetch"
|
||||||
"weatherstation/internal/selftest"
|
"weatherstation/internal/selftest"
|
||||||
"weatherstation/internal/server"
|
"weatherstation/internal/server"
|
||||||
"weatherstation/internal/tools"
|
"weatherstation/internal/tools"
|
||||||
@ -222,9 +223,36 @@ func main() {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 启动雷达抓取(后台定时)
|
||||||
|
startRadarBackground := func(wg *sync.WaitGroup) {
|
||||||
|
if wg != nil {
|
||||||
|
wg.Add(1)
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
defer func() {
|
||||||
|
if wg != nil {
|
||||||
|
wg.Done()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
log.Println("启动雷达抓取任务(10分钟)...")
|
||||||
|
opts := radarfetch.Options{
|
||||||
|
OutRoot: "./radar_data",
|
||||||
|
TZOffset: 8,
|
||||||
|
Interval: 10 * time.Minute,
|
||||||
|
NMCChinaURL: "https://www.nmc.cn/publish/radar/chinaall.html",
|
||||||
|
NMCHuananURL: "https://www.nmc.cn/publish/radar/huanan.html",
|
||||||
|
NMCNanningURL: "https://www.nmc.cn/publish/radar/guang-xi/nan-ning.htm",
|
||||||
|
CMABase: "https://image.data.cma.cn",
|
||||||
|
Z: 7, Y: 40, X: 102,
|
||||||
|
}
|
||||||
|
radarfetch.Run(opts)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
if *webOnly {
|
if *webOnly {
|
||||||
// 只启动Web服务器 + 导出器
|
// 只启动Web服务器 + 导出器
|
||||||
startExporterBackground(nil)
|
startExporterBackground(nil)
|
||||||
|
startRadarBackground(nil)
|
||||||
log.Println("启动Web服务器模式...")
|
log.Println("启动Web服务器模式...")
|
||||||
if err := server.StartGinServer(); err != nil {
|
if err := server.StartGinServer(); err != nil {
|
||||||
log.Fatalf("启动Web服务器失败: %v", err)
|
log.Fatalf("启动Web服务器失败: %v", err)
|
||||||
@ -232,6 +260,7 @@ func main() {
|
|||||||
} else if *udpOnly {
|
} else if *udpOnly {
|
||||||
// 只启动UDP服务器 + 导出器
|
// 只启动UDP服务器 + 导出器
|
||||||
startExporterBackground(nil)
|
startExporterBackground(nil)
|
||||||
|
startRadarBackground(nil)
|
||||||
log.Println("启动UDP服务器模式...")
|
log.Println("启动UDP服务器模式...")
|
||||||
if err := server.StartUDPServer(); err != nil {
|
if err := server.StartUDPServer(); err != nil {
|
||||||
log.Fatalf("启动UDP服务器失败: %v", err)
|
log.Fatalf("启动UDP服务器失败: %v", err)
|
||||||
@ -262,6 +291,7 @@ func main() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
startExporterBackground(&wg)
|
startExporterBackground(&wg)
|
||||||
|
startRadarBackground(&wg)
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user