eumap.datasets.eo.utils.GLADLandsat

class GLADLandsat(username, password, parallel_download=4, filter_additional_qa=True, verbose=True)[source]

Bases: object

Automation to download and process Landsat ARD images provided GLAD [1,2].

Parameters
  • username (str) – Username to access the files [3].

  • password (str) – Password to access the files [3].

  • parallel_download (int) – Number of files to download in parallel.

  • filter_additional_qa (bool) – Use True to remove pixels flagged as additional cloud (11 to 17 - table 3 in [2]).

  • verbose (bool) – Use True to print the progress of all steps.

References

[1] User Manual - GLAD Landsat ARD

[2] Remote Sensing paper (Potapov, et al, 2020)

[3] User Registration - GLAD Landsat ARD

Methods

percentile_agg

Download, read and aggregate multiple dates in different percentiles.

read

Download and read multiple dates for a specific tile.

percentile_agg(tile, start, end, p, clear_sky=True, min_clear_sky=0.2, n_jobs=7, output_dir=None, unit8=True)[source]

Download, read and aggregate multiple dates in different percentiles.

Parameters
  • tile (str) – GLAD tile id to be processed according to [1].

  • start (str) – Start date format ({YEAR}-{INTERVAL_ID} - 2000-1). The INTERVAL_ID ranges from 1 to 23 according to [2].

  • end (str) – End date format ({YEAR}-{INTERVAL_ID} - 2000-1). The INTERVAL_ID ranges from 1 to 23 according to [2].

  • p (List) – A list with the percentiles values between 0 and 100.

  • clear_sky (bool) – Use True to keep only the clear sky pixels, which are 1, 2, 5 and 6 according to quality flag band (Table 3 in [3]). For filter_additional_qa=False the pixels 11 to 17 are also considered clear sky.

  • min_clear_sky (bool) – Minimum percentage of clear sky pixels in the tile to keep a specific data, otherwise remove it from the result.

  • n_jobs – Number of jobs to process the spectral bands in parallel. More then 7 is meaningless and don’t improve the performance.

  • output_dir (Optional[Path]) – If provided save the result to this folder. By default is None and no files are saved to disk.

  • unit8 (bool) – Use True to convert the read data to unit8.

Returns

The read data, the Path for a empty base raster and the saved files (only if output_dir=True).

Return type

Tuple[Numpy.array, List[str], Path]

References

[1] File glad_ard_tiles.shp (GLAD Landsat ARD Tools V1.1)

[2] File 16d_intervals.xlsx (GLAD Landsat ARD Tools V1.1)

[3] Remote Sensing paper (Potapov, et al, 2020)

Examples

>>> from eumap.datasets.eo import GLADLandsat
>>> 
>>> # Do the registration here
>>> # https://glad.umd.edu/ard/user-registration
>>> username = '<YOUR_USERNAME>'
>>> password = '<YOUR_PASSWORD>'
>>> glad_landsat = GLADLandsat(username, password, verbose=True)
>>> data, base_raster, _ = glad_landsat.percentile_agg('092W_47N', '2020-6', '2020-10', 
>>>                         p=[25,50,75], output_dir='./glad_landsat_ard_percentiles')
>>> print(f'Shape of data: {data.shape}')
read(tile, start, end, clear_sky=True, min_clear_sky=0.2)[source]

Download and read multiple dates for a specific tile. The images are read on-the-fly without save the download files in disk.

Parameters
  • tile (str) – GLAD tile id to be processed according to [1].

  • start (str) – Start date format ({YEAR}-{INTERVAL_ID} - 2000-1). The INTERVAL_ID ranges from 1 to 23 according to [2].

  • end (str) – End date format ({YEAR}-{INTERVAL_ID} - 2000-1). The INTERVAL_ID ranges from 1 to 23 according to [2].

  • clear_sky (bool) – Use True to keep only the clear sky pixels, which are 1, 2, 5 and 6 according to quality flag band (Table 3 in [3]). For filter_additional_qa=False the pixels 11 to 17 are also considered clear sky.

  • min_clear_sky (float) – Minimum percentage of clear sky pixels in the tile to keep a specific data, otherwise remove it from the result.

Returns

The read data, the accessed URLs and the Path for a empty base raster.

Return type

Tuple[Numpy.array, List[str], Path]

References

[1] File glad_ard_tiles.shp (GLAD Landsat ARD Tools V1.1)

[2] File 16d_intervals.xlsx (GLAD Landsat ARD Tools V1.1)

[3] Remote Sensing paper (Potapov, et al, 2020)

Examples

>>> from eumap.datasets.eo import GLADLandsat
>>> 
>>> # Do the registration in
>>> # https://glad.umd.edu/ard/user-registration
>>> username = '<YOUR_USERNAME>'
>>> password = '<YOUR_PASSWORD>'
>>> glad_landsat = GLADLandsat(username, password, verbose=True)
>>> data, urls, base_raster = glad_landsat.read('092W_47N', '2020-6', '2020-10')
>>> print(f'Data shape: {data.shape}')