package radar import ( "context" "encoding/json" "errors" "fmt" "io" "log" "net/http" neturl "net/url" "os" "path/filepath" "regexp" "strings" "time" "weatherstation/internal/config" "weatherstation/internal/database" ) // Options controls the radar scheduler behavior. type Options struct { Enable bool OutputDir string Delay time.Duration // time after each 6-minute boundary to trigger download BaseURL string // optional: where to download from (template-based) MaxRetries int // Tile indices (4326 pyramid). Defaults: z=7,y=40,x=102 (Nanning region example) Z int Y int X int // StoreToDB controls whether to store fetched tiles into PostgreSQL `radar_tiles`. StoreToDB bool } // Start starts the radar download scheduler. It reads options from env if zero value provided. // Env vars: // // RADAR_ENABLED=true|false (default: true) // RADAR_DIR=radar_data (default) // RADAR_DELAY_SEC=120 (2 minutes; trigger after each boundary) // RADAR_MAX_RETRIES=2 // RADAR_BASE_URL=