openworld_radio_twin.providers.snapshots#

Local, pinned snapshots of downloadable point datasets such as antenna registers.

A source downloads its published export once, records the export’s release and SHA-256, and converts it to a Parquet point index sorted by 0.1-degree tiles. Queries then read only the row groups of the tiles a scene touches and never use the network. Refreshing a snapshot is an explicit operation because it changes the data every later query reads.

Functions

current_snapshot(directory)

The snapshot recorded in current.json, or None before the first download.

download(client, url, destination, *, ...[, ...])

Stream url to destination within a size bound; return the file's SHA-256.

install_snapshot(directory, table, *, ...)

Write the point index, then switch current.json to it and drop older indexes.

query_bounds(latitude, longitude, radius_m)

West, south, east and north around the square ENU scene domain.

read_point_index(path, west, south, east, north)

Rows whose point lies inside the bounding box, read tile row by tile row.

source_cache_root(settings)

Directory holding one subdirectory of snapshots per source.

write_point_index(table, path)

Sort points by tile so a bounding-box read touches few row groups.

Classes

Snapshot(directory, release, sha256, index, ...)

The installed snapshot of one source.

openworld_radio_twin.providers.snapshots.source_cache_root(settings)[source]#

Directory holding one subdirectory of snapshots per source.

Return type:

Path

class openworld_radio_twin.providers.snapshots.Snapshot(directory, release, sha256, index, metadata)[source]#

Bases: object

The installed snapshot of one source.

directory: Path#
release: str#
sha256: str#
index: Path#
metadata: dict[str, object]#
property identity: str#
openworld_radio_twin.providers.snapshots.current_snapshot(directory)[source]#

The snapshot recorded in current.json, or None before the first download.

Return type:

Snapshot | None

openworld_radio_twin.providers.snapshots.install_snapshot(directory, table, *, release, sha256, metadata)[source]#

Write the point index, then switch current.json to it and drop older indexes.

Return type:

Snapshot

async openworld_radio_twin.providers.snapshots.download(client, url, destination, *, maximum_bytes, params=None, timeout=600)[source]#

Stream url to destination within a size bound; return the file’s SHA-256.

Return type:

str

openworld_radio_twin.providers.snapshots.query_bounds(latitude, longitude, radius_m)[source]#

West, south, east and north around the square ENU scene domain.

The margin covers the curvature of the square’s edges; placement cuts records to the exact square afterwards.

Return type:

tuple[float, float, float, float]

openworld_radio_twin.providers.snapshots.write_point_index(table, path)[source]#

Sort points by tile so a bounding-box read touches few row groups.

Return type:

None

openworld_radio_twin.providers.snapshots.read_point_index(path, west, south, east, north)[source]#

Rows whose point lies inside the bounding box, read tile row by tile row.

Return type:

Table