enpt.utils package

Submodules

enpt.utils.logging module

EnPT logging module containing logging related classes and functions.

class enpt.utils.logging.EnPT_Logger(name_logfile: str, fmt_suffix: any = None, path_logfile: str = None, log_level: any = 'INFO', append: bool = True)[source]

Bases: Logger

Class for the EnPT logger.

Return a logging.logger instance pointing to the given logfile path.

Parameters:
  • name_logfile

  • fmt_suffix – if given, it will be included into log formatter

  • path_logfile – if no path is given, only a StreamHandler is created

  • log_level – the logging level to be used (choices: ‘DEBUG’, ‘INFO’, ‘WARNING’, ‘ERROR’, ‘CRITICAL’; default: ‘INFO’)

  • append – <bool> whether to append the log message to an existing logfile (1) or to create a new logfile (0); default=1

property captured_stream: str

Return the already captured logging stream.

NOTE:
  • set self.captured_stream:

    self.captured_stream = ‘any string’

close()[source]

Close all logging handlers.

view_logfile()[source]

View the log file written to disk.

class enpt.utils.logging.LessThanFilter(exclusive_maximum, name='')[source]

Bases: Filter

Filter class to filter log messages by a maximum log level.

Based on http://stackoverflow.com/questions/2302315/

how-can-info-and-debug-logging-message-be-sent-to-stdout-and-higher-level-messag

Get an instance of LessThanFilter.

Parameters:
  • exclusive_maximum – maximum log level, e.g., logger.WARNING

  • name

filter(record)[source]

Filter funtion.

NOTE: Returns True if logging level of the given record is below the maximum log level.

Parameters:

record

Returns:

bool

enpt.utils.logging.close_logger(logger)[source]

Close the handlers of the given logging.Logger instance.

Parameters:

logger – logging.Logger instance or subclass instance

enpt.utils.logging.shutdown_loggers()[source]

Shutdown any currently active loggers.

enpt.utils.path_generator module

EnPT path generator module for generating file paths for all kinds of EnMAP images.

class enpt.utils.path_generator.PathGenL1BProduct(root_dir: str, detector_name: str)[source]

Bases: object

Path generator class for generating file pathes corresponding to the EnMAP L1B product.

Get an instance of the EnPT L1B image path generator.

Parameters:
  • root_dir

  • detector_name

_find_in_metaxml(expression)[source]
get_path_cloudmask()[source]

Return the path of the cloud mask file.

get_path_data()[source]

Return the path of the image data file.

get_path_deadpixelmap()[source]

Return the path of the dead pixel mask file.

get_path_metaxml()[source]

Return the path of the metadata XML file.

get_path_quicklook()[source]

Return the path of the quicklook file.

enpt.utils.path_generator.get_path_ac_options() str[source]

Return the path of the options json file needed for atmospheric correction.

Module contents

EnPT ‘utils’ module containing utilities that are used in the whole EnPT package.