eebit.bithandler#

bit handler.

Classes#

BitHandler

Bit handler.

Module Contents#

class eebit.bithandler.BitHandler(bits, bit_length=None)[source]#

Bit handler.

Read / decode / write bits information encoded in Google Earth Engine images.

Parameters:
  • bits (where "catname" is the name of the whole category represented by the group of) – a dictionary containing the bits information in the following format:

  • { (bits =) –

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

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

    } # option 2, 2 or more bits.

  • bits

  • band (Example (Landsat 9 QA_PIXEL) – https://developers.google.com/earth-engine/datasets/catalog/LANDSAT_LC09_C02_T1_L2#bands)

  • {

    “3-Cloud”: “Cloud”, “4-Cloud Shadow”: “Cloud Shadow”, “5”: “Snow”, “7”: “Water”, “8-9”: {

    ”1”: “Clouds Low Prob”, “2”: “Clouds Medium Prob”, “3”: “Clouds High Prob”

    }, “10-11”: {

    ”1”: “Shadow Low Prob”, “2”: “Shadow Medium Prob”, “3”: “Shadow High Prob”

    }

  • }

  • bit_length (int | None) – the length of the

decode_image(image, band=0)[source]#

Decode a bit band of an ee.Image.

The band of the image must correspond to the bits of the BitHandler object.

Parameters:
  • image (ee.Image) – the image that contains the band to decode.

  • band (optional) – the bit band. If None it uses the first band of the image.

Returns:

A new image with one band per class. The image properties ara NOT passed to the new image.

Return type:

ee.Image

classmethod from_asset(asset_id, band, bit_length=None)[source]#

Create an instance of BitHandler using the bits information fetched with geestac.

Parameters:
  • asset_id (str)

  • band (str)

  • bit_length (int | None)

Return type:

BitHandler

_all_bits = None[source]#
property all_bits: list[source]#

List of all bits.

Return type:

list

bit_length[source]#
bits[source]#