Commit 76d06abe authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Bugfix within test_spechomo_classifier.py. Fixed wrong version of pycodestyle. Fixed linting.

parent 23a920a8
Pipeline #3060 failed with stage
in 17 minutes and 58 seconds
...@@ -51,6 +51,7 @@ test_styles: ...@@ -51,6 +51,7 @@ test_styles:
- source /root/miniconda3/bin/activate - source /root/miniconda3/bin/activate
- export GDAL_DATA=/root/miniconda3/share/gdal - export GDAL_DATA=/root/miniconda3/share/gdal
- export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later - export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later
- pip install pycodestyle<2.4.0 # TODO remove as soon as docker runner is recreated
- make lint - make lint
artifacts: artifacts:
paths: paths:
......
...@@ -1308,13 +1308,14 @@ class ClusterClassifier_Generator(object): ...@@ -1308,13 +1308,14 @@ class ClusterClassifier_Generator(object):
@staticmethod @staticmethod
def cluster_refcube_spectra(cube2cluster, n_clusters=50, CPUs=24): def cluster_refcube_spectra(cube2cluster, n_clusters=50, CPUs=24):
# type: (RefCube, int, int) -> np.ndarray # type: (Union[RefCube, str], int, int) -> np.ndarray
"""Generate cluster labels for the given reference cube. """Generate cluster labels for the given reference cube.
:param cube2cluster: reference cube to be clustered :param cube2cluster: reference cube to be clustered
:param n_clusters: number of clusters to be used for KMeans clustering :param n_clusters: number of clusters to be used for KMeans clustering
:param CPUs: number of CPUs to be used for KMeans clustering :param CPUs: number of CPUs to be used for KMeans clustering
""" """
cube2cluster = RefCube(cube2cluster) if isinstance(cube2cluster, str) else cube2cluster
# use this refcube for KMeans clustering # use this refcube for KMeans clustering
km = KMeansRSImage(cube2cluster.data, n_clusters=n_clusters, CPUs=CPUs) km = KMeansRSImage(cube2cluster.data, n_clusters=n_clusters, CPUs=CPUs)
......
...@@ -2040,7 +2040,7 @@ def get_center_wavelengths_by_LBA(satellite, sensor, LBA, subsystem=None): ...@@ -2040,7 +2040,7 @@ def get_center_wavelengths_by_LBA(satellite, sensor, LBA, subsystem=None):
:param LBA: LayerBandsAssignment :param LBA: LayerBandsAssignment
:param subsystem: target sensor subsystem (e.g., 'VNIR') :param subsystem: target sensor subsystem (e.g., 'VNIR')
""" """
from ..model.gms_object import GMS_identifier # would cause circular import from ..model.gms_object import GMS_identifier # noqa F811 # (redefinition) # would cause circular import
srf = SRF(GMS_identifier(satellite=satellite, sensor=sensor, subsystem=subsystem, image_type='RSD', srf = SRF(GMS_identifier(satellite=satellite, sensor=sensor, subsystem=subsystem, image_type='RSD',
dataset_ID=-9999, proc_level='L1A', logger=None), dataset_ID=-9999, proc_level='L1A', logger=None),
......
...@@ -50,7 +50,7 @@ dependencies: ...@@ -50,7 +50,7 @@ dependencies:
- six - six
- spectral - spectral
- flake8 - flake8
- pycodestyle - pycodestyle<2.4.0 # fixes ImportError: module 'pycodestyle' has no attribute 'break_around_binary_operator'
- pylint - pylint
- pydocstyle - pydocstyle
- nose - nose
......
...@@ -126,7 +126,7 @@ class Test_ClusterClassifier_Generator(unittest.TestCase): ...@@ -126,7 +126,7 @@ class Test_ClusterClassifier_Generator(unittest.TestCase):
def test_cluster_refcube_spectra(self): def test_cluster_refcube_spectra(self):
CCG = ClusterClassifier_Generator([refcube_l8, refcube_l5]) CCG = ClusterClassifier_Generator([refcube_l8, refcube_l5])
CCG.cluster_refcube_spectra(n_clusters=5) CCG.cluster_refcube_spectra(cube2cluster=refcube_l8, n_clusters=5)
def test_create_classifiers_LR(self): def test_create_classifiers_LR(self):
"""Test creation of linear regression classifiers.""" """Test creation of linear regression classifiers."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment