eebit.helpers#

Helper functions.

Attributes#

Functions#

format_bandname(name[, replacement])

Format a band name to be allowed in GEE.

format_bit_key(bit)

Format a bit key.

format_bit_value(value)

Format a bit value.

format_bits_info(bits_info)

Format the bits information to match the expected.

is_int(value)

Check if a string can be converted to an integer.

is_str(value)

Check if a value is a string.

Module Contents#

eebit.helpers.format_bandname(name, replacement='_')[source]#

Format a band name to be allowed in GEE.

Parameters:
  • name (str)

  • replacement (str)

Return type:

str

eebit.helpers.format_bit_key(bit)[source]#

Format a bit key.

Parameters:

bit (str)

Return type:

str

eebit.helpers.format_bit_value(value)[source]#

Format a bit value.

Parameters:

value (str | dict)

Return type:

dict

eebit.helpers.format_bits_info(bits_info)[source]#

Format the bits information to match the expected.

Expected bit class format: {

“1-1-catname”: “category”, # option 1, one category “2-2-catname”: {

“0”: “cat1”, “1”: “cat2”

}, # option 2, 2 or more bits. “3-4-catname”: {

“0”: “cat1”, “1”: “cat2”, “2”: “cat3”, “3”: “cat4”

} # option 2, 2 or more bits.

}

Parameters:

bits_info (dict) – the bits information.

Return type:

dict

Example

from geetools.utils import format_bitmask

bitmask = {
    '0-shadows condition': 'shadows',
    '1-2-cloud conditions': {
        '0': 'no clouds',
        '1': 'high clouds',
        '2': 'mid clouds',
        '3': 'low clouds'
    }
}
bitmask = format_bitmask(bitmask)
eebit.helpers.is_int(value)[source]#

Check if a string can be converted to an integer.

Parameters:

value (str | int)

Return type:

bool

eebit.helpers.is_str(value)[source]#

Check if a value is a string.

Parameters:

value (str)

Return type:

bool

eebit.helpers.BANNED_BAND_CHAR = ['.', '*', '?', '[', ']', '{', '}', '+', '$', '^', '+', '(', ')', '|'][source]#