MMEarth#

class torchgeo.datasets.MMEarth(root='data', subset='MMEarth', modalities=('aster', 'biome', 'canopy_height_eth', 'dynamic_world', 'eco_region', 'era5', 'esa_worldcover', 'sentinel1_asc', 'sentinel1_desc', 'sentinel2', 'sentinel2_cloudmask', 'sentinel2_cloudprod', 'sentinel2_scl'), modality_bands=None, normalization_mode='z-score', transforms=None)[source]#

Bases: NonGeoDataset

MMEarth dataset.

There are three different versions of the dataset, that vary in image size and the number of tiles:

  • MMEarth: 128x128 px, 1.2M tiles, 579 GB

  • MMEarth64: 64x64 px, 1.2M tiles, 162 GB

  • MMEarth100k: 128x128 px, 100K tiles, 48 GB

The dataset consists of 12 modalities:

  • Aster: elevation and slope

  • Biome: 14 terrestrial ecosystem categories

  • ETH Canopy Height: Canopy height and standard deviation

  • Dynamic World: 9 landcover categories

  • Ecoregion: 846 ecoregion categories

  • ERA5: Climate reanalysis data for temperature mean, min, and max of [year, month, previous month] and precipitation total of [year, month, previous month] (counted as separate modalities)

  • ESA World Cover: 11 landcover categories

  • Sentinel-1: VV, VH, HV, HH for ascending/descending orbit

  • Sentinel-2: multi-spectral B1-B12 for L1C/L2A products

  • Geolocation: cyclic encoding of latitude and longitude

  • Date: cyclic encoding of month

Additionally, there are three masks available as modalities:

  • Sentinel-2 Cloudmask: Sentinel-2 cloud mask

  • Sentinel-2 Cloud probability: Sentinel-2 cloud probability

  • Sentinel-2 SCL: Sentinel-2 scene classification

that are synchronized across tiles.

Dataset format:

  • Dataset in single HDF5 file

  • JSON files for band statistics, splits, and tile information

For additional information, as well as bash scripts to download the data, please refer to the official repository.

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

Note

This dataset requires the following additional library to be installed:

  • h5py to load the dataset

Added in version 0.7.

__init__(root='data', subset='MMEarth', modalities=('aster', 'biome', 'canopy_height_eth', 'dynamic_world', 'eco_region', 'era5', 'esa_worldcover', 'sentinel1_asc', 'sentinel1_desc', 'sentinel2', 'sentinel2_cloudmask', 'sentinel2_cloudprod', 'sentinel2_scl'), modality_bands=None, normalization_mode='z-score', transforms=None)[source]#

Initialize the MMEarth dataset.

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

  • subset (str) – one of “MMEarth”, “MMEarth64”, or “MMEarth100k”

  • modalities (Sequence[str]) – list of modalities to load

  • modality_bands (dict[str, list[str]] | None) – dictionary of modality bands, see

  • normalization_mode (str) – one of “z-score” or “min-max”

  • transforms (Callable[[dict[str, Any]], dict[str, Any]] | None) – a function/transform that takes input sample dictionary and returns a transformed version

Raises:
__getitem__(index)[source]#

Return a sample from the dataset.

Normalization is applied to the data with chosen normalization_mode. In addition to the modalities, the sample contains the following raw metadata:

  • lat: latitude

  • lon: longitude

  • date: date

  • tile_id: tile identifier

Parameters:

index (int) – index to return

Returns:

dictionary containing the modalities and metadata of the sample

Return type:

dict[str, Any]

Changed in version 0.10: Removed avail_bands metadata, cast all other metadata to Tensor.

__len__()[source]#

Return the length of the dataset.

Returns:

length of the dataset

Return type:

int

plot(sample, show_titles=True, suptitle=None)[source]#

Plot a sample from the dataset as shown in fig. 2 from https://arxiv.org/pdf/2405.02771.

Added in version 0.8.

Parameters:
  • sample (dict[str, Any]) – A sample returned by __getitem__().

  • show_titles (bool) – Flag indicating whether to show titles above each panel.

  • suptitle (str | None) – Optional string to use as a suptitle.

Returns:

A matplotlib Figure with the rendered sample.

Return type:

Figure

__annotate_func__()[source]#

The type of the None singleton.