yatsm.mapping.prediction module

Functions relevant for mapping statistical model predictions or fits

yatsm.mapping.prediction.get_coefficients(date, result_location, image_ds, bands, coefs, prefix='', amplitude=False, after=False, before=False, qa=False, ndv=-9999, pattern='yatsm_r*', warn_on_empty=False)[source]

Output a raster with coefficients from CCDC

Parameters:
  • date (int) – Ordinal date for prediction image
  • result_location (str) – Location of the results
  • bands (list) – Bands to predict
  • coefs (list) – List of coefficients to output
  • image_ds (gdal.Dataset) – Example dataset
  • prefix (str, optional) – Use coef/rmse with refit prefix (default: ‘’)
  • amplitude (bool, optional) – Map amplitude of seasonality instead of individual coefficient estimates for sin/cosine pair (default: False)
  • after (bool, optional) – If date intersects a disturbed period, use next available time segment (default: False)
  • before (bool, optional) – If date does not intersect a model, use previous non-disturbed time segment (default: False)
  • qa (bool, optional) – Add QA flag specifying segment type (intersect, after, or before) (default: False)
  • ndv (int, optional) – NoDataValue (default: -9999)
  • 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 tuple (np.ndarray, list) containing the 3D numpy.ndarray of

the coefficients (coefficient x band x pixel), and the band names for the output dataset

Return type:

tuple

yatsm.mapping.prediction.get_prediction(date, result_location, image_ds, bands='all', prefix='', after=False, before=False, qa=False, ndv=-9999, pattern='yatsm_r*', warn_on_empty=False)[source]

Output a raster with the predictions from model fit for a given date

Parameters:
  • date (int) – Ordinal date for prediction image
  • result_location (str) – Location of the results
  • image_ds (gdal.Dataset) – Example dataset
  • bands (str, list) – Bands to predict - ‘all’ for every band, or specify a list of bands
  • prefix (str, optional) – Use coef/rmse with refit prefix (default: ‘’)
  • after (bool, optional) – If date intersects a disturbed period, use next available time segment
  • before (bool, optional) – If date does not intersect a model, use previous non-disturbed time segment
  • qa (bool, optional) – Add QA flag specifying segment type (intersect, after, or before)
  • 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 3D numpy.ndarray containing the prediction for each band,

for each pixel

Return type:

np.ndarray