Skip to content

Data folder and init

dpc_radar.local

Where the library keeps its data on disk, and :func:init, which fills it.

The folder is, in this order:

  1. the one the caller passes;
  2. $DATA_ROOT/dpc-radar: DATA_ROOT is the root shared with Limen and the other libraries of agent-engineering-studio, each in a folder of its own;
  3. $XDG_CACHE_HOME/dpc-radar, or ~/.cache/dpc-radar.

Inside it:

  • merging/: the «Merging» frames, as :func:dpc_radar.archive.archive writes them and :class:~dpc_radar.archive.MergingArchive reads them;
  • it_dpc_sri/: the IT-DPC-SRI Zarr store, as :func:dpc_radar.history.mirror writes it and :class:~dpc_radar.history.SriHistory reads it. About 51 GB: :func:init downloads it only when asked.

InitReport dataclass

What one :func:init run did: the «Merging», and the history if it was asked.

default_directory

default_directory() -> Path

The library's folder when the caller names none: see the module.

merging_directory

merging_directory(directory: Path | None = None) -> Path

Where the «Merging» frames live, under directory or the default folder.

history_directory

history_directory(directory: Path | None = None) -> Path

Where the IT-DPC-SRI store lives, under directory or the default folder.

init async

init(directory: Path | None = None, *, days: int = 2, history: bool = False, client: AsyncClient | None = None, retries: int = 3, concurrency: int = 32, now: datetime | None = None) -> InitReport

Download what the library needs to work offline into directory.

The «Merging» frames of the last days (about 35 MB a day) into merging/; with history, the IT-DPC-SRI store (2010-2025, about 51 GB) into it_dpc_sri/, concurrency files at a time.

Safe to run again: a file on disk is not downloaded twice, and one the source no longer has is written down and not asked again. Files are written as .part and renamed. A file that fails is counted in the report and retried on the next run; a disk that cannot be written raises.

client is used for every request and left open; retries=0 leaves the retrying to the caller.