yatsm.mapping.changes module

Functions relevant for mapping abrupt changes

yatsm.mapping.changes.get_change_date(start, end, result_location, image_ds, first=False, out_format='%Y%j', magnitude=False, ndv=-9999, pattern='yatsm_r*', warn_on_empty=False)[source]

Output raster with changemap

Parameters:
  • start (int) – Ordinal date for start of map records
  • end (int) – Ordinal date for end of map records
  • result_location (str) – Location of results
  • image_ds (gdal.Dataset) – Example dataset
  • first (bool) – Use first change instead of last
  • out_format (str, optional) – Output date format
  • magnitude (bool, optional) – output magnitude of each change?
  • ndv (int, optional) – NoDataValue
  • pattern (str, optional) – filename pattern of saved record results
  • warn_on_empty (bool, optional) – Log warning if result contained no result records (default: False)
Returns:

A 2D np.ndarray array containing the changes between the

start and end date. Also includes, if specified, a 3D np.ndarray of the magnitude of each change plus the indices of these magnitudes

Return type:

tuple

yatsm.mapping.changes.get_change_num(start, end, result_location, image_ds, ndv=-9999, pattern='yatsm_r*', warn_on_empty=False)[source]

Output raster with changemap

Parameters:
  • start (int) – Ordinal date for start of map records
  • end (int) – Ordinal date for end of map records
  • result_location (str) – Location of results
  • image_ds (gdal.Dataset) – Example dataset
  • ndv (int, optional) – NoDataValue
  • pattern (str, optional) – filename pattern of saved record results
  • warn_on_empty (bool, optional) – Log warning if result contained no result records (default: False)
Returns:

2D numpy array containing the number of changes

between the start and end date; list containing band names

Return type:

np.ndarray

yatsm.mapping.changes.get_magnitude_indices(results)[source]

Finds indices of result containing magnitude of change information

Parameters:results (iterable) – list of result files to check within
Returns:
indices containing magnitude change information from the
tested indices
Return type:np.ndarray
Raises:KeyError – Raise KeyError when a required result output is missing from the saved record structure