updated downloader

This commit is contained in:
straitz 2026-03-22 16:29:53 +09:00
parent ca95e06ab7
commit 8e9f117799
30 changed files with 1209 additions and 698 deletions

44
scripts/rebuild_cube.go Normal file
View file

@ -0,0 +1,44 @@
package main
import (
"context"
"fmt"
"os"
"time"
"git.intra.yksa.space/gsn/predictor/internal/pkg/grib"
)
func main() {
ctx := context.Background()
cfg := &grib.Config{
Dir: "C:/tmp/grib",
TTL: 48 * time.Hour,
CacheTTL: 1 * time.Hour,
Parallel: 8,
}
svc, err := grib.New(cfg)
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
// Delete old cube to force rebuild
cubePath := "C:/tmp/grib/20260212_12.cube"
if err := os.Remove(cubePath); err != nil && !os.IsNotExist(err) {
fmt.Printf("Remove cube error: %v\n", err)
} else {
fmt.Println("Old cube removed")
}
// Update will download missing pgrb2b files and rebuild cube
fmt.Println("Starting update (download pgrb2b + rebuild cube)...")
start := time.Now()
if err := svc.Update(ctx); err != nil {
fmt.Printf("Update error: %v\n", err)
return
}
fmt.Printf("Done in %v\n", time.Since(start))
}