Such a function does exist, it's in the Function nodes, Displacement to Scalar, Displacement to Colour. But in the case of the Crater Shader there is both negative and positive displacement so to get a mask you'd have to adjust the crater shader settings, which would change the output you were getting. But you *could* use a copy of your crater shader and adjust the rim height, or other parameters, to get a correct mask with the warping...
- Oshyan