Skip to content

Instantly share code, notes, and snippets.

@ceholden
Last active May 2, 2017 19:44
Show Gist options
  • Save ceholden/84dc39faa96410d99434cf07a9feccd0 to your computer and use it in GitHub Desktop.
Save ceholden/84dc39faa96410d99434cf07a9feccd0 to your computer and use it in GitHub Desktop.
LCMAP CCDC results and products

CCDC Results to Products Guide

Results storage

The CCDC algorithm records its results as "attributes" of each time series segment found during each pixel's record. These "attributes" are stored in the original MATLAB code as an array of structures, with each pixel ran having at least one segment or more than one if there was a break detected. As each task running the MATLAB implementation finishes a pixel in a line, the "record of change" (rec_cg) from this pixel is appended to the existing array of structures. In Python, NumPy has an equivalent data structure in the "structured array".

The attributes to store for each segment are:

  • pos: position
    • Currently recorded as a “unraveled” 2d array reference (col + row * ncol), but you could also record “x” and “y” in pixel positions or projected coordinates
  • t_start: start date of segment
  • t_end: end date of segment
  • t_break: break date of segment (0 is NA value for no break detected)
  • coefs: coefficient for models of segments
    • (p features across n bands, usually taken as 8 coefficients by 7 bands)
  • rmse: RMSE of model segments
    • per n bands, usually 7
  • magnitude: magnitude of change
    • per n, usually 7, where 0.0 is the NA value for no break detected
  • change_prob: Probability of change
    • Metric describing how many observations at the end of a segment looked like change
    • Recorded as 1 if there is a change detected and confirmed
    • Recorded as a fraction for segments ending at the end of a time series record
    • See: TrendSeasonalFit_v12_30ARDLine.m:823
  • category: QA/QC value describing the type of CCDC model fit
    • a “full” algorithm run
    • one with a reduced set of coefficients
    • one fit to permanent snow, etc.
  • num_obs: Number of clear observations used within the segment

These attributes are listed in the MATLAB CCDC implementation in TrendSeasonalFit_v12_30ARDLine.m:163. Additional attributes are recorded during the land cover classification phase:

  • class: Land cover category
  • classQA: Land cover category QA/QC value
    • Taken as the "margin" of the number of votes for the most likely class and the second most likely class from RandomForest, normalized by the total number of trees in the ensemble
    • 100 * (votes_1 - votes_2) / n_tree
    • Class_Line1_4.m:93

For products that describe the second most likely land cover class per segment, one would also need to record a class2 and class2QA when performing the land cover classification.

Products

Land Cover

  1. Primary class
  2. Primary class probability
  3. Secondary class
    • Not implemented yet
    • Attributes
      • pos, t_start, and t_end
      • class2
  4. Secondary class probability
    • Not implemented yet
    • Attributes
      • pos, t_start, and t_end
      • class2QA

Land Change

  1. Change date
  2. Change magnitude
    • ShowLCMap.m:182
    • Taken as the L2-norm of the magnitude recorded for each band
    • Attributes:
      • pos, t_start, and t_end
      • t_break
      • magnitude
  3. Change transitions (from-to)
    • Represents full class transition matrix
    • Attributes:
      • pos, t_start, and t_end
      • class and class2

Land Cover Condition

  1. Condition (TC Brightness slope)
    • Currently implemented as EVI ShowLCMap.m:158
    • Note that EVI is derived from the model fits of the raw Landsat bands (blue, red, nir)
    • Attributes:
      • pos, t_start, and t_end
      • coefs
  2. Condition (TC Greenness slope)
    • Attributes:
      • pos, t_start, and t_end
      • coefs
  3. Condition (TC Wetness slope)
    • Attributes:
      • pos, t_start, and t_end
      • coefs

Other

  1. Time segment length
    • Not implemented yet
    • Attributes:
      • pos, t_start, and t_end
  2. Time since last change
    • Not implemented yet
    • Attributes
      • pos, t_start, and t_end
      • t_break
  3. Number of observations
  4. Model fit attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment