Skip to content

Commit a226cce

Browse files
feat: add point-based time-series forecasting support and optimize bitshuffle, delta, and lorenzo decoders.
1 parent f816708 commit a226cce

14 files changed

Lines changed: 1451 additions & 166 deletions

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ deps: node_modules/.stamp
4545

4646
# testdata is regenerated whenever cmd/gen-testdata changes.
4747
TESTDATA_FILES := format/testdata/minimal.wmt format/testdata/extended.wmt \
48-
format/testdata/compacted.wmt format/testdata/crc_corrupted.wmt
48+
format/testdata/compacted.wmt format/testdata/crc_corrupted.wmt \
49+
format/testdata/multistep.wmt
4950

5051
$(TESTDATA_FILES): cmd/gen-testdata/main.go
5152
mkdir -p format/testdata

cmd/gen-testdata/main.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,57 @@ func main() {
3535
crcPath := filepath.Join(outDir, "crc_corrupted.wmt")
3636
makeCRCCorrupted(extendedPath, crcPath)
3737
fmt.Printf("wrote %s\n", crcPath)
38+
39+
multistepPath := filepath.Join(outDir, "multistep.wmt")
40+
makeMultistep(multistepPath, pixSize, refTime, fixedNow)
41+
fmt.Printf("wrote %s\n", multistepPath)
42+
}
43+
44+
// 4 hourly steps × 2 variables. Pixel values encode (timeStep, variable) so a
45+
// reader can verify both slicing and per-variable routing.
46+
func makeMultistep(path string, pixSize int, refTime time.Time, now time.Time) {
47+
const steps = 4
48+
const hourMs = int64(3600 * 1000)
49+
vars := []struct {
50+
Name string
51+
Offset float32
52+
}{
53+
{"temp", 100},
54+
{"wind", 200},
55+
}
56+
57+
tiles := make([]encoder.Tile, 0, steps*len(vars))
58+
for _, v := range vars {
59+
for t := uint32(0); t < steps; t++ {
60+
px := make([]float32, pixSize*pixSize)
61+
for i := range px {
62+
px[i] = v.Offset + float32(t)
63+
}
64+
tiles = append(tiles, encoder.Tile{
65+
Variable: v.Name, TimeStep: t, Z: 0, X: 0, Y: 0, Pixels: px,
66+
})
67+
}
68+
}
69+
70+
specs := make([]encoder.VariableSpec, 0, len(vars))
71+
for _, v := range vars {
72+
specs = append(specs, encoder.VariableSpec{Name: v.Name, Unit: "u"})
73+
}
74+
opts := encoder.Options{
75+
TilePixelSizeLog2: 7,
76+
MinZoom: 0,
77+
MaxZoom: 0,
78+
ReferenceForecastTime: refTime,
79+
TimeCatalog: format.TimeCatalog{
80+
Regular: true, StartMs: refTime.UnixMilli(), IntervalMs: hourMs, Count: steps,
81+
},
82+
BBox: [4]float64{-180, -85, 180, 85},
83+
Variables: specs,
84+
CreationTime: now,
85+
}
86+
if err := encoder.Encode(tiles, opts, path); err != nil {
87+
die(err)
88+
}
3889
}
3990

4091
func makeMinimal(path string, pixSize int, refTime time.Time, now time.Time) {

cmd/wmtiles/web/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<div id="top">
2828
<label>parameter <select id="param" disabled><option>loading…</option></select></label>
2929
<label>height <select id="height" disabled><option>n/a</option></select></label>
30-
<label>time <input id="time" type="range" min="0" max="0" value="0" step="1" disabled> <span id="timeLabel"></span></label>
30+
<label>time <input id="time" type="range" min="0" max="0" value="0" step="any" disabled> <span id="timeLabel"></span></label>
3131
<label>vmin <input id="vmin" type="number" step="any" style="width:90px" disabled></label>
3232
<label>vmax <input id="vmax" type="number" step="any" style="width:90px" disabled></label>
3333
<span id="status">opening…</span>

cmd/wmtiles/web/src/colormap.ts

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)