def setUpClass(cls): cls.test_cases = [ cls.InterpolationTestCase('linear', LinearInterpolation( 'ndvi', result_interval=(-0.3, -0.1), unknown_value=10), result_len=180, img_min=-0.3000, img_max=10.0, img_mean=-0.147169, img_median=-0.21132), cls.InterpolationTestCase( 'cubic', CubicInterpolation('ndvi', result_interval=(-0.3, -0.1), resample_range=('2015-01-01', '2018-01-01', 16), unknown_value=5), result_len=69, img_min=-0.3000, img_max=5.0, img_mean=1.30387, img_median=-0.1007357), cls.InterpolationTestCase( 'spline', SplineInterpolation('ndvi', result_interval=(-10, 10), resample_range=('2016-01-01', '2018-01-01', 5), spline_degree=3, smoothing_factor=0), result_len=147, img_min=-0.68187547, img_max=0.26355705, img_mean=-0.1886001, img_median=-0.18121514), cls.InterpolationTestCase('bspline', BSplineInterpolation( 'ndvi', unknown_value=-3, resample_range=('2017-01-01', '2017-02-01', 50), spline_degree=5), result_len=1, img_min=-0.20366311, img_max=0.035470814, img_mean=-0.04307341, img_median=-0.040708482), cls.InterpolationTestCase('akima', AkimaInterpolation('ndvi', unknown_value=0), result_len=180, img_min=-0.4821199, img_max=0.2299331, img_mean=-0.20141865, img_median=-0.213559), cls.InterpolationTestCase( 'nearest resample', NearestResampling('ndvi', result_interval=(-0.3, -0.1), resample_range=('2016-01-01', '2018-01-01', 5)), result_len=147, img_min=-0.3000, img_max=-0.1000, img_mean=-0.19651729, img_median=-0.20000, nan_replace=-0.2), cls.InterpolationTestCase( 'linear resample', LinearResampling('ndvi', result_interval=(-0.3, -0.1), resample_range=('2016-01-01', '2018-01-01', 5)), result_len=147, img_min=-0.3000, img_max=-0.1000, img_mean=-0.1946315, img_median=-0.20000, nan_replace=-0.2), cls.InterpolationTestCase( 'cubic resample', CubicResampling('ndvi', result_interval=(-0.3, -0.1), resample_range=('2015-01-01', '2018-01-01', 16), unknown_value=5), result_len=69, img_min=-0.3000, img_max=5.0, img_mean=1.22359, img_median=-0.181167, nan_replace=-0.2) ] for test_case in cls.test_cases: test_case.execute()
def setUpClass(cls): cls.test_cases = [ cls.InterpolationTestCase('linear', LinearInterpolation('NDVI', result_interval=(0.0, 1.0), mask_feature=(FeatureType.MASK, 'IS_VALID'), unknown_value=10), result_len=68, img_min=0.0, img_max=10.0, img_mean=0.720405, img_median=0.59765935), cls.InterpolationTestCase('linear_change_timescale', LinearInterpolation('NDVI', result_interval=(0.0, 1.0), mask_feature=(FeatureType.MASK, 'IS_VALID'), unknown_value=10, scale_time=1), result_len=68, img_min=0.0, img_max=10.0, img_mean=0.720405, img_median=0.597656965), cls.InterpolationTestCase('cubic', CubicInterpolation('NDVI', result_interval=(0.0, 1.0), mask_feature=(FeatureType.MASK, 'IS_VALID'), resample_range=('2015-01-01', '2018-01-01', 16), unknown_value=5, bounds_error=False), result_len=69, img_min=0.0, img_max=5.0, img_mean=1.3592644, img_median=0.6174331), cls.InterpolationTestCase('spline', SplineInterpolation('NDVI', result_interval=(-0.3, 1.0), mask_feature=(FeatureType.MASK, 'IS_VALID'), resample_range=('2016-01-01', '2018-01-01', 5), spline_degree=3, smoothing_factor=0, unknown_value=0), result_len=147, img_min=-0.3, img_max=1.0, img_mean=0.492752, img_median=0.53776133), cls.InterpolationTestCase('bspline', BSplineInterpolation('NDVI', unknown_value=-3, mask_feature=(FeatureType.MASK, 'IS_VALID'), resample_range=('2017-01-01', '2017-02-01', 50), spline_degree=5), result_len=1, img_min=-0.032482587, img_max=0.701796, img_mean=0.42080238, img_median=0.42889267), cls.InterpolationTestCase('akima', AkimaInterpolation('NDVI', unknown_value=0, mask_feature=(FeatureType.MASK, 'IS_VALID')), result_len=68, img_min=-0.13793105, img_max=0.860242, img_mean=0.53159297, img_median=0.59087014), cls.InterpolationTestCase('kriging interpolation', KrigingInterpolation('NDVI', result_interval=(-10, 10), resample_range=('2016-01-01', '2018-01-01', 5)), result_len=147, img_min=-0.252500534, img_max=0.659086704, img_mean=0.3825493, img_median=0.39931053), cls.InterpolationTestCase('nearest resample', NearestResampling('NDVI', result_interval=(0.0, 1.0), resample_range=('2016-01-01', '2018-01-01', 5)), result_len=147, img_min=-0.2, img_max=0.860242, img_mean=0.35143828, img_median=0.37481314, nan_replace=-0.2), cls.InterpolationTestCase('linear resample', LinearResampling('NDVI', result_interval=(0.0, 1.0), resample_range=('2016-01-01', '2018-01-01', 5)), result_len=147, img_min=-0.2, img_max=0.8480114, img_mean=0.350186, img_median=0.3393997, nan_replace=-0.2), cls.InterpolationTestCase('cubic resample', CubicResampling('NDVI', result_interval=(-0.2, 1.0), resample_range=('2015-01-01', '2018-01-01', 16), unknown_value=5), result_len=69, img_min=-0.2, img_max=5.0, img_mean=1.234881997, img_median=0.465670556, nan_replace=-0.2), cls.InterpolationTestCase('linear custom list', LinearInterpolation( 'NDVI', result_interval=(-0.2, 1.0), resample_range=('2015-09-01', '2016-01-01', '2016-07-01', '2017-01-01', '2017-07-01'), unknown_value=-2), result_len=5, img_min=-0.032482587, img_max=0.8427637, img_mean=0.5108417, img_median=0.5042224), cls.InterpolationTestCase('linear with bands and multiple masks', LinearInterpolation('BANDS-S2-L1C', result_interval=(0.0, 1.0), unknown_value=10, mask_feature=[(FeatureType.MASK, 'IS_VALID'), (FeatureType.MASK_TIMELESS, 'RANDOM_UINT8'), (FeatureType.LABEL, 'RANDOM_DIGIT')]), result_len=68, img_min=0.000200, img_max=10.0, img_mean=0.34815648, img_median=0.1003600) ] cls.copy_feature_cases = [ cls.InterpolationTestCase('cubic_copy_success', CubicInterpolation('NDVI', result_interval=(0.0, 1.0), mask_feature=( FeatureType.MASK, 'IS_VALID'), resample_range=( '2015-01-01', '2018-01-01', 16), unknown_value=5, bounds_error=False, copy_features=[ (FeatureType.MASK, 'IS_VALID'), (FeatureType.DATA, 'NDVI', 'NDVI_OLD'), (FeatureType.MASK_TIMELESS, 'LULC'), ]), result_len=69, img_min=0.0, img_max=5.0, img_mean=1.3592644, img_median=0.6174331), cls.InterpolationTestCase('cubic_copy_fail', CubicInterpolation('NDVI', result_interval=(0.0, 1.0), mask_feature=(FeatureType.MASK, 'IS_VALID'), resample_range=( '2015-01-01', '2018-01-01', 16), unknown_value=5, bounds_error=False, copy_features=[ (FeatureType.MASK, 'IS_VALID'), (FeatureType.DATA, 'NDVI'), (FeatureType.MASK_TIMELESS, 'LULC'), ]), result_len=69, img_min=0.0, img_max=5.0, img_mean=1.3592644, img_median=0.6174331), ] for test_case in cls.test_cases: test_case.execute() for test_case in cls.copy_feature_cases: try: test_case.execute() except ValueError: pass
def setUpClass(cls): cls.test_cases = [ cls.InterpolationTestCase('linear', LinearInterpolation( 'ndvi', result_interval=(-0.3, -0.1), unknown_value=10), result_len=180, img_min=-0.3000, img_max=10.0, img_mean=-0.147169, img_median=-0.21132), cls.InterpolationTestCase( 'cubic', CubicInterpolation('ndvi', result_interval=(-0.3, -0.1), resample_range=('2015-01-01', '2018-01-01', 16), unknown_value=5), result_len=69, img_min=-0.3000, img_max=5.0, img_mean=1.30387, img_median=-0.1007357), cls.InterpolationTestCase( 'spline', SplineInterpolation('ndvi', result_interval=(-10, 10), resample_range=('2016-01-01', '2018-01-01', 5), spline_degree=3, smoothing_factor=0.5), result_len=147, img_min=-0.431703, img_max=0.116959, img_mean=-0.1948325, img_median=-0.1922528), cls.InterpolationTestCase('bspline', BSplineInterpolation( 'ndvi', unknown_value=-3, resample_range=('2017-01-01', '2017-02-01', 50), spline_degree=5), result_len=1, img_min=-0.161574, img_max=-0.0116416, img_mean=-0.085181, img_median=-0.0856696), cls.InterpolationTestCase('akima', AkimaInterpolation('ndvi', unknown_value=0), result_len=180, img_min=-0.4821199, img_max=0.2299331, img_mean=-0.20141865, img_median=-0.213559), cls.InterpolationTestCase( 'linear resample', LinearResampling('ndvi', result_interval=(-0.3, -0.1), resample_range=('2016-01-01', '2018-01-01', 5)), result_len=147, img_min=-0.3000, img_max=-0.1000, img_mean=-0.1946315, img_median=-0.20000, nan_replace=-0.2), cls.InterpolationTestCase( 'cubic resample', CubicResampling('ndvi', result_interval=(-0.3, -0.1), resample_range=('2015-01-01', '2018-01-01', 16), unknown_value=5), result_len=69, img_min=-0.3000, img_max=5.0, img_mean=1.22359, img_median=-0.181167, nan_replace=-0.2) ] for test_case in cls.test_cases: test_case.execute()