yatsm.mapping.utils module

Utilities for turning YATSM record results into maps

Also stores definitions for model QA/QC values

yatsm.mapping.utils.find_indices(record, date, after=False, before=False)[source]

Yield indices matching time segments for a given date

Parameters:
  • record – Saved model result
  • date – Ordinal date to use when finding matching segments
  • after – If date intersects a disturbed period, use next available time segment
  • before – If date does not intersect a model, use previous non-disturbed time segment
Yields:

tuple

(int, np.ndarray) the QA value and indices of record

containing indices matching criteria. If before or after are specified, indices will be yielded in order of least desirability to allow overwriting – before indices, after indices, and intersecting indices.

yatsm.mapping.utils.find_result_attributes(results, bands, coefs, prefix='')[source]

Returns attributes about the dataset from result files

Parameters:
  • results – Result filenames
  • bands – Bands to describe for output
  • coefs – Coefficients to describe for output
  • prefix – Search for coef/rmse results with given prefix (default: ‘’)
Returns:

Tuple containing list of indices for output bands and output

coefficients, bool for outputting RMSE, list of coefficient names, str design specification, and OrderedDict design_info (i_bands, i_coefs, use_rmse, design, design_info)

Return type:

tuple

Raises:

KeyError – Raise KeyError when a required result output is missing from the saved record structure