Spectral estimation on a sphere in geophysics and cosmology