Update evalscripts to use the newly supplied units
@@ -11,7 +11,7 @@ import pytest
from pytest import approx
import numpy as np
-from sentinelhub import BBox, CRS, DataCollection, SHConfig
+from sentinelhub import BBox, CRS, DataCollection, SHConfig, Band, Unit
from eolearn.core import EOPatch, FeatureType, EOTask
from eolearn.io import (
SentinelHubDemTask, SentinelHubEvalscriptTask, SentinelHubInputTask, SentinelHubSen2corTask,
@@ -392,10 +392,15 @@ class TestSentinelHubInputTaskDataCollections:
mask_feature = FeatureType.MASK, 'dataMask'
s3slstr_500m = DataCollection.SENTINEL3_SLSTR.define_from(
- 'SENTINEL3_SLSTR_500m', bands=('S2', 'S3', 'S6')
+ 'SENTINEL3_SLSTR_500m',
+ bands=(
+ Band('S2', (Unit.REFLECTANCE,), (np.float32,)),
+ Band('S3', (Unit.REFLECTANCE,), (np.float32,)),
+ Band('S6', (Unit.REFLECTANCE,), (np.float32,))
+ )
)
s5p_co = DataCollection.SENTINEL5P.define_from(
- 'SENTINEL5P_CO', bands=('CO',)
+ 'SENTINEL5P_CO', bands=(Band('CO', (Unit.DN,), (np.float32,)),)
)
ndvi_evalscript = """
@@ -512,7 +517,7 @@ class TestSentinelHubInputTaskDataCollections:
time_interval=time_interval,
data_size=2,
timestamp_length=1,
- stats=[0.0406, 0.0206, 0.0216]
+ stats=[0.0407, 0.0206, 0.0216]
),
IoTestCase(
name='Sentinel-1 EW DESCENDING',
@@ -527,7 +532,7 @@ class TestSentinelHubInputTaskDataCollections:
time_interval=time_interval,
data_size=2,
timestamp_length=1,
- stats=[np.nan, 0.1944, 0.3799]
+ stats=[np.nan, 0.1944, 0.3800]
),
IoTestCase(
name='Sentinel-3 OLCI',
@@ -542,7 +547,7 @@ class TestSentinelHubInputTaskDataCollections:
time_interval=time_interval,
data_size=21,
timestamp_length=11,
- stats=[0.2375, 0.1736, 0.2538]
+ stats=[0.317, 0.1946, 0.2884]
),
# The following test doesn't work at the moment
# IoTestCase(
@@ -591,6 +596,5 @@ class TestSentinelHubInputTaskDataCollections:
assert all(timestamp.tzinfo is None for timestamp in timestamps), f'`tzinfo` present in timestamps {timestamps}'
assert len(timestamps) == test_case.timestamp_length
- data = eopatch[(test_case.feature_type, test_case.feature)]
stats = calculate_stats(data)
assert stats == approx(test_case.stats, nan_ok=True), f'Expected stats {test_case.stats}, got {stats}'
