Determining accleration due to gravity

Yes I made a huge error I thought for some strange reason the poster wanted to determine the direction of the magnetic field and not the acceleration due to gravity.

I believe with a full-up IMU you could get the direction of the acc. due to g.