Collection.query
def Collection.query(
*,
temporal_extent: TimeIntervalLike,
filter: Expression | None = None,
spatial_extent: SpatialFilterLike | None = None,
skip_data: bool = False,
show_progress: bool | Callable[[float], None] = False,
) -> xarray.DatasetQuery a range of data points in this collection in a specified temporal extent.
If no data exists for the requested time or interval, an empty xarray.Dataset is returned.
Parameters
temporal_extent TimeIntervalLike The time or time interval for which to query data. This can be a single time scalar, a tuple of two time scalars, or an array of time scalars.
Valid time scalars are: datetime.datetime objects, strings in ISO 8601 format, or Unix timestamps in seconds.
Behavior for each input type:
-
TimeScalar: If a single time scalar is provided,
queryreturns all data points for that exact millisecond. -
TimeInterval: If a time interval is provided,
queryreturns all data points in that interval. Intervals can be a tuple of twoTimeScalarsor aTimeIntervalobject. Tuples are interpreted as a half-open interval[start, end). With aTimeIntervalobject, thestart_exclusiveandend_inclusiveparameters control whether the start and end time are inclusive or exclusive. -
Iterable[TimeScalar]: If an array of time scalars is provided,
queryconstructs a time interval from the first and last time scalar in the array. Here, both thestartandendtimes are inclusive.
filter Expression | None Optional expression over fields marked queryable in the dataset schema. Build expressions with field() and combine
them with &, |, and ~. See Filter by custom fields.
spatial_extent SpatialFilterLike | None Optional spatial filter for spatio-temporal datasets. Pass a geometry to use the default intersection behavior, or configure a spatial filter mode.
skip_data bool If True, only required datapoint fields are returned, such as time, id, and ingestion_time. Defaults to False.
show_progress bool | Callable[[float], None] If True, display a progress bar when pagination is required. You can also pass a callback to receive progress values between 0 and 1. Defaults to False.
Returns
An xarray.Dataset containing the requested data points.