utils#
This module contains usefull functions commons to every modules.
- sen2chain.utils.format_word(word: str) str#
Formats a word to lower case and removes heading and trailing spaces.
- Parameters:
word – a string to format.
- sen2chain.utils.grouper(iterable, n: int, fillvalue: bool | None = None) Iterable#
Collects data into fixed-length chunks or blocks.
- Parameters:
iterable – an iterable.
n – number of items per chunk/block.
fillvalue – replacing value for missing items in the chunk.
- sen2chain.utils.str_to_datetime(date_string: str, date_format: str) datetime#
Returns a datetime object from a string according to a format.
- Parameters:
date_string – string to format.
date_format – date format.
- sen2chain.utils.datetime_to_str(date: datetime, date_format: str) str#
Returns a string from a datetime object according to a format.
- Parameters:
date – string to format.
date_format – date format.
- sen2chain.utils.human_size(bytes, units=['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'])#
Returns a human readable string reprentation of bytes
- sen2chain.utils.get_tile(identifier) str#
Returns tile name from a string.
- Parameters:
string – string from which to extract the tile name.
- sen2chain.utils.get_Sen2Cor_version(path: str | PosixPath | None = None)#
Returns - the Sen2Cor version if a Sen2Cor path is provided, None if not
- sen2chain.utils.get_Sen2Cor_versions()#
Returns - all configured Sen2Cor versions
- sen2chain.utils.get_latest_Sen2Cor_version()#
Returns your latest Sen2Cor version
- sen2chain.utils.get_latest_Sen2Cor_version_from_id(l1c_identifier)#
Returns the latest Sen2Cor version matching the l1c identifier
- sen2chain.utils.get_cm_version(identifier) dict#
Returns cloudmask version from a cloud mask identifier string. :param identifier: string from which to extract the version name.