Beispiel #1
0
 def test_full(self):
     ref = self.buildData()
     for ifmt in formats:
         fn = os.path.join(self.tmpdir, 'test_full.' + ifmt)
         print("Testing " + fn)
         datacube_to_file(ref, fn, fmt=ifmt)
         res = datacube_from_file(fn, fmt=ifmt)
     xarray.testing.assert_allclose(res.get_array(), ref.get_array())
Beispiel #2
0
 def test_band_nodim(self):
     ref = self.buildData()
     ref = DataCube(ref.get_array()[:, 0].drop('bands'))
     for ifmt in formats:
         fn = os.path.join(self.tmpdir, 'test_band_nodim.' + ifmt)
         print("Testing " + fn)
         datacube_to_file(ref, fn, fmt=ifmt)
         res = datacube_from_file(fn, fmt=ifmt)
     xarray.testing.assert_allclose(res.get_array(), ref.get_array())
Beispiel #3
0
 def test_xy_nolabels(self):
     ref = self.buildData()
     ref = DataCube(ref.get_array().drop('x').drop('y'))
     for ifmt in formats:
         fn = os.path.join(self.tmpdir, 'test_xy_nolabels.' + ifmt)
         print("Testing " + fn)
         datacube_to_file(ref, fn, fmt=ifmt)
         res = datacube_from_file(fn, fmt=ifmt)
     xarray.testing.assert_allclose(res.get_array(), ref.get_array())
Beispiel #4
0
 def test_typing_float(self):
     ref = self.buildData()
     ref = DataCube(ref.get_array().astype(numpy.float64))
     for ifmt in formats:
         fn = os.path.join(self.tmpdir, 'test_typing_float.' + ifmt)
         print("Testing " + fn)
         datacube_to_file(ref, fn, fmt=ifmt)
         res = datacube_from_file(fn, fmt=ifmt)
     xarray.testing.assert_allclose(res.get_array(), ref.get_array())
     self.assertEqual(res.get_array().dtype, ref.get_array().dtype)