geetools.bitreader.BitReader#
- class geetools.bitreader.BitReader(options, bit_length=None)#
Bases:
object
Bit Reader.
Initializes with parameter options, which must be a dictionary with the following format:
keys must be a str with the bits places, example: ‘0-1’ means bit 0 and bit 1
values must be a dictionary with the bit value as the key and the category (str) as value. Categories must be unique.
Encode: given a category/categories return a list of possible values
Decode: given a value return a list of categories
Example
MOD09 (http://modis-sr.ltdri.org/guide/MOD09_UserGuide_v1_3.pdf) (page 28, state1km, 16 bits):
``` options = {
‘0-1’: {0:’clear’, 1:’cloud’, 2:’mix’}, ‘2-2’: {1:’shadow’}, ‘8-9’: {1:’small_cirrus’, 2:’average_cirrus’, 3:’high_cirrus’} }
reader = BitReader(options, 16)
print(reader.decode(204))
` >>['shadow', 'clear'] `
print(reader.match(204, ‘cloud’) ``` >>FalseTODO missing docstring.
Methods#
|
given a value return a list with all categories. |
|
Get an Image with one band per category in the Bit Reader. |
|
decodes an option's key into a list. |
|
Given a category, return the encoded value (only). |
|
Decodes a combination of the given categories. returns a list of. |
|
Make an image in which all pixels have the value for the given. |
|
Given a set of categories return a list of values that DO NOT. |
|
Given a category, return a list of values that match it. |
|
Decodes a combination of the given categories. returns a list of. |
|
from https://stackoverflow.com/questions/699866/python-int-to-binary. |
|
given a value and a category return True if the value includes. |