Area of Interest¶
- class missiontools.AoI(lat_deg, lon_deg)[source]¶
Bases:
objectArea of interest defined by a sampled point cloud.
All angles are in degrees at the user-facing interface; internally stored as radians. The
lat_rad/lon_radproperties expose the radians representation for direct use with coverage analysis functions.AoIs created via
from_region(),from_shapefile(),from_geography(), or a set operation are geometry-backed — they store a Shapely geometry and generate their sample points lazily on first access. This means composing complex AoIs with set operations (|,&,-,^) incurs no sampling cost until points are actually needed.- Parameters:
lat_deg (
array-like) – Sample latitudes (deg), shape(M,).lon_deg (
array-like) – Sample longitudes (deg), shape(M,).
- Parameters:
lat_deg (npt.ArrayLike)
lon_deg (npt.ArrayLike)
Notes
Directly constructed AoIs (
AoI(lat, lon)) have no associated geometry and cannot participate in set operations.Antimeridian caveat: set operations between a geometry from a Natural Earth shapefile that uses unwrapped longitudes (> 180°, e.g. Russia) and a
from_region()box in [-180, 180] will not behave correctly because Shapely treats coordinates as Cartesian. For most geographies this is not an issue.Examples
Direct construction from arrays:
import numpy as np from missiontools import AoI lat = np.linspace(-10, 10, 50) lon = np.linspace(30, 60, 50) aoi = AoI(lat, lon)
From a rectangular lat/lon band (lazy — no points generated yet):
aoi = AoI.from_region(lat_min_deg=-10, lat_max_deg=10, lon_min_deg=30, lon_max_deg=60)
From a Natural Earth geography:
aoi = AoI.from_geography('Australia')
Compound AoI via set operations:
conus = AoI.from_geography("US") - AoI.from_geography("US-AK") \ - AoI.from_geography("US-HI") can_arctic = AoI.from_geography("Canada") & AoI.from_region(lat_min_deg=66)
- property lat_rad: ndarray[tuple[Any, ...], dtype[float64]]¶
Sample latitudes (rad), shape
(M,)— for coverage functions.
- property lon_rad: ndarray[tuple[Any, ...], dtype[float64]]¶
Sample longitudes (rad), shape
(M,)— for coverage functions.
- property geometry¶
Shapely geometry describing the AoI, or
Noneif unavailable.
- property shapefile_path: str | None¶
Path to the source shapefile, or
Noneif not constructed from one.
- classmethod from_region(lat_min_deg=None, lat_max_deg=None, lon_min_deg=None, lon_max_deg=None, *, point_density=100000.0)[source]¶
Sample an AoI from a rectangular lat/lon region.
Points are generated lazily on first access.
- Parameters:
lat_min_deg (
float | None, optional) – Southern boundary (deg).Noneextends to the South Pole.lat_max_deg (
float | None, optional) – Northern boundary (deg).Noneextends to the North Pole.lon_min_deg (
float | None, optional) – Western boundary (deg). Must be paired withlon_max_deg;None(together withlon_max_deg=None) includes all longitudes.lon_max_deg (
float | None, optional) – Eastern boundary (deg). May be less thanlon_min_degfor anti-meridian-crossing regions.point_density (
float, optional) – Approximate area per sample point (km²). Defaults to 1×10⁵ km² (~100 000 km² per point).
- Returns:
AoI– Geometry-backed, lazily sampled.- Parameters:
- Return type:
- classmethod from_shapefile(path, *, feature_index=None, point_density=100000.0)[source]¶
Sample an AoI from an ESRI Shapefile polygon.
Stores the Shapely geometry; points are generated lazily on first access.
- Parameters:
- Returns:
AoI– Withgeometryandshapefile_pathpopulated.- Parameters:
- Return type: