Topological analysis and characterization of discrete scalar fields