From 33e9cb0b44c64360022cc20cd25e93255a400e10 Mon Sep 17 00:00:00 2001 From: Christopher Young Date: Mon, 24 Oct 2016 21:32:42 -0400 Subject: [PATCH] Change Intensity encoding. --- uatparse/nexrad.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/uatparse/nexrad.go b/uatparse/nexrad.go index 57b53dbe..453955aa 100644 --- a/uatparse/nexrad.go +++ b/uatparse/nexrad.go @@ -17,7 +17,7 @@ type NEXRADBlock struct { LonWest float64 Height float64 Width float64 - Intensity []uint8 // Really only 4-bit values. + Intensity []uint16 // Really only 4-bit values, but using this as a hack for the JSON encoding. } func block_location(block_num int, ns_flag bool, scale_factor int) (float64, float64, float64, float64) { @@ -79,12 +79,12 @@ func (f *UATFrame) decodeNexradFrame() { tmp.LonWest = lon tmp.Height = h tmp.Width = w - tmp.Intensity = make([]uint8, 0) + tmp.Intensity = make([]uint16, 0) intensityData := f.FISB_data[3:] for _, v := range intensityData { - intensity := uint8(v) & 0x7 - runlength := (uint8(v) >> 3) + 1 + intensity := uint16(v) & 0x7 + runlength := (uint16(v) >> 3) + 1 for runlength > 0 { tmp.Intensity = append(tmp.Intensity, intensity) runlength-- @@ -130,9 +130,9 @@ func (f *UATFrame) decodeNexradFrame() { tmp.LonWest = lon tmp.Height = h tmp.Width = w - tmp.Intensity = make([]uint8, 0) + tmp.Intensity = make([]uint16, 0) for k := 0; k < 128; k++ { - z := uint8(0) + z := uint16(0) if f.Product_id == 64 { z = 1 }