health
Objects
Options
@dataclass
class Options()
Input raster creation options
Attributes:
nodatafloat | int, optional - Specify the nodata value. Bear in mind that nodata values within the expected range of the vegetation index will cause holes in the final resulting raster dataset. Defaults to -9999.normalizebool, optional - Input switch to normalize the data between [-1, 1]. Defaults to False.COMPRESSstr, optional - Choose a GDAL compression. Defaults to DEFLATE.PREDICTORstr, optional - Use with compression to allow even greater compression power. Defaults to "2".TILEDstr, optional - Add internal tiling for raster data. Defaults to YES.
generate_gdal_options
def generate_gdal_options(
ops: Literal["translate", "vrt", "warp"] = "translate",
form: Literal["gdal", "list"] = "gdal") -> list | Any | None
Function to convert input options into GDAL options.
Arguments:
opsLiteral["translate", "vrt", "warp"], optional - the GDAL operation. Defaults to "translate". from (Literal["gdal", "list"])
Returns:
list | Any | None: a processing options object.
Functions
affinition
def affinition(
tile: gdal.Dataset | str,
options: Options | None = None,
dimension: Tuple[int, int] = (5000, 5000)
) -> gdal.Dataset
Function to create the GDAL output object from either a source dataset or a DynamoDB item.
Arguments:
tilegdal.Dataset - input raster dataset.dimensionTuple[int, int], optional - input dimensions of the output tiff. Defaults to (5000, 5000).optionsOptions, optional - input options for raster creation.
Returns:
gdal.Dataset- output dataset used to write array to.
calculate
def calculate(tile: str | gdal.Dataset,
options: Options | None,
source_type: Literal["rgb", "infrared", "multispectral"],
which_index: str = "") -> io.BytesIO | None
Function to run the vegetation index calculations based on the input index given and its sensor type. RGB sensor type will not run an NDVI calculation. For NIR calculations you should use the NIR tile as tile input. The function will search for the RGB tile by itself. Multispectral data will assume a band order of [RED, RedEdge, NIR], from shortest wavelength to longest. Multispectral information holding more bands than these need to be spliced and reconfigured.
Arguments:
tilestr | gdal.Dataset - input raster tile, can be a path or and gdal data object.optionsOptions, optional - input options for raster creation.source_typeLiteral["rgb", "infrared", "multispectral"] - input sensor type.which_indexstr, optional - the vegetation index name. Defaults to "".
Raises:
NotImplementedError- when a specific vegetation index isn't implemented in vi.py yet.
Returns:
io.BytesIO | None: a buffer object which contains the array of data and the GDAL object reference. To be used with utils.s3 functions to upload the data to AWS S3.
clip
def clip(tile: str | gdal.Dataset, shape: str) -> gdal.Dataset | None
Wrapper function around gdal.Warp to load the shapefile and process the clip.
Arguments:
tilestr | gdal.Dataset - input tile.shapestr - input clip shape.
Returns:
gdal.Dataset|None: clipped gdal raster data
track_rgb
def track_rgb(tile: gdal.Dataset | str, prefix: str = "") -> str
Function to mine the matching RGB tile to a NIR tile.
Arguments:
tilegdal.Dataset | str - input NIR dataset.prefixstr, optional - add a prefix to the tile when a base tile key is used. Defaults to "".
Raises:
FileNotFoundError- matching RGB tile isn't found in filesystem
Returns:
str- matched RGB tile