fixed wind data bug

This commit is contained in:
straitz 2025-12-16 11:42:00 +09:00
parent b355b41ed2
commit ca95e06ab7
4 changed files with 10 additions and 9 deletions

View file

@ -17,9 +17,10 @@ func (d *dataset) uv(lat, lon, alt float64, tHours float64) (float64, float64) {
x0 := int(math.Floor(ix)) % d.cube.lon
x1 := (x0 + 1) % d.cube.lon
wx := ix - float64(x0)
// For hourly data (step = 1 hour)
it0 := int(math.Floor(tHours))
wt := tHours - float64(it0)
// For 3-hourly data (step = 3 hours)
// Convert tHours to 3-hour index (e.g., 1.5 hours -> index 0.5, interpolate between 0 and 1)
it0 := int(math.Floor(tHours / 3.0))
wt := (tHours - float64(it0*3)) / 3.0 // Interpolation weight within 3-hour window
p := pressureFromAlt(alt)
ip0 := 0
for ip0+1 < len(pressureLevels) && pressureLevels[ip0+1] > p {