  Given a real-valued function $f$ defined over a manifold $M$ embedded in
$\mathbb{R}^d$, we are interested in recovering structural information about
$f$ from the sole information of its values on a finite sample $P$. Existing
methods provide approximation to the persistence diagram of $f$ when geometric
noise and functional noise are bounded. However, they fail in the presence of
aberrant values, also called outliers, both in theory and practice.
  We propose a new algorithm that deals with outliers. We handle aberrant
functional values with a method inspired from the k-nearest neighbors
regression and the local median filtering, while the geometric outliers are
handled using the distance to a measure. Combined with topological results on
nested filtrations, our algorithm performs robust topological analysis of
scalar fields in a wider range of noise models than handled by current methods.
We provide theoretical guarantees and experimental results on the quality of
our approximation of the sampled scalar field.
