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

View file

@ -15,7 +15,7 @@ type cube struct {
file *os.File
}
func openCube(path string) (*cube, error) {
func openCube(path string, dc *DatasetConfig) (*cube, error) {
f, err := os.Open(path)
if err != nil {
return nil, err
@ -27,14 +27,15 @@ func openCube(path string) (*cube, error) {
return nil, err
}
const (
nT = 33 // 0-96 hours with step 3 hours (33 time steps)
nP = 47 // 47 pressure levels matching tawhiri
nLat = 361
nLon = 720
)
return &cube{mm: mm, t: nT, p: nP, lat: nLat, lon: nLon, bytesPerVar: int64(nT * nP * nLat * nLon * 4), file: f}, nil
return &cube{
mm: mm,
t: dc.NT,
p: dc.NP,
lat: dc.NLat,
lon: dc.NLon,
bytesPerVar: dc.SizePerVar(),
file: f,
}, nil
}
func (c *cube) val(varIdx, ti, pi, y, x int) float32 {