Exemplo n.º 1
0
    def test_read_radolan_header(self):
        rx_header = (b'RW030950100000814BY1620130VS 3SW   2.13.1PR E-01'
                     b'INT  60GP 900x 900MS 58<boo,ros,emd,hnr,pro,ess,'
                     b'asd,neu,nhb,oft,tur,isn,fbg,mem>')

        buf = io.BytesIO(rx_header)
        self.assertRaises(EOFError, lambda: radolan.read_radolan_header(buf))

        buf = io.BytesIO(rx_header + b"\x03")
        header = radolan.read_radolan_header(buf)
        self.assertEqual(header, rx_header.decode())
Exemplo n.º 2
0
    def test_read_radolan_header(self):
        rx_header = (b'RW030950100000814BY1620130VS 3SW   2.13.1PR E-01'
                     b'INT  60GP 900x 900MS 58<boo,ros,emd,hnr,pro,ess,'
                     b'asd,neu,nhb,oft,tur,isn,fbg,mem>')

        buf = io.BytesIO(rx_header)
        self.assertRaises(EOFError, lambda: radolan.read_radolan_header(buf))

        buf = io.BytesIO(rx_header + b"\x03")
        header = radolan.read_radolan_header(buf)
        self.assertEqual(header, rx_header.decode())
Exemplo n.º 3
0
    def test_read_radolan_binary_array(self):
        filename = 'radolan/misc/raa01-rw_10000-1408030950-dwd---bin.gz'
        rw_file = wrl.util.get_wradlib_data_file(filename)
        rw_fid = radolan.get_radolan_filehandle(rw_file)
        header = radolan.read_radolan_header(rw_fid)
        attrs = radolan.parse_DWD_quant_composite_header(header)
        data = radolan.read_radolan_binary_array(rw_fid, attrs['datasize'])
        self.assertEqual(len(data), attrs['datasize'])

        rw_fid = radolan.get_radolan_filehandle(rw_file)
        header = radolan.read_radolan_header(rw_fid)
        attrs = radolan.parse_DWD_quant_composite_header(header)
        self.assertRaises(
            IOError, lambda: radolan.read_radolan_binary_array(
                rw_fid, attrs['datasize'] + 10))
Exemplo n.º 4
0
    def test_read_radolan_binary_array(self):
        filename = 'radolan/misc/raa01-rw_10000-1408030950-dwd---bin.gz'
        rw_file = wrl.util.get_wradlib_data_file(filename)
        rw_fid = radolan.get_radolan_filehandle(rw_file)
        header = radolan.read_radolan_header(rw_fid)
        attrs = radolan.parse_dwd_composite_header(header)
        data = radolan.read_radolan_binary_array(rw_fid, attrs['datasize'])
        self.assertEqual(len(data), attrs['datasize'])

        rw_fid = radolan.get_radolan_filehandle(rw_file)
        header = radolan.read_radolan_header(rw_fid)
        attrs = radolan.parse_dwd_composite_header(header)
        self.assertRaises(
            IOError,
            lambda: radolan.read_radolan_binary_array(rw_fid,
                                                      attrs['datasize'] + 10))
Exemplo n.º 5
0
 def test_decode_radolan_runlength_array(self):
     filename = 'radolan/misc/raa00-pc_10015-1408030905-dwd---bin.gz'
     pg_file = wrl.util.get_wradlib_data_file(filename)
     pg_fid = radolan.get_radolan_filehandle(pg_file)
     header = radolan.read_radolan_header(pg_fid)
     attrs = radolan.parse_DWD_quant_composite_header(header)
     data = radolan.read_radolan_binary_array(pg_fid, attrs['datasize'])
     attrs['nodataflag'] = 255
     arr = radolan.decode_radolan_runlength_array(data, attrs)
     self.assertEqual(arr.shape, (460, 460))
Exemplo n.º 6
0
 def test_decode_radolan_runlength_array(self):
     filename = 'radolan/misc/raa00-pc_10015-1408030905-dwd---bin.gz'
     pg_file = wrl.util.get_wradlib_data_file(filename)
     pg_fid = radolan.get_radolan_filehandle(pg_file)
     header = radolan.read_radolan_header(pg_fid)
     attrs = radolan.parse_dwd_composite_header(header)
     data = radolan.read_radolan_binary_array(pg_fid, attrs['datasize'])
     attrs['nodataflag'] = 255
     arr = radolan.decode_radolan_runlength_array(data, attrs)
     self.assertEqual(arr.shape, (460, 460))