NAIP#

class torchgeo.datasets.NAIP(paths='data', crs=None, res=None, bands=None, transforms=None, cache=True, time_series=False)[source]#

Bases: RasterDataset

National Agriculture Imagery Program (NAIP) dataset.

The National Agriculture Imagery Program (NAIP) acquires aerial imagery during the agricultural growing seasons in the continental U.S. A primary goal of the NAIP program is to make digital ortho photography available to governmental agencies and the public within a year of acquisition.

NAIP is administered by the USDA’s Farm Service Agency (FSA) through the Aerial Photography Field Office in Salt Lake City. This “leaf-on” imagery is used as a base layer for GIS programs in FSA’s County Service Centers, and is used to maintain the Common Land Unit (CLU) boundaries.

If you use this dataset in your research, please cite it using the following format:

filename_glob = 'm_*.*'#

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.

filename_regex = '\n        ^m\n        _(?P<quadrangle>\\d+)\n        _(?P<quarter_quad>[a-z]+)\n        _(?P<utm_zone>\\d+)\n        _(?P<resolution>\\d+)\n        _(?P<date>\\d+)\n        (?:_(?P<processing_date>\\d+))?\n        \\..*$\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 calculate mint and maxt for index insertion

  • start: used to calculate mint for index insertion

  • stop: used to calculate maxt for index insertion

When separate_files is True, the following additional groups are searched for to find other files:

  • band: replaced with requested band name

all_bands: tuple[str, ...] = ('R', 'G', 'B', 'NIR')#

Names of all available bands in the dataset

rgb_bands: tuple[str, ...] = ('R', 'G', 'B')#

Names of RGB bands in the dataset, used for plotting

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

Plot a sample from the dataset.

Parameters:
  • sample (dict[str, Any]) – a sample returned by RasterDataset.__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

Changed in version 0.3: Method now takes a sample dict, not a Tensor. Additionally, possible to show subplot titles and/or use a custom suptitle.