1. A method of generating a library of reference spectra, comprising: receiving in a computer user input identifying a first thickness value for an outermost first layer of a substrate; receiving in the computer user input identifying a plurality of different second thickness values for a second layer of the substrate underlying the first layer; receiving in the computer user input identifying a plurality of different third thickness values for a third layer of the substrate underlying the second layer; wherein the plurality of different second thickness values and the plurality of different third thickness values each represent a wafer-to-wafer thickness variation range for a portion on the substrate having a single thickness for the second layer and the third layer, respectively; for each combination of a second thickness value from the plurality of different second thickness values and a third thickness value from the plurality of different third thickness, calculating in the computer a reference spectrum using an optical model of the substrate based on the first thickness value, second thickness value and third thickness value, to generate a plurality of reference spectra.