TERRA

LXSS_LLLL_PPPRRR_YYYYMMDD_yyyymmdd_CX_TX (e.g., LC08_L2SP_039037_20150728_20200318_02_T1) L Landsat X Sensor (“O” = OLI; “T” = TIRS; “C” = OLI/TIRS) SS Satellite (“08” = Landsat 8, “09” = Landsat 9) LLLL Processing correction level (“L2SP” if SR and ST are generated or “L2SR” if ST could not be generated) PPP Path RRR Row YYYY Year of acquisition MM Month of acquisition DD Day of acquisition yyyy Year of Level 2 processing mm Month of Level 2 processing dd Day of Level 2 processing CX Collection number (“02”) TX Collection category ( “T1” = Tier 1; “T2” = Tier 2)

calc_r0(ds, var, product_name=None)

Calculate the Albedo.

Parameters
  • ds (xr.Dataset) – Input data.

  • var (str) – Name of the variable in which to store the normalized difference.

Returns

Output data.

Return type

xr.Dataset

calc_normalized_difference(ds, var, bands=['nir', 'red'])

Calculate the normalized difference of two bands.

Parameters
  • ds (xr.Dataset) – Input data.

  • var (str) – Name of the variable in which to store the normalized difference.

  • bands (list, optional) – The two bands to use to calculate the norm. difference, by default [“nir”, “red”].

Returns

Output data.

Return type

xr.Dataset

espa_api(endpoint, verb='get', body=None, uauth=None)

Suggested simple way to interact with the ESPA JSON REST API

download(folder, latlim, lonlim, timelim, product_name, req_vars, variables=None, post_processors=None, extra_search_kwargs={'eo:cloud_cover': {'gte': 0, 'lt': 30}}, max_attempts=24, wait_time=300)

Order, Download and preprocess Landsat scenes.

Parameters
  • folder (str) – Path to folder in which to store results.

  • latlim (list) – Latitude limits of area of interest.

  • lonlim (list) – Longitude limits of area of interest.

  • timelim (list) – Period for which to prepare data.

  • product_name (str) – Name of the product to download.

  • req_vars (list) – Which variables to download for the selected product.

  • variables (dict, optional) – Metadata on which exact layers need to be requested from the server, by default None.

  • post_processors (dict, optional) – Functions per variable that should be applied to the variable, by default None.

  • extra_search_kwargs (dict, optional) – Extra keywords passed to the scene searching API, by default {‘eo:cloud_cover’: {‘gte’: 0, ‘lt’: 30}}

  • max_attempts (int, optional) – Maximum number of retries, by default 24.

  • wait_time (int, optional) – Wait time in seconds between retries, by default 300.

Returns

Dataset with the requested variables.

Return type

xr.Dataset

Raises

ValueError – Raised when not all found scenes could be downloaded within the max_attempts.