Partial homogeneity based high-resolution nuclear magnetic resonance spectra under inhomogeneous magnetic fields