예제 #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())
예제 #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())
예제 #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())
예제 #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)
def test_debug_udf_direct_invoke():
    """
    Shows how to run your UDF locally for testing, by invoking the function directly, breakpoints work.
    https://open-eo.github.io/openeo-python-client/udf.html#example-downloading-a-datacube-and-executing-an-udf-locally
    depends on composite.nc file created in earlier function!
    """
    from openeo.rest.conversions import datacube_from_file
    udf_cube = datacube_from_file('masked.nc', fmt='netcdf')

    apply_datacube(udf_cube,context={})
예제 #6
0
def test_run_udf_offline():
    from openeo.rest.conversions import datacube_from_file
    udf_cube = datacube_from_file('sigma0_cube_terrascope.nc', fmt='netcdf')
    from BFAST_udf import apply_datacube
    apply_datacube(udf_cube, context={})