Offline (init)
egms_client.offline ¶
The Ortho L3 tiles of an area, downloaded once to work offline: :func:init.
::
from egms_client import init
result = await init(bbox=(15.3, 40.0, 16.9, 41.3), release="2020-2025")
print(len(result.downloaded), "tiles,", result.bytes / 1e9, "GB")
Each tile goes through :meth:~egms_client.client.EgmsArchive.fetch_tile, so
what init leaves on the disk is exactly the cache that fetch_tile,
velocity_at, the MCP server and the page read afterwards: the GeoTIFF of
each tile and component, and an …absent marker for a tile at sea. Run it
again and a tile already there costs nothing, not even a search.
A tile that fails (the archive refuses, the network gives up) is reported in the result, not raised: the others go on, and the next run fetches only what is missing. An error writing to the disk does raise, and stops the rest.
TileOutcome
dataclass
¶
One tile and component of an :func:init.
path is the GeoTIFF (None when absent or failed), bytes what
was downloaded for it now, error why it failed.
InitResult
dataclass
¶
What :func:init did, tile by tile.
absent
property
¶
absent: list[TileOutcome]
The tiles the archive does not have (sea, outside coverage).
init
async
¶
init(directory: Path | None = None, *, bbox: LonLatBounds | None = None, tiles: Iterable[Tile] | None = None, release: str | None = None, components: Iterable[Component] = COMPONENTS, keep: Iterable[TileKeep] | Mapping[Component, Iterable[TileKeep]] = ('tiff',), client: AsyncClient | None = None, key: ServiceKey | None = None, retries: int = 3, concurrency: int = MAX_DOWNLOADS, archive_url: str = ARCHIVE_URL, on_tile: Callable[[TileOutcome], None] | None = None) -> InitResult
Download the Ortho L3 tiles of an area into directory, to work offline.
The area is bbox (west, south, east, north in degrees; needs the
raster extra) or tiles, not both. directory defaults to
:func:~egms_client.client.default_directory, release to the latest
(one request; give it to run with no network at all once the tiles are
there), components to both.
keep adds other files of each ZIP beside the GeoTIFF ("csv", about
250 MB a tile; "attributes", the CSV without its time series, about
13 MB; "xml"), for every component or per component:
{"U": ("tiff", "attributes"), "E": ("tiff",)}.
client and key are passed to :class:~egms_client.client.EgmsArchive;
retries=0 leaves every retry to the caller. At most
:data:~egms_client.client.MAX_DOWNLOADS files stream at once, whatever
concurrency says: the archive allows two per account.
on_tile(outcome) is called as each tile is done.