Commit e4a50982 authored by Jonny Schäfer's avatar Jonny Schäfer
Browse files

Add NewDummy function

parent 8daceb4b
......@@ -101,6 +101,14 @@ func NewComposite(rd io.Reader) (comp *Composite, err error) {
return
}
// NewDummy creates a blank dummy composite with the given product label and dimensions. It can
// be used for generic coordinate translation.
func NewDummy(product string, dx, dy int) (comp *Composite) {
comp = &Composite{Product: product, Dx: dx, Dy: dy}
comp.calibrateProjection()
return
}
// At is shorthand for c.Data[y][x] and returns the radar video processor value (rvp-6) at
// the given point. NaN is returned, if no data is available or the requested point is located
// outside the scanned area.
......
......@@ -35,10 +35,10 @@ func TestTranslate(t *testing.T) {
[]float64{43.8736, 18.2536, 1.0, 1.0},
}
dummyPG := &Composite{Product: "PG", Dx: 460, Dy: 460}
dummyFZ := &Composite{Product: "FZ", Dx: 450, Dy: 450}
dummyRX := &Composite{Product: "RX", Dx: 900, Dy: 900}
dummyEX := &Composite{Product: "EX", Dx: 1400, Dy: 1500}
dummyPG := NewDummy("PG", 460, 460)
dummyFZ := NewDummy("FZ", 450, 450)
dummyRX := NewDummy("RX", 900, 900)
dummyEX := NewDummy("EX", 1400, 1500)
testcases := []struct {
comp *Composite
......@@ -51,8 +51,6 @@ func TestTranslate(t *testing.T) {
}
for _, test := range testcases {
test.comp.calibrateProjection()
t.Logf("dummy%s: Rx = %f; Ry = %f\n",
test.comp.Product, test.comp.Rx, test.comp.Ry)
t.Logf("dummy%s: offx = %f; offy = %f\n",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment