Commit d25fd7ea authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Merge branch 'master' into bugfix/fix_nodata_issue_within_spechomo

parents a7729135 1ff121c6
Pipeline #3181 passed with stage
in 17 minutes and 33 seconds
......@@ -186,7 +186,7 @@ class SpectralHomogenizer(object):
self.logger = None
def interpolate_cube(self, arrcube, source_CWLs, target_CWLs, kind='linear'):
# type: (Union[np.ndarray, GeoArray], list, list) -> np.ndarray
# type: (Union[np.ndarray, GeoArray], list, list, str) -> np.ndarray
"""Spectrally interpolate the spectral bands of a remote sensing image to new band positions.
:param arrcube: array to be spectrally interpolated
......@@ -407,7 +407,7 @@ class SpectralResampler(object):
return np.array(spectrum_rsp)
def resample_spectra(self, spectra, chunksize=200, CPUs=None):
# type: (Union[GeoArray, np.ndarray], int) -> np.ndarray
# type: (Union[GeoArray, np.ndarray], int, Union[None, int]) -> np.ndarray
"""Resample the given spectral signatures according to the spectral response functions of the target instrument.
:param spectra: spectral signatures, provided as 2D array
......@@ -430,7 +430,7 @@ class SpectralResampler(object):
return spectra_rsp
def resample_image(self, image_cube, tiledims=(20, 20), CPUs=None):
# type: (Union[GeoArray, np.ndarray], tuple) -> np.ndarray
# type: (Union[GeoArray, np.ndarray], tuple, Union[None, int]) -> np.ndarray
"""Resample the given spectral image cube according to the spectral response functions of the target instrument.
:param image_cube: image (3D array) containing the spectral information in the third dimension
......@@ -477,7 +477,7 @@ class SpectralResampler(object):
class KMeansRSImage(object):
"""Class for clustering a given input image by using K-Means algorithm."""
def __init__(self, im, n_clusters, CPUs=1, v=False):
# type: (GeoArray, int) -> None
# type: (GeoArray, int, Union[None, int], bool) -> None
# privates
self._clusters = None
......@@ -790,9 +790,9 @@ class ReferenceCube_Generator(object):
@property
def refcubes(self):
# type: () -> Dict[Tuple[str, str]: RefCube]
"""Return a dictionary holding instances of RefCube for each target satellite / sensor of self.tgt_sat_sen_list.
"""
# type: () -> Dict[Tuple[str, str]: RefCube]
if not self._refcubes:
# fill self._ref_cubes with GeoArray instances of already existing reference cubes read from disk
......@@ -850,7 +850,7 @@ class ReferenceCube_Generator(object):
return SRF(self._get_tgt_GMS_identifier(tgt_sat, tgt_sen), no_pan=False)
def generate_reference_cubes(self, fmt_out='ENVI', progress=True):
# type: (str, bool) -> self.refcubes
# type: (str, bool) -> ReferenceCube_Generator.refcubes
"""Generate reference spectra from all hyperspectral input images.
Workflow:
......@@ -1191,7 +1191,6 @@ class RefCube(object):
:param fmt: output format as GDAL format code
:return:
"""
# type: (str, str) -> None
self.data.save(out_path=path_out, fmt=fmt)
# save metadata as JSON file
......
......@@ -73,7 +73,7 @@ class MinimumDistance_Classifier(_ImageClassifier):
class kNN_Classifier(_ImageClassifier):
def __init__(self, train_spectra, train_labels, CPUs=1, n_neighbors=10):
# type: (np.ndarray, Union[np.ndarray, List[int]], int) -> None
# type: (np.ndarray, Union[np.ndarray, List[int]], int, int) -> None
super(kNN_Classifier, self).__init__(train_spectra, train_labels, CPUs=CPUs)
self.clf = KNeighborsClassifier(n_neighbors=n_neighbors, n_jobs=CPUs)
......
......@@ -176,7 +176,7 @@ def get_list_GMSfiles(dataset_list, target):
def SRF_reader(GMS_id, no_thermal=None, no_pan=None, v=False):
# type: (GMS_identifier, bool) -> collections.OrderedDict
# type: (GMS_identifier, bool, bool, bool) -> collections.OrderedDict
"""Read SRF for any sensor and return a dictionary containing band names as keys and SRF numpy arrays as values.
:param GMS_id:
......@@ -217,7 +217,7 @@ def SRF_reader(GMS_id, no_thermal=None, no_pan=None, v=False):
class SRF(object):
def __init__(self, GMS_id=None, wvl_unit='nanometers', specres_nm=1, format_bandnames=False,
no_thermal=None, no_pan=None, v=False):
# type: (GMS_identifier, str, float, bool, bool) -> None
# type: (GMS_identifier, str, float, bool, bool, bool, bool) -> None
"""SRF instance provides SRF functions, wavelength positions, etc..
:param GMS_id: GMS_identifier as provided by GMS_object
......
......@@ -315,7 +315,7 @@ def increment_decrement_arrayCol_in_postgreSQLdb(conn_params, tablename, col2upd
def create_record_in_postgreSQLdb(conn_params, tablename, vals2write_dict, timeout=15000):
# type: (str, str, dict, dict, int) -> Union[int, str]
# type: (str, str, dict, int) -> Union[int, str]
"""Creates a single new record in a postgreSQL database and pupulates its columns with the given values.
:param conn_params: <str> connection parameters as provided by CFG.conn_params
......@@ -345,7 +345,7 @@ def create_record_in_postgreSQLdb(conn_params, tablename, vals2write_dict, timeo
def delete_record_in_postgreSQLdb(conn_params, tablename, record_id, timeout=15000):
# type: (str, str, dict, dict, int) -> Union[int, str]
# type: (str, str, dict, int) -> Union[int, str]
"""Delete a single record in a postgreSQL database.
:param conn_params: <str> connection parameters as provided by CFG.conn_params
......
......@@ -1188,7 +1188,7 @@ class GMS_object(object):
@classmethod
def from_tiles(cls, list_GMS_tiles):
# type: (list) -> cls
# type: (list) -> GMS_object
"""Merge separate GMS objects with different spatial coverage but belonging to the same scene-ID to ONE GMS object.
:param list_GMS_tiles: <list> of GMS objects that have been created by cut_GMS_obj_into_blocks()
......@@ -1254,7 +1254,7 @@ class GMS_object(object):
def get_subset_obj(self, imBounds=None, mapBounds=None, mapBounds_prj=None, out_prj=None, logmsg=None,
progress=False, v=False):
# type: (tuple) -> self
# type: (tuple, tuple, str, str, str, bool, bool) -> GMS_object
"""Returns a subset of the given GMS object, based on the given bounds coordinates.
Array attributes are clipped and relevant metadata keys are updated according to new extent.
......@@ -1626,7 +1626,7 @@ class GMS_object(object):
self.MetaObj.to_odict(), overwrite=overwrite)
def to_tiles(self, blocksize=(2048, 2048)):
# type: (tuple) -> self
# type: (tuple) -> GMS_object
"""Returns a generator object where items represent tiles of the given block size for the GMS object.
# NOTE: it's better to call get_subset_obj (also takes care of tile map infos)
......@@ -1646,7 +1646,7 @@ class GMS_object(object):
yield tileObj
def to_MGRS_tiles(self, pixbuffer=10, v=False):
# type: (int) -> self
# type: (int, bool) -> GMS_object
"""Returns a generator object where items represent the MGRS tiles for the GMS object.
:param pixbuffer: <int> a buffer in pixel values used to generate an overlap between the returned MGRS tiles
......@@ -2319,7 +2319,7 @@ class failed_GMS_object(GMS_object):
class finished_GMS_object(GMS_object):
def __init__(self, GMS_obj):
# type: (GMS_obj) -> None
# type: (GMS_object) -> None
super(finished_GMS_object, self).__init__()
self.proc_level = GMS_obj.proc_level
self.image_type = GMS_obj.image_type
......
......@@ -1869,7 +1869,7 @@ map_odictKeys_objAttrnames = {
def get_LayerBandsAssignment(GMS_id, nBands=None, sort_by_cwl=None, no_thermal=None, no_pan=None,
return_fullLBA=False, proc_level=''):
# type: (GMS_identifier, int, bool, bool) -> list
# type: (GMS_identifier, int, bool, bool, bool, bool, str) -> list
"""Returns LayerBandsAssignment corresponding to given satellite, sensor and subsystem and with respect to
CFG.sort_bands_by_cwl, CFG.skip_thermal and CFG.skip_pan.
......@@ -2032,7 +2032,7 @@ def get_bands_after_AC(GMS_id):
def get_center_wavelengths_by_LBA(satellite, sensor, LBA, subsystem=None):
# type: (str, str, list) -> List[float]
# type: (str, str, list, str) -> List[float]
"""Returns a list of center wavelengths of spectral bands for the given satellite/sensor/LayerBandsAss. combination.
:param satellite: target satellite (e.g., 'Sentinel-2A')
......
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