Frame for GeoMagneticElements

Dear all,

I am using the IGRF2015 model in Orekit to check our own implementation of IGRF12. I got the data file from here: https://www.orekit.org/projects/orekit/repository/revisions/master/raw/src/test/resources/earth/IGRF.COF
It works, the method GeoMagneticField.getModelName() returns ‘IGRF2015’.

However, I am not sure in which frame the magnetic field vector is returned when calling the method GeoMagneticElements.getFieldVector(). In the unit test at https://gitlab.orekit.org/orekit/orekit/blob/master/src/test/java/org/orekit/models/earth/GeoMagneticFieldTest.java, the implementation is compared to reference data from https://www.ngdc.noaa.gov/geomag/calculators/magcalc.shtml#igrfwmm, which would be in North-East-Down frame.
I tried both the TOD frame and a TopocentricFrame defined on the GeodeticPoint used to compute the magnetic field vector, but I am not sure which one I have to use.

Thank you,
Best regards
Clément Jonglez

Neither TOD not Topocentric frame are correct, but Topocentric frame is almost good.
The coordinates are really in North-East-Down frame but TopocentricFrame is East-North-Zenith.
So you can use Topocentric frame if you exchange the coordinates as follows:

   Vector3D fieldInNED = geomagneticElements.getFieldVector();
   Vector3D fieldInTopo = new Vector3D(fieldInNED.getY(),
                                       fieldInNED.getX(),
                                      -fieldInNED.getZ());

It works now when converting from NED as you described, thank you.

Cheers
Clément Jonglez