Skip to main content

index

Objects

BaseInput

class BaseInput(BaseModel)

Base input event.

Arguments:

  • BaseModel BaseModel - inherited from pydantic.

Attributes:

  • workspace str - name of the workspace.
  • layername str - name of the layer.
  • date str, optional - date in %YYYYmmDD format.
  • datatype str - type of layer, defaults to "layer:s3_url"
  • description str, optional - description of the layer.
  • style dict, optional - input styling definitions.
  • zone str | int, optional - force publication to happen on another target zone ID.
  • prefix str, optional - input prefix to find source files. databases block you.

Returns:

  • _type_ - description

is_none_with_prefix

@model_validator(mode="before")
@classmethod
def is_none_with_prefix(cls, data: dict)

Attempt to fix incoming data when date and prefix aren't present

Arguments:

  • data dict - input data

Raises:

  • ValueError - raised when required input is invalid.

Returns:

  • dict - fixed data

StatisticsResponse

class StatisticsResponse(BaseModel)

Response data class of Raster Tiler Statistics

Arguments:

  • BaseModel BaseModel - inherited from pydantic.

Attributes:

  • min Decimal - minimum value in raster
  • max Decimal - maximum value in raster
  • mean Decimal - mean value of raster
  • count int - number of pixels
  • sum int, Decimal - sum of values in raster
  • std Decimal - standard deviation of raster values
  • median Decimal - median of raster values
  • majority Decimal - most frequent value in raster
  • minority Decimal - least frequent value in raster
  • unique int - number of unique values in raster
  • histogram list of list of Decimal - the histogram
  • valid_percent Decimal - percentage of valid pixels
  • masked_pixels int - number of hidden pixels
  • valid_pixels int - number of valid pixels
  • percentile_2 Decimal - 2% percentile of raster values
  • percentile_98 Decimal - 98% percentile of raster values

get_published_key

def get_published_key(workspace: str, layername: str, date: str) -> str

Function to get the publication object path in AWS S3

Arguments:

  • workspace str - name of the workspace.
  • layername str - name of the layer.
  • date str - date in %YYYYmmDD format.

Raises:

  • FileExistsError - raised if object path already exists
  • FileNotFoundError - raised if COG file cannot be found

Returns:

  • str - object path

Examples:

get_published_key = {
workspace="some-workspace",
layername="some-layer",
date="20210201"
}

Functions

lambda_handler

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

Lambda handler that deals with publication of raster data

Arguments:

  • event dict - input event, must be convertable to BaseInput
  • context dict - contains authentication information

Returns:

  • dict - output event

Examples:

{
"workspace": "some-workspace",
"layername": "some-layer",
"date": "20210201",
"datatype": "layer:s3_url",
"description": "some description",
"style": {
"default": "terrain",
"styles": [
"terrain",
"rdylgn"
]
},
"zone": 1336
}