Submodules module

GeoMultiSens Input Reader: Universal reader for all kinds of GeoMultiSens intermediate results.

class'SRTM', db_conn='', logger=None)[source]

Bases: object

Creator class for digital elevation models based on ASTER or SRTM.

  • dem_sensor – ‘SRTM’ or ‘ASTER’

  • db_conn – database connection string

from_extent(cornerCoords_tgt, prj, tgt_xgsd, tgt_ygsd)[source]

Returns a GeoArray of a DEM according to the given target coordinates

  • cornerCoords_tgt – list of target coordinates [[X,Y], [X,Y], …]] (at least 2 coordinates)

  • prj – WKT string of the projection belonging cornerCoords_tgt

  • tgt_xgsd – output X GSD

  • tgt_ygsd – output Y GSD


DEM GeoArray

get_overlapping_DEM_tiles(tgt_corner_coord_lonlat, timeout_sec=30, use_index_mediator=True)[source]

Get the overlapping DEM tiles for the given extent.

  • tgt_corner_coord_lonlat (List[Tuple]) – list of longitude/latitude target coordinates [[X,Y], [X,Y], …]]

  • timeout_sec (int) – database query timeout (seconds)

  • use_index_mediator (bool) – whether to use or not to use the SpatialIndexMediator (default: True)

Return type



list of matching DEM tile scene IDs[source]

Converts a JSON file (like the GMS file) to a Python dictionary with keys and values.


path_GMSfile – absolute path on disk


the corresponding Python dictionary, no_thermal=None, no_pan=None, v=False)[source]

Read SRF for any sensor and return a dictionary containing band names as keys and SRF numpy arrays as values.

  • GMS_id (GMS_identifier) –

  • no_thermal (bool) – whether to exclude thermal bands from the returned bands list (default: CFG.skip_thermal)

  • no_pan (bool) – whether to exclude panchromatic bands from the returned bands list (default: CFG.skip_pan)

  • v (bool) – verbose mode

Return type

collections.OrderedDict, wvl_min_nm=None, wvl_max_nm=None)[source]

Read the solar irradiance file and return an array of irradiances.

  • resol_nm – spectral resolution for returned irradiances [nanometers]

  • wvl_min_nm – minimum wavelength of returned irradiances [nanometers]

  • wvl_max_nm – maximum wavelength of returned irradiances [nanometers]

Returns, target)[source]

Returns a list of absolute paths pointing to gms-files of truely written datasets that fullfill certain criteria.

  • dataset_list – [dataset1_dictionary, dataset2_dictionary]

  • target – target GMS processing level

:return [/path/to/gms_file1.gms, /path/to/gms_file1.gms], matching_expression, read_mode='r')[source]

Finds a specific file within an archive using a given matching expression and returns its content as string.

  • path_archive (str) – the file path of the archive

  • matching_expression (str) – the matching expession to find the file within the archive

  • read_mode (str) – the read mode used to open the archive (default: ‘r’)

Return type

(str, str)


tuple(content_file, filename_file), dir_out)[source], arr_shape, arr_pos, logger=None, return_meta=False, q=0)[source]

Read ENVI image data as array using a specified read pattern.

  • path – <str> Path of the ENVI image or header file

  • arr_shape – <str> ‘cube’,’row’,’col’,’band’,’block’,’pixel’ or ‘custom’

  • arr_pos

    None, <int> or <list>. The content of the list depends on the chosen arr_shape as follows: - ‘cube’: No array position neccessary. Set arr_pos to None. - ‘row’: single int. -> Row with this index will be read. - ‘col’: single int. -> Column with this index will be read. - ‘band’: single int. -> Band with this index will be read. - ‘block’: row_bounds (2-tuple of ints): (a, b) -> Rows a through b-1 will be read.

    col_bounds (2-tuple of ints): (a, b) -> Columns a through b-1 will be read.

    • ’pixel’: row, col (int): Indices of the row & column for the pixel to be read.

    • ’custom’: row_bounds (2-tuple of ints): (a, b) -> Rows a through b-1 will be read.

      col_bounds (2-tuple of ints): (a, b) -> Columns a through b-1 will be read. bands (list of ints): Optional list of bands to read.

      If not specified, all bands are read.

  • logger – <instance> of logging.logger (optional)

  • return_meta – <bool> whether to return not only raster data but also meta data (optional, default=False)

  • q – <bool> quiet mode (supresses all console or logging output) (optional, default=False), arr_shape, arr_pos, logger=None, return_meta=False, q=0)[source], logger=None)[source]
Return type

dict, bandname, logger, subset=None)[source][source]

Ensures the compatibility of ENVI header keys written by Spectral-Python the code internal attribute names. (ENVI header keys are always lowercase in contrast to the attribute names used in code).


header_dict module

Output writer: Universal writer for all kinds of GeoMultiSens intermediate results., outpath_hdr, logger=None)[source], out_path, out_shape, out_dtype, out_interleave, out_meta=None, arr_pos=None, overwrite=True)[source]

Write tiles to disk using numpy.memmap.

  • tileList_or_Array – <list of dicts> each dict has keys ‘row_start’,’row_end’,’col_start’,’col_end’,’data’ <numpy array> representing a subset of a full array. requires arr_pos

  • out_path – <str> path to ENVI header file *.hdr

  • out_shape – <tuple or list> (rows,cols,bands)

  • out_dtype – <object> numpy data type object

  • out_interleave – <str> ‘bsq’,’bil’ or ‘bip’

  • out_meta – <dict> metadata dictionary to be written to header

  • arr_pos – <tuple> ((row_start,row_end),(col_start,col_end))

  • overwrite – <bool>, class_names, class_colors=None, data=None)[source]

Prepare ENVI metadata dict. to be written as ENVI classification file by adding custom class names and colors.

  • meta (dict) – <dict> ENVI metadata dictionary

  • class_names (list) – <list> of strings with the class names

  • class_colors (Optional[dict]) – <dict> with keys representing class names and values representing 3-tuples with RGB codes

  • data (Optional[ndarray]) – <numpy array> only used to estimate number of classes if class_names is None

Return type

dict, hdr_path)[source][source]'/builds/geomultisens/gms_preprocessing/gms_preprocessing/sandbox/out/SRF_DB.pkl', outpath_log='/builds/geomultisens/gms_preprocessing/gms_preprocessing/sandbox/out/SRF_DB.log')[source][source][source], maskname)[source]
Return type

(np.ndarray, dict, list, list), tgt_keyOrder)[source]

Reorders the keys of an ENVI header file according to the implemented order. Keys given in the target order list but missing the ENVI fileare skipped. This function is a workaround for envi.write_envi_header of Spectral Python Library that always writes the given metadata dictinary as an unordered dict.

  • path_hdr (str) – <str> path of the target ENVI file

  • tgt_keyOrder (list) – <list> list of target keys in the correct order

Return type

None, nodataVal=None)[source]

Sets the no data value of an already written file

  • arr_path

  • nodataVal

Returns, data, header, **kwargs)[source]

Monkeypatch for in order to silence output stream., ndarray, meta, interleave='bsq')[source], list__IO_time__all_runs, data_list)[source], header_dict, is_library=False)[source]

Monkeypatch for in order to write ordered output headers, shapely_geom, prj=None, attrDict=None)[source], path_out, prj=None)[source]

Module contents