Skip to content

ProcessArea dataclass

Bases: Iterable[Coordinates]

A process area specifies the area of interest by a set of coordinates of the bottom left corner of each tile.

Notes
  • The + operator can be used to add two process areas
  • The - operator can be used to subtract two process areas
ATTRIBUTE DESCRIPTION
coordinates

coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet

coordinates: CoordinatesSet property writable

RETURNS DESCRIPTION
CoordinatesSet

coordinates (x_min, y_min) of each tile

from_bounding_box classmethod

Creates a process area from a bounding box.

PARAMETER DESCRIPTION
bounding_box

bounding box

TYPE: BoundingBox

tile_size

tile size in meters

TYPE: TileSize

quantize

if True, the bounding box is quantized to tile_size

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
ProcessArea

process area

from_gdf classmethod

Creates a process area from a geodataframe.

PARAMETER DESCRIPTION
gdf

geodataframe

TYPE: gpd.GeoDataFrame

tile_size

tile size in meters

TYPE: TileSize

quantize

if True, the bounding box is quantized to tile_size

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
ProcessArea

process area

from_json classmethod

Creates a process area from a JSON string.

Notes
  • The JSON string contains a list of coordinates (x_min, y_min) of each tile

Examples:

Assume the JSON string is '[[363084, 5715326], [363212, 5715326], [363084, 5715454], [363212, 5715454]]'.

You can create a process area from the JSON string.

>>> process_area = ProcessArea.from_json(
...     json_string= (
...         '[[363084, 5715326], '
...         '[363212, 5715326], '
...         '[363084, 5715454], '
...         '[363212, 5715454]]'
...     ),
... )
PARAMETER DESCRIPTION
json_string

JSON string

TYPE: str

RETURNS DESCRIPTION
ProcessArea

process area

from_config classmethod

Creates a process area from the configuration.

PARAMETER DESCRIPTION
config

configuration

TYPE: ProcessAreaConfig

RETURNS DESCRIPTION
ProcessArea

process area

RAISES DESCRIPTION
AviaryUserError

Invalid configuration

append

Appends the coordinates.

PARAMETER DESCRIPTION
other

other coordinates

TYPE: Coordinates

inplace

if True, the coordinates are appended inplace

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
ProcessArea

process area

chunk

Chunks the coordinates.

PARAMETER DESCRIPTION
num_chunks

number of chunks

TYPE: int

RETURNS DESCRIPTION
list[ProcessArea]

list of process areas

filter

Filters the coordinates.

PARAMETER DESCRIPTION
coordinates_filter

coordinates filter

TYPE: CoordinatesFilter

inplace

if True, the coordinates are filtered inplace

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
ProcessArea

filtered process area

to_gdf

Converts the coordinates to a geodataframe.

PARAMETER DESCRIPTION
epsg_code

EPSG code

TYPE: EPSGCode

tile_size

tile size in meters

TYPE: TileSize

RETURNS DESCRIPTION
gpd.GeoDataFrame

geodataframe

RAISES DESCRIPTION
AviaryUserError

Invalid tile size (tile_size <= 0)

to_json

Converts the coordinates to a JSON string.

Notes
  • The JSON string contains a list of coordinates (x_min, y_min) of each tile
RETURNS DESCRIPTION
str

JSON string


ProcessAreaConfig

Bases: pydantic.BaseModel

Configuration for the from_config class method of ProcessArea

The configuration must have one of the following field sets
  • json_string
  • gdf and tile_size
  • bounding_box and tile_size
ATTRIBUTE DESCRIPTION
bounding_box

bounding box (x_min, y_min, x_max, y_max)

TYPE: list[Coordinate] | None

gdf

path to the geodataframe

TYPE: Path | None

json_string

path to the JSON file containing the coordinates (x_min, y_min) of each tile

TYPE: Path | None

processed_coordinates_json_string

path to the JSON file containing the coordinates (x_min, y_min) of the processed tiles

TYPE: Path | None

tile_size

tile size in meters

TYPE: TileSize | None

quantize

if True, the bounding box is quantized to tile_size

TYPE: bool