Geomagnetic spherical harmonic analyses: 1. Techniques