Use of MWD data for detecting discontinuities