Python API
Signatures and descriptions below are generated from Python source at build time.
This reference covers the public workflow and the objects it returns; internal
transports and provider implementation helpers are intentionally omitted.
Every public function that takes a filesystem path accepts a str or any
os.PathLike[str] and coerces it once on entry, so a path usdata inspect
printed can be pasted straight back in.
See fetch and analyze for complete workflows.
Discovery and queries
usdata.datasets
datasets(*, provider: str | None = None, domain: str | None = None, format: str | None = None, reader: str | None = None, capability: str | None = None, status: str = 'available') -> list[Dataset]
List curated registry datasets. Keyword arguments match Registry.list.
usdata.search
search(text: str | None = None, *, include_planned: bool = False, domain: str | None = None, format: str | None = None, reader: str | None = None, capability: str | None = None, status: str | None = None, **kwargs: Any) -> list[SearchResult]
Search the curated registry. Remaining keyword arguments match build_query.
usdata.build_query
build_query(text: str | None = None, *, provider: str | None = None, location: str | None = None, bbox: BBox | tuple[float, float, float, float] | None = None, lat: float | None = None, lon: float | None = None, radius_km: float = 50.0, start: str | date | datetime | None = None, end: str | date | datetime | None = None, variables: list[str] | None = None, **params: Any) -> Query
Normalize user-facing arguments into a Query.
Exactly one of location, bbox, or lat/lon may set the spatial filter.
A location sets both the query's bbox and its place, the state or
county it named; a bbox or a lat/lon names no place.
usdata.Registry
An in-memory collection of datasets addressable by id and searchable by keyword.
from_yaml
classmethod
Load from YAML with providers, domains, systems, and datasets.
list
list(*, provider: str | None = None, domain: str | None = None, format: str | None = None, reader: str | None = None, capability: str | None = None, status: str = 'available') -> list[Dataset]
Datasets matching every filter given, in registry order.
provider and domain match an id exactly. format matches
case-insensitively anywhere in a declared format, so csv also finds
gzip CSV. reader names the extra that opens the files, or
'none' for datasets delivering bytes only. capability names one
of CAPABILITY_NAMES and keeps datasets declaring it true.
status is 'available', 'planned', or 'all'.
search
search(query: Query, *, include_planned: bool = False, provider: str | None = None, domain: str | None = None, format: str | None = None, reader: str | None = None, capability: str | None = None, status: str | None = None) -> list[SearchResult]
Rank datasets by keyword match, filtered by provider, space, and time.
The keyword arguments are the list filters, applied before scoring.
Planned datasets are left out unless include_planned is set;
status supersedes it when given. Blank or absent text is no keyword
filter, as in list.
Raises:
| Type | Description |
|---|---|
ValueError
|
The text has no letters or digits to match, such as |
Fetching and opening
usdata.fetch
fetch(dataset: Dataset, query: Query, *, root: str | PathLike[str] | None = None, force: bool = False) -> list[FetchedAsset]
Resolve and fetch a query, sharing one adapter and closing its owned resources.
usdata.fetch_asset
fetch_asset(dataset: Dataset, asset: Asset, *, root: str | PathLike[str] | None = None, force: bool = False) -> FetchedAsset
Fetch one asset, reusing the cache only when its provenance still describes it.
usdata.FetchedAsset
Bases: BaseModel
One asset on disk with its provenance and whether the cache satisfied it.
open
Open local data with the reader its format implies, with that reader's defaults.
CSV and ERDDAP CSV, HURDAT2, AQS daily JSON, and ACS tables return a pandas DataFrame;
NetCDF4 and GRIB2 a loaded xarray Dataset; NEXRAD Level II an xarray
DataTree. Provenance is kept in the result's attrs["usdata"]. A file
that needs options, or whose metadata leaves its format ambiguous, is
opened with the method for its format instead: open_csv,
open_nexrad, open_grib2, or open_netcdf. Cached files and
provenance sidecars are never changed. See usdata.readers.open_asset.
open_csv
open_csv(*, dtype: dict[str, str] | None = None, parse_dates: list[str] | None = None, usecols: list[str] | None = None, nrows: int | None = None, units_row: bool | None = None) -> pd.DataFrame
Open a CSV as a pandas DataFrame; see usdata.readers.open_csv.
units_row says whether a units row follows the header, as in ERDDAP
CSV, and is inferred when None; the units go to frame.attrs["units"].
open_nexrad
Open a NEXRAD Level II volume as an xarray DataTree; see usdata.readers.open_nexrad.
Use sweep=0 or sweep=[0, 2] to load selected zero-based sweeps.
open_grib2
Open GRIB2 messages as one xarray Dataset; see usdata.readers.open_grib2.
select={"shortName": "cape", "typeOfLevel": "surface"} chooses
messages; strict=True raises instead of warning when a select value
matches none of the selected messages.
open_netcdf
Open a NetCDF4 file as an xarray Dataset; see usdata.readers.open_netcdf.
inspect
Summarize this file: provenance, format, and what that format holds.
CSV columns and a capped row count need no extra; NetCDF4 variables and
GRIB2 messages need the same extras open does, and a missing one
yields a summary with no detail and a note naming it. Like open,
this reads the cached file and changes nothing. See
usdata.inspect.inspect_asset.
Listing GRIB2 messages
usdata.list_messages
List each file a query resolves to with the fields its index describes.
Each entry's selector is a messages value that names exactly that
field. A selector may stop after its level text, as CAPE:surface, to
name that field at whatever step each file holds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
A dataset declaring |
required |
query
|
Query
|
The query a fetch would take, without |
required |
Returns:
| Type | Description |
|---|---|
list[MessageListing]
|
One listing per file, in the order a fetch would list them. |
Raises:
| Type | Description |
|---|---|
QueryError
|
The dataset selects no messages, the query names
|
usdata.MessageListing
Bases: BaseModel
One file a query resolved to, and every field its index describes.
usdata.models.IndexEntry
Bases: BaseModel
One field of one GRIB2 object, as the object's wgrib2 .idx sidecar describes it.
number is the GRIB2 message the field belongs to and field its
position inside a message that holds several (12.2), or None for a
message holding one. Fields of one message share an offset and a length.
selector is the messages text that names exactly this field.
number
class-attribute
instance-attribute
offset
class-attribute
instance-attribute
length
class-attribute
instance-attribute
short_name
class-attribute
instance-attribute
level
class-attribute
instance-attribute
step
class-attribute
instance-attribute
field
class-attribute
instance-attribute
field: int | None = Field(default=None, ge=1, description='Position inside a message holding several fields')
extra
class-attribute
instance-attribute
byte_range
property
The inclusive byte interval this field's message occupies in the object.
Inspecting a file
usdata.inspect_asset
Summarize a fetched asset: its provenance and, for its format, what is inside.
The format comes from the asset's media type, falling back to its id, so a restored asset summarizes the same way a freshly fetched one does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fetched
|
FetchedAsset
|
The asset to inspect, as |
required |
Returns:
| Type | Description |
|---|---|
Summary
|
A summary carrying the detail for the asset's format, or no detail and a |
Summary
|
note naming the extra when that format's reader is not installed. |
usdata.inspect_path
Summarize a cached file, reading the provenance sidecar written beside it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | PathLike[str]
|
A cached file whose |
required |
Returns:
| Type | Description |
|---|---|
Summary
|
The summary |
Summary
|
name because a sidecar records no media type, and the protocol from the |
Summary
|
registry entry of the dataset the sidecar names, for the same reason. |
Raises:
| Type | Description |
|---|---|
OSError
|
The file or its provenance sidecar is missing or unreadable. |
ValueError
|
The sidecar is not a provenance record. |
usdata.inspect.Summary
Bases: BaseModel
What one fetched file is, where it came from, and what its format holds.
Exactly one of csv, netcdf, grib2, and nexrad is set, or none of them
when the format is bytes-only, its reader is unavailable, or the bytes no
longer decode; note then says why. detail returns whichever is set.
usdata.inspect.CsvSummary
Bases: BaseModel
A delimited text file's header and how many data rows the scan counted.
columns
class-attribute
instance-attribute
units
class-attribute
instance-attribute
units: dict[str, str] = Field(default_factory=dict, description='Units per column, from the units row an ERDDAP or IBTrACS CSV lays under its header; empty for a CSV with no such row')
row_count
class-attribute
instance-attribute
row_count: int = Field(ge=0, description='Data rows counted, excluding the header and any units row')
row_limit
class-attribute
instance-attribute
usdata.inspect.NetcdfSummary
usdata.inspect.NetcdfVariable
Bases: BaseModel
One NetCDF4 data variable's shape and the metadata the file states for it.
dims
class-attribute
instance-attribute
shape
class-attribute
instance-attribute
usdata.inspect.Grib2Summary
Bases: BaseModel
Every message a GRIB2 file holds, in file order.
variable_for
The variable name open() will give the message one index selector fetched.
This closes the loop a partial fetch opens: messages="CAPE:surface"
asks in the index sidecar's vocabulary, and the reader answers in
ecCodes', so this says which name that selector produces given every
message this file holds. Only a partial fetch records selectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selector
|
str
|
A selector exactly as the provenance recorded it, such as
|
required |
Returns:
| Type | Description |
|---|---|
str
|
The variable name the GRIB2 naming rule gives that message. |
Raises:
| Type | Description |
|---|---|
KeyError
|
No message here was fetched for that selector; the message lists the selectors that were. |
ValueError
|
That selector fetched a message holding several fields, as RAP publishes wind components, and the record was written before each field's selector was recorded, so it cannot say which field it named; the message lists their variables. |
usdata.inspect.GribMessage
Bases: BaseModel
One GRIB2 message as ecCodes reports it: the keys select matches on, plus the grid.
Two numberings name the same message. file_index counts messages in the
local file from zero; object_index is the number the source object's
index sidecar gave it, one-based, and is set only for a partial fetch, as is
selector, the index selector the message was fetched for.
file_index
class-attribute
instance-attribute
file_index: int = Field(ge=0, description='Zero-based message position in the local file; fields of one message share it')
object_index
class-attribute
instance-attribute
object_index: int | None = Field(default=None, ge=1, description='One-based message number in the source object, for a partial fetch')
selector
class-attribute
instance-attribute
selector: str | None = Field(default=None, description='Index selector this message was fetched for, for a partial fetch')
short_name
class-attribute
instance-attribute
base_name
class-attribute
instance-attribute
base_name: str | None = Field(default=None, description="Name the reader starts this message's variable from: shortName, or where ecCodes has none, the MRMS product or parameter_<discipline>_<category>_<number>")
name
class-attribute
instance-attribute
type_of_level
class-attribute
instance-attribute
level
class-attribute
instance-attribute
step
class-attribute
instance-attribute
units
class-attribute
instance-attribute
usdata.inspect.NexradSummary
usdata.inspect.NexradSweep
Bases: BaseModel
One sweep of a NEXRAD Level II volume, read from its metadata without decoding moments.
index is what open_nexrad(sweep=...) takes. It is not an elevation:
a split cut scans one angle twice, once for reflectivity and dual-pol
moments and once for velocity, and SAILS or MRLE rescan the lowest angle
several times a volume, so one angle can hold many indices. Choose sweeps
here by fixed_angle, moments, and start, then open them by index.
index
class-attribute
instance-attribute
index: int = Field(ge=0, description='Zero-based position in the volume; what open_nexrad(sweep=...) takes')
elevation_number
class-attribute
instance-attribute
fixed_angle
class-attribute
instance-attribute
fixed_angle: float = Field(description="Elevation in degrees: the VCP table's angle for the cut, or the first ray's where the volume carries no VCP table")
moments
class-attribute
instance-attribute
moments: list[str] = Field(description="Moments open_nexrad returns for the sweep, by its names; a legacy volume's spectrum width is in the file but not decoded")
start
class-attribute
instance-attribute
end
class-attribute
instance-attribute
complete
class-attribute
instance-attribute
usdata.readers.nexrad_sweeps
List every sweep in a local NEXRAD Level II volume without decoding any moment.
A sweep index is a position in the volume, not an elevation: split cuts scan
one angle twice and SAILS rescans the lowest angle within a volume, so the
same index names different angles from one volume coverage pattern to the
next. Choose sweeps from this list by angle, moment, and time, then pass
their indices to open_nexrad(sweep=...). FetchedAsset.inspect()
returns the same list, with the volume coverage pattern, as nexrad.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | PathLike[str]
|
A local Level II volume, whole-file gzip or bzip2 compressed or not,
written as a string or as any |
required |
Returns:
| Type | Description |
|---|---|
list[NexradSweep]
|
One entry per sweep in scan order. |
Raises:
| Type | Description |
|---|---|
MissingReaderDependency
|
The radar extra is not installed. |
ValueError
|
The file is not a readable NEXRAD Level II volume. |
Reproducible inputs
usdata.pull.pull
pull(manifest_path: str | PathLike[str], *, root: str | PathLike[str] | None = None, force: bool = False, registry: Registry | None = None, update: Iterable[str] = ()) -> PullResult
Restore from the lockfile if one exists, otherwise resolve and create it.
update names assets or datasets whose pins should follow current upstream
bytes; it needs an existing lockfile and is exclusive with force.
usdata.pull.plan
List every source through its adapter and price the result; download nothing.
Validates the whole manifest first, exactly as resolve does, then makes
only the requests a listing makes: an S3 listing, or the index and HEAD
requests a partial-fetch source needs to work out its byte ranges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest_path
|
str | PathLike[str]
|
Path of the manifest YAML file, as a string or any |
required |
registry
|
Registry | None
|
Registry to resolve dataset ids against; the default one if omitted. |
None
|
Returns:
| Type | Description |
|---|---|
Plan
|
A |
usdata.pull.verify
verify(manifest_path: str | PathLike[str], *, root: str | PathLike[str] | None = None) -> list[Drift]
Check manifest consistency, then compare cached files against the lockfile.
usdata.pull.compare_listing
compare_listing(manifest_path: str | PathLike[str], *, registry: Registry | None = None) -> ListingComparison
Compare a manifest's lockfile with what its sources list today; download nothing.
Every source is listed as plan lists it, select rules included, and
its assets are matched to the lockfile's entries for that source by id. An
asset only in the listing is added, one only in the lockfile removed,
and one in both with a different href, or a different size where both give
one, changed. A listing that reports no size cannot show a size change;
restoring the pin checks the bytes themselves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest_path
|
str | PathLike[str]
|
Path of the manifest YAML file, as a string or any |
required |
registry
|
Registry | None
|
Registry to resolve dataset ids against; the default one if omitted. |
None
|
Returns:
| Type | Description |
|---|---|
ListingComparison
|
A |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
The manifest has no lockfile yet. |
ManifestChanged
|
The manifest changed since its lockfile was written. |
usdata.pull.PullResult
Bases: BaseModel
What a pull did.
fetched keeps manifest order, and within a source the assets are ordered
by start time and then id; by_source holds the same objects grouped by
source key, which is a source's name when it has one and its one-based
position otherwise, in the same order. one is for a source that can only
ever resolve to one asset.
fetched
class-attribute
instance-attribute
fetched: list[FetchedAsset] = Field(description='Every asset, in manifest order, then by start time and id within a source')
updated
class-attribute
instance-attribute
updated: list[str] = Field(default_factory=list, description='Ids of assets whose pins were rewritten by update')
mirrored
class-attribute
instance-attribute
mirrored: list[str] = Field(default_factory=list, description="Ids of assets the mirror restored instead of the source: because the pinned URL no longer served their bytes, or, for those also in unchecked, because the source's credentials are not set; pins are unchanged and each sidecar names the mirror object")
unchecked
class-attribute
instance-attribute
unchecked: list[str] = Field(default_factory=list, description='Ids of mirrored assets restored without asking their source, because its credentials are not set, so upstream was not checked for changes (ADR 0039)')
by_source
class-attribute
instance-attribute
by_source: dict[str, list[FetchedAsset]] = Field(default_factory=dict, description='The same assets grouped by source key, in manifest order')
one
The single asset a source resolved to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
The source key: its |
required |
Returns:
| Type | Description |
|---|---|
FetchedAsset
|
That source's only asset. |
Raises:
| Type | Description |
|---|---|
KeyError
|
No source in the result has that key. |
ValueError
|
The source resolved to no asset, or to more than one. |
usdata.pull.Plan
Bases: BaseModel
What pulling a manifest would fetch, priced as far as the adapters can measure.
An asset whose adapter reports no size contributes nothing to known_bytes
and counts in unknown_sizes instead, so the total is a floor rather than
an estimate. A source that matched nothing is kept with no assets; pull would
fail on it unless the source sets allow_empty.
sources
class-attribute
instance-attribute
usdata.pull.SourcePlan
Bases: BaseModel
What one manifest source would fetch, as its adapter listed it.
source
class-attribute
instance-attribute
usdata.pull.Drift
Bases: BaseModel
One lockfile entry whose local copy is missing or altered, or whose source moved on.
usdata.pull.ListingComparison
Bases: BaseModel
A lockfile against today's listings: whether a re-resolve would pin the same assets.
Nothing is downloaded, so the bytes are not compared: restore checks those,
and verify checks the cache. What this sees is the set of files, an
asset added, removed, or re-described since the lockfile was written.
usdata.pull.SourceComparison
Bases: BaseModel
How one source's pinned assets compare with what its adapter lists today.
source
class-attribute
instance-attribute
added
class-attribute
instance-attribute
removed
class-attribute
instance-attribute
changed
class-attribute
instance-attribute
changed: list[AssetChange] = Field(description='Pinned and listed, with a different href, or a different size where both the pin and the listing give one')
unchanged
class-attribute
instance-attribute
usdata.pull.AssetChange
Bases: BaseModel
A pinned asset that today's listing still names, but describes differently.
locked_size
class-attribute
instance-attribute
listed_size
class-attribute
instance-attribute
usdata.manifest.Manifest
Bases: BaseModel
A declarative list of inputs a project needs: usdata pull fetches them.
source_keys
Each source's key: its name when set, otherwise its one-based position.
usdata.manifest.SourceSpec
Bases: BaseModel
One entry under sources: in a manifest.
name
class-attribute
instance-attribute
name: str | None = Field(default=None, description='Optional label that keys this source in results and lockfiles')
usdata.manifest.Lockfile
Bases: BaseModel
Exactly what a manifest resolved to, with checksums, so it can be reproduced.
manifest_checksum
class-attribute
instance-attribute
usdata.manifest.LockedAsset
Bases: BaseModel
One resolved asset and the provenance of the copy that was fetched.
Citations
usdata.cite_dataset
Build the citation for one registry entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
The entry to cite. |
required |
registry
|
Registry | None
|
Registry supplying the agency name and homepage behind the entry's provider id. The bundled registry by default. |
None
|
Returns:
| Type | Description |
|---|---|
Citation
|
A citation carrying the entry's own citation text where it has one, and |
Citation
|
' |
usdata.cite_lockfile
cite_lockfile(manifest_path: str | PathLike[str], registry: Registry | None = None) -> list[Citation]
Cite every dataset a manifest's lockfile pins, one citation per dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest_path
|
str | PathLike[str]
|
The manifest whose lockfile records what was fetched,
written as a string or as any |
required |
registry
|
Registry | None
|
Registry the pinned dataset ids are looked up in. The bundled registry by default. |
None
|
Returns:
| Type | Description |
|---|---|
list[Citation]
|
One citation per distinct dataset id, in lockfile order, each carrying |
list[Citation]
|
the retrieval range, asset count, total bytes, pinning version, and |
list[Citation]
|
manifest source keys of that dataset's pinned assets. |
Raises:
| Type | Description |
|---|---|
ManifestChanged
|
The manifest was edited after the lockfile was written. |
DatasetNotFound
|
The lockfile pins a dataset the registry does not know. |
usdata.Citation
Bases: BaseModel
How to cite one dataset, plus what a lockfile pins of it when there is one.
The retrieval fields are empty for a citation built from a registry entry alone; they are filled only when the citation comes from a lockfile.
as_text
Render this citation the way usdata cite prints it.
Returns:
| Type | Description |
|---|---|
str
|
The dataset id, the citation text, and each field that is set, one |
str
|
labelled line apiece. |
Temporal selection
usdata.select_by_time
select_by_time(candidates: Iterable[Asset], *, target: datetime, tolerance: timedelta, direction: Literal['nearest', 'at_or_before']) -> TemporalSelection
Select an asset by start time using an explicit tolerance and direction.
nearest admits starts on either side of target; at_or_before admits
only starts no later than target. The tolerance boundary is inclusive.
Equal distances break ties lexically by asset ID, then dataset ID. Duplicate
(dataset_id, id) identities and missing/naive starts raise ValueError, even
for candidates that would not win. All supplied candidates are validated.
Target is normalized to UTC for comparison and in the result. The signed offset is asset start minus target, in seconds. If no candidate qualifies, the result has no asset/offset and eligible_count=0. Inputs are not modified. Matching by start does not establish acquisition completion or availability.
usdata.TemporalSelection
Bases: BaseModel
A start-time selection and its explicit policy; not source provenance.
No match has asset=None, offset_seconds=None, and zero eligible
candidates. Counts refer to the supplied candidates, not a remote catalog.
Shared types
usdata.Asset
Bases: BaseModel
A single retrievable object (file, granule, or subset request) from a dataset.
checksum
class-attribute
instance-attribute
properties
class-attribute
instance-attribute
properties: dict[str, str] = Field(default_factory=dict, description="Facts of the request the bytes do not state, such as the unit system, datum, or station, keyed in lowercase snake case; readers copy them into attrs['usdata']['properties'] (ADR 0043)")
usdata.BBox
Bases: BaseModel
Geographic bounding box in WGS84 degrees. Antimeridian crossing is not supported yet.
from_point
classmethod
Box around a point. Uses a flat-earth approximation, fine for small radii.
contains_point
True if the point lies inside or on the edge of the box.
usdata.Place
Bases: BaseModel
The state or county a location named, as the bundled Census table identifies it.
A rectangle cannot be turned back into the place it was drawn around, so a
query keeps this beside its bbox for the sources that are keyed by FIPS
code rather than by coordinates. See ADR 0034.
geoid
class-attribute
instance-attribute
geoid: str = Field(pattern='^\\d{2}(\\d{3})?$', description='Census GEOID: the two-digit state FIPS code, or the five-digit county one')
label
class-attribute
instance-attribute
state
class-attribute
instance-attribute
state: str = Field(pattern='^[A-Z]{2}$', description='Two-letter postal code of the state, or of the state a county lies in, such as OK; some sources key places by it rather than by the state FIPS code')
state_fips
property
The two-digit FIPS code of the state, or of the state a county lies in.
usdata.TimeRange
Bases: BaseModel
Half-open-agnostic time interval. Either bound may be None to mean unbounded.
usdata.Dataset
Bases: BaseModel
A registry entry. One per curated dataset, identified as provider:name.
capabilities
class-attribute
instance-attribute
summary
class-attribute
instance-attribute
summary: str | None = Field(default=None, max_length=80, description='One-line label shown by the docs, site, and CLI')
formats
class-attribute
instance-attribute
formats: list[str] = Field(default_factory=list, description='File formats this dataset delivers, as delivered')
selection
class-attribute
instance-attribute
selection: str | None = Field(default=None, max_length=160, description='What one query selects, in a single sentence')
inputs
class-attribute
instance-attribute
inputs: str | None = Field(default=None, max_length=200, description='What a caller must supply to fetch anything')
reader
class-attribute
instance-attribute
reader: str | None = Field(default=None, description=f'Extra that opens the files ({READER_EXTRAS_TEXT}); None means bytes only')
guide
class-attribute
instance-attribute
guide: str | None = Field(default=None, description='Repository-relative path to the handwritten usage guide')
examples
class-attribute
instance-attribute
examples: list[str] = Field(default_factory=list, description='Repository-relative paths to worked examples using this dataset')
resolution
class-attribute
instance-attribute
resolution: Resolution | None = Field(default=None, description='How fine the data are in space and time')
update_frequency
class-attribute
instance-attribute
update_frequency: str | None = Field(default=None, description='How often the source publishes new data')
latency
class-attribute
instance-attribute
latency: str | None = Field(default=None, description='How far behind real time the source runs, as the agency states it')
citation
class-attribute
instance-attribute
citation: str | None = Field(default=None, description='How the agency asks to be cited, in one line')
terms
class-attribute
instance-attribute
terms: str | None = Field(default=None, description="https URL of the source's stated conditions of use")
variables
class-attribute
instance-attribute
variables: list[Variable] = Field(default_factory=list, description='Variables the dataset delivers; a sample where the set is open-ended')
limits
class-attribute
instance-attribute
limits: Limits | None = Field(default=None, description='Request limits the adapter enforces, such as the longest window')
credentials
class-attribute
instance-attribute
credentials: CredentialSpec | None = Field(default=None, description='Environment variables the source needs before it can be contacted (ADR 0039)')
system
class-attribute
instance-attribute
system: str | None = Field(default=None, description='Id of a system declared in the registry, for datasets that belong to one')
domain
class-attribute
instance-attribute
since
class-attribute
instance-attribute
target
class-attribute
instance-attribute
target: str | None = Field(default=None, description="Version a planned dataset is aimed at, or 'later'")
adapter
class-attribute
instance-attribute
adapter: str | None = Field(default=None, description="'package.module:ClassName' of the Provider; required unless planned")
version_label
property
'since 0.2' for shipped datasets, 'target 0.4' or 'target later' otherwise.
usdata.Query
Bases: BaseModel
Normalized, provider-agnostic request. Providers translate this into their own terms.
usdata.Provenance
Bases: BaseModel
Everything needed to say where a local file came from and re-fetch it.
transformations
class-attribute
instance-attribute
index_url
class-attribute
instance-attribute
index_url: str | None = Field(default=None, description='Index sidecar a partial fetch resolved its ranges through')
index_checksum
class-attribute
instance-attribute
index_checksum: Sha256 | None = Field(default=None, description="'sha256:<hex>' of that index text as it was fetched")
ranges
class-attribute
instance-attribute
ranges: list[ByteRange] = Field(default_factory=list, description='Byte ranges a partial fetch concatenated, in order')
selectors
class-attribute
instance-attribute
selectors: list[str] = Field(default_factory=list, description='Index selector each of those ranges was fetched for, in the same order')
field_selectors
class-attribute
instance-attribute
field_selectors: list[list[str]] = Field(default_factory=list, description='Index selector naming each field each of those ranges holds, in the same order; empty in a record written before fields were recorded')
object_size
class-attribute
instance-attribute
object_size: int | None = Field(default=None, ge=0, description='Size of the whole object those ranges came from')
object_etag
class-attribute
instance-attribute
object_etag: str | None = Field(default=None, description='ETag that object carried, re-sent as ``If-Match`` on a restore')
mirror
class-attribute
instance-attribute
mirror: str | None = Field(default=None, description='Mirror object that served these bytes in place of the source (ADR 0030, ADR 0039)')
credentials
class-attribute
instance-attribute
credentials: list[str] = Field(default_factory=list, description='Environment variables the source requires to fetch this file, never their values (ADR 0039); empty for an anonymous source')
is_partial
property
Whether this record describes selected byte ranges rather than a whole object.
object_messages
property
The source object's own message numbers, in the order the local file holds them.
A partial fetch concatenated one message per recorded range, so the nth number here numbers the nth message on disk as the index sidecar numbers it, one-based. Empty for a whole file, and empty rather than wrong when the href fragment and the recorded ranges disagree.
field_selector
The selector one field on disk was fetched for, or None where none was recorded.
message counts the local file's messages from zero and field the
fields inside that message from zero, as a reader meets them. A record
that names no fields, as one written before they were recorded does,
gives every field of a message that message's one selector.