This is a very old post, but the question of 2D calibration for magnetometers keeps coming up on various forums.
In particular a 2D magnetometer is useful as a navigational compass for boats and land vehicles, where the usual methods for 3D magnetometer calibration can’t be used.
So, I’ve set up a Github repository with both Python and revised Matlab/Gnu Octave methods for 2D magnetometer calibration.