TemporalSampler#

class torchgeo.samplers.TemporalSampler(dataset, *, toi=None)[source]#

Bases: GeoSampler

Abstract base class for all temporal sampling strategies.

Added in version 0.10.

abstract property strategy: Literal['random', 'sequential']#

Sampling strategy.

All sampling strategies can be categorized as either being random or sequential. This distinction only matters when combining samplers via SpatioTemporalSampler, where either a zip (random) or product (sequential) of all sample locations is taken during each epoch.

Returns:

One of ‘random’ or ‘sequential’.

__init__(dataset, *, toi=None)[source]#

Initialize a new TemporalSampler instance.

Parameters:
  • dataset (GeoDataset) – Dataset to sample from.

  • toi (Interval | None) – Time of interest to sample from (defaults to the bounds of dataset.index).

__iter__()[source]#

Iterate over generated sample locations for each epoch.

Yields:

[ – , :, tmin:tmax] coordinates to index a dataset.

plot()[source]#

Plot a visualization of the sampling strategy.

Returns:

An animation visualizing the sampling strategy.

Return type:

FuncAnimation