CompositeSource¶
Import path: earth2studio.data.CompositeSource
Documentation¶
Bases: _Composite
Data source assembled from analysis sources that provide disjoint variables.
Each requested variable is fetched from the one component that provides it, and
the parts are joined along variable in request order. The composite does not
interpret temporal statistics: labels qualified with one, such as "t2m:mean:24h",
route by their base name and are forwarded unchanged to the component providing
it, which must support them natively as declared in its lexicon. Components must return
fields on the same coordinates apart from variable; wrap components on other
grids in RegriddedSource with a shared target grid.
Use CompositeForecastSource to include forecast sources.
The composite selects ensemble members when any component does: requested
member labels go to those components, which must share member labels,
and other components' fields are repeated for every member.
Parameters:
-
sources(Mapping[str, DataSource]) –Named analysis component sources, on one
device. -
variables(Mapping[str, Sequence[str]]) –Base variable names provided by each named component, without statistic qualifiers. A variable may be provided by only one component.
Raises:
-
ValueError–If
variablesnames an unknown component, assigns a variable twice or contains a qualified label, or components return fields on different devices. -
TypeError–If a component is a forecast source.
Examples:
>>> source = CompositeSource(
... {"radar": RegriddedSource(MRMS(), radar_regridder),
... "lightning": RegriddedSource(GOESGLMGrid(), glm_regridder)},
... {"radar": ["refc"], "lightning": ["flashcount"]},
... )
>>> field = source(time, ["refc", "flashcount"])
fetch
async
¶
fetch(
time: TimeArray,
variable: VariableArray,
member: (
int | str | list[Any] | MemberArray | None
) = None,
) -> DataArray
Asynchronously fetch every component concurrently.
Components without an async fetch run in a worker thread.
Parameters:
-
time(TimeArray) –Timestamps to return data for (UTC).
-
variable(VariableArray) –Variables to return, optionally qualified with a temporal statistic.
-
member(int | str | list | MemberArray, default:None) –Ensemble members to return on a leading
ensembledimension, in the labels of the ensemble components, by default None
Returns:
-
DataArray–Requested variables, in request order.