The anisotropic oscillator on the 2D sphere and the hyperbolic plane