Inversion of Magnetic Data using Learned Dictionaries and Scale Space