Esempio n. 1
0
 def test_coordinateOrderChanged(self):
     inpcube = DataCube(self.inpcube.get_array().transpose())
     refcube = DataCube(self.refcube.get_array().transpose())
     outcube = udf_savitzkygolaysmooth_phenology.apply_datacube(
         inpcube, dict(do_smoothing=False, do_phenology=True))
     xarray.testing.assert_allclose(outcube.get_array(),
                                    refcube.get_array())
Esempio n. 2
0
 def test_missingCoordinates(self):
     inpcube = DataCube(self.inpcube.get_array()[:, :, 0, :])
     refcube = DataCube(self.refcube.get_array()[:, :, 0, :])
     outcube = udf_savitzkygolaysmooth_phenology.apply_datacube(
         inpcube, dict(do_smoothing=False, do_phenology=True))
     xarray.testing.assert_allclose(outcube.get_array(),
                                    refcube.get_array())
Esempio n. 3
0
 def test_multiBand(self):
     inparr1 = self.inpcube.get_array()
     inparr2 = self.inpcube.get_array().assign_coords(bands=['extraband'])
     inpcube = DataCube(xarray.concat([inparr1, inparr2], dim='bands'))
     outcube = udf_savitzkygolaysmooth_phenology.apply_datacube(
         inpcube, dict(do_smoothing=False, do_phenology=True))
     xarray.testing.assert_allclose(outcube.get_array(),
                                    self.refcube.get_array())
Esempio n. 4
0
 def test_oldnewPhenologyIsSame(self):
     optcube = udf_savitzkygolaysmooth_phenology.apply_datacube(
         DataCube(self.inpcube.get_array().drop(['x', 'y'])),
         dict(do_smoothing=False, do_phenology=True))
     oldcube = udf_phenology_old.apply_datacube(
         DataCube(self.inpcube.get_array().drop(['x', 'y'])), {})
     optarr = optcube.get_array().squeeze('t', drop=True)
     oldarr = oldcube.get_array().dt.dayofyear.astype(numpy.float64)
     xarray.testing.assert_allclose(optarr, oldarr)
Esempio n. 5
0
 def test_hasNoDataTimeSeries(self):
     inpcube = DataCube(self.inpcube.get_array().where(
         self.inpcube.get_array().x != 3, numpy.nan, drop=False))
     refcube = DataCube(self.refcube.get_array().where(
         self.refcube.get_array().x != 3, 0., drop=False))
     outcube = udf_savitzkygolaysmooth_phenology.apply_datacube(
         inpcube, dict(do_smoothing=False, do_phenology=True))
     xarray.testing.assert_allclose(outcube.get_array(),
                                    refcube.get_array())
Esempio n. 6
0
 def test_singleBand(self):
     refcube = self.refcube
     outcube = udf_savitzkygolaysmooth_phenology.apply_datacube(
         self.inpcube, dict(do_smoothing=False, do_phenology=True))
     xarray.testing.assert_allclose(outcube.get_array(),
                                    refcube.get_array())
Esempio n. 7
0
 def test_defaults(self):
     refcube = self.refcube
     outcube = udf_savitzkygolaysmooth_phenology.apply_datacube(
         self.inpcube, {})
     xarray.testing.assert_allclose(outcube.get_array(),
                                    refcube.get_array())