Skip to main content

index

Objects

BaseInput

@dataclass
class BaseInput()

Base input event.

Attributes:

  • job_id str - the job ID.
  • prefix str - object path to the file.
  • options Options, optional - input raster creation options.
  • type Literal["rgb", "infrared", "multispectral"] - choose the sensor type. Defaults to rgb.
  • tile str - input imagery tile.
  • clip_shape str, optional - input path to geometry used to clip the results.
  • index str, optional - input vegetation index name. Collect the list using the vi_list switch. Defaults depend on the type chosen.
  • layername str, optional - name of the layer. Defaults to "vegetationindex".
  • mask str, optional - use a mask layer to only calculate pixels on that mask layer. Defaults to "".
  • vi_list bool, optional - Switch to only show the list of VI. Defaults to False.

dict

def dict() -> dict

Convert dataclass to dictionary.

Returns:

  • dict - dataclass as dictionary.

Functions

lambda_handler

@tracer.capture_lambda_handler
@logger.inject_lambda_context()
def lambda_handler(event: dict, context: dict) -> dict

Lambda handler to process vegetation indices. User provides the sensor type and index. Vegetation indices are used in different use cases depending on which "performance" is indexed. Possible indices can be found in vi.py readme. All values are normalised between -1 and 1 according to scientific purposes. Indices that do not fall within this range cannot be compared with each other on performance index. Be mindfull, a estimated chlorophyll performance should never be compared with an index sensitive to background soil pixels (red. SAVI), since both approximate a certain performance unrelated to each other. So don't be funny. In the general sense, the output is an index, do not treat this as empirical or concrete values.

Arguments:

  • event dict - Input event, should fit BaseInput.
  • context dict - Request context used for authentication.

Returns:

  • dict - Output event with updated prefix for output tile. With the vi_list switch it will return an object with possible vegetation index names.

Examples:

A generic example.

{
"job_id": "some-job-id",
"prefix": "prefix/of/source/",
"tile": "some-tile",
"index": "some-vegetationindex",
"type": "source-type"
}

A lambda invocation example.

{
"job_id": "20211213122100-1336-983475iubf934hvc39p4hf",
"prefix": "02_data/01_clients/001_AAA_project/14/01_data/01_aerial/01_rgb/20200908/",
"layername": "vegetationindex",
"tile": "20200701_RGB-6-6.tiff",
"index": "vari",
"type": "rgb",
"clip_shape": "02_data/01_clients/001_AAA_project/14/01_data/06_plantation/04_farmblocks/20200908/20200908_farmblocks.shp",
"options": {
"COMPRESS": "DEFLATE",
"TILED": "YES"
}
}

A Step Function internal example.

{
"job_id": "20211213122100-1336-983475iubf934hvc39p4hf",
"prefix": "02_data/01_clients/001_AAA_project/14/01_data/01_aerial/01_rgb/20200908/",
"layername": "vegetationindex",
"tile": "02_data/01_clients/001_AAA_project/14/01_data/01_aerial/01_rgb/20200908/20200701_NIR-6-6.tiff",
"index": "ndvi",
"type": "nir"
}

The following example will return all possible vegetation indices.

{
"vi_list": true
}