GlobBiomass#
- class torchgeo.datasets.GlobBiomass(paths='data', crs=None, res=None, measurement='agb', transforms=None, cache=True, checksum=False, time_series=False)[source]#
Bases:
RasterDatasetGlobBiomass dataset.
The GlobBiomass dataset consists of global pixelwise aboveground biomass (AGB) and growth stock volume (GSV) maps.
Definitions:
AGB: the mass, expressed as oven-dry weight of the woody parts (stem, bark, branches and twigs) of all living trees excluding stump and roots.
GSV: volume of all living trees more than 10 cm in diameter at breast height measured over bark from ground or stump height to a top stem diameter of 0 cm.
Units:
AGB: m3/ha
GSV: tons/ha (i.e., Mg/ha)
Dataset features:
Global estimates of AGB and GSV at ~100 m per pixel resolution (45,000 x 45,000 px)
Per-pixel uncertainty expressed as standard error
Dataset format:
Estimate maps are single-channel
Uncertainty maps are single-channel
The data can be manually downloaded from this website.
If you use this dataset in your research, please cite the following dataset:
Added in version 0.3.
- filename_regex = '\n ^(?P<tile>[NS][\\d]{2}[EW][\\d]{3})\n _(?P<measurement>(agb|gsv))\n '#
Regular expression used to extract date from filename.
The expression should use named groups. The expression may contain any number of groups. The following groups are specifically searched for by the base class:
date: used to calculatemintandmaxtforindexinsertionstart: used to calculatemintforindexinsertionstop: used to calculatemaxtforindexinsertion
When
separate_filesis True, the following additional groups are searched for to find other files:band: replaced with requested band name
- is_image = False#
True if the dataset only contains model inputs (such as images). False if the dataset only contains ground truth model outputs (such as segmentation masks).
The sample returned by the dataset/data loader will use the “image” key if is_image is True, otherwise it will use the “mask” key.
For datasets with both model inputs and outputs, the recommended approach is to use 2 RasterDataset instances and combine them using an IntersectionDataset.
- dtype = torch.float32#
- __init__(paths='data', crs=None, res=None, measurement='agb', transforms=None, cache=True, checksum=False, time_series=False)[source]#
Initialize a new GlobBiomass instance.
- Parameters:
paths (str | PathLike[str] | Iterable[str | PathLike[str]]) – one or more root directories to search or files to load
crs (CRS | None) – coordinate reference system (CRS) to warp to (defaults to the CRS of the first file found)
res (float | tuple[float, float] | None) – resolution of the dataset in units of CRS in (xres, yres) format. If a single float is provided, it is used for both the x and y resolution. (defaults to the resolution of the first file found)
measurement (str) – use data from ‘agb’ or ‘gsv’ measurement
transforms (Callable[[dict[str, Any]], dict[str, Any]] | None) – a function/transform that takes an input sample and returns a transformed version
cache (bool) – if True, cache file handle to speed up repeated sampling
checksum (bool) – if True, check the MD5 of the downloaded files (may be slow)
time_series (bool) – if True, stack data along the time series dimension [T, C, H, W]. If False, merge data into a [C, H, W] mosaic.
- Raises:
AssertionError – If measurement is not valid.
DatasetNotFoundError – If dataset is not found.
Added in version 0.9: The time_series parameter.
Changed in version 0.5: root was renamed to paths.
- filename_glob = '*_{}.tif'#
Glob expression used to search for files.
This expression should be specific enough that it will not pick up files from other datasets. It should not include a file extension, as the dataset may be in a different file format than what it was originally downloaded as.
- __annotate_func__()#
The type of the None singleton.
- __getitem__(index)[source]#
Retrieve input, target, and/or metadata indexed by spatiotemporal slice.
- Parameters:
index (slice | tuple[slice] | tuple[slice, slice] | tuple[slice, slice, slice]) – [xmin:xmax:xres, ymin:ymax:yres, tmin:tmax:tres] coordinates to index.
- Returns:
Sample of input, target, and/or metadata at that index.
- Raises:
IndexError – If index is not found in the dataset.
- Return type: