1. A method of controlling a chemical mechanical polishing operation, comprising: polishing a substrate; storing a library having a plurality of reference spectra, each reference spectrum of the plurality of reference spectra having a stored associated value, each stored associated value representing a time during a polishing operation at which the reference spectrum of the plurality of reference spectra with the associated value is expected to be observed, wherein each stored associated value was generated prior to polishing of the substrate; measuring a sequence of spectra in-situ during polishing to obtain measured spectra; for each measured spectrum of the sequence of spectra, finding a best matching reference spectrum from the plurality of reference spectra to generate a sequence of best matching reference spectra; determining the stored associated value for each best matching spectrum from the sequence of best matching reference spectra to generate a sequence of values; fitting a linear function to the sequence of values; calculating a time at which the linear function equals a target value; and halting polishing at the calculated time.