Air Quality#

class torchgeo.datasets.AirQuality(root='data', *, input_steps=3, target_steps=1, input_features=None, target_features=None, download=False)[source]#

Bases: NonGeoDataset

Air Quality dataset.

The Air Quality dataset from the UCI Machine Learning Repository is a multivariate time series dataset containing air quality measurements from an Italian city.

Dataset Format:

  • .csv file containing date, time and air quality measurements

Dataset Features:

  • hourly averaged sensor responses and reference analyzer ground truth over one year (2004-2005)

  • contains missing features, gap filled using linear interpolation

Note

There are actually two different versions of this dataset with major formatting differences, including comma-delimited vs. semicolon-delimited, empty rows and columns, and differences in datetime formatting. This dataset currently only supports the comma-delimited version.

If you use this dataset in your research, please cite:

Added in version 0.10.

__init__(root='data', *, input_steps=3, target_steps=1, input_features=None, target_features=None, download=False)[source]#

Initialize a new Dataset instance.

Parameters:
  • root (str | PathLike[str]) – Root directory where dataset can be found.

  • input_steps (int) – Number of input time steps to use.

  • target_steps (int) – Number of target time steps to use.

  • input_features (Sequence[str] | None) – List of input features to load (uses all features by default).

  • target_features (Sequence[str] | None) – List of target features to load (uses all features by default).

  • download (bool) – If True, download dataset and store it in the root directory.

Raises:

DatasetNotFoundError – If dataset is not found and download is False.

__len__()[source]#

Return the number of data points in the dataset.

Returns:

Length of the dataset.

Return type:

int

__getitem__(index)[source]#

Return an index within the dataset.

Parameters:

index (int) – Index to return.

Returns:

Data at that index.

Return type:

dict[str, Any]

plot(sample, features=None)[source]#

Plot a sample from the dataset.

Parameters:
Returns:

A matplotlib Figure with the plotted sample.

Return type:

Figure