Hello,
I am having trouble creating the gravity field I want from a .gfc file using Orekit via Matlab. I’m sure that I just don’t fully understand how the GravityFieldFactory.addPotentialCoefficientsReader function works.
First I went to this website: ICGEM International Center for Global Gravity Field Models
I downloaded AIUB-GRL350A and placed it in my Matlab workspace.
Below is the code I am using:
org.orekit.forces.gravity.potential.GravityFieldFactory.clearPotentialCoefficientsReaders();
org.orekit.forces.gravity.potential.GravityFieldFactory.addPotentialCoefficientsReader(org.orekit.forces.gravity.potential.ICGEMFormatReader(‘AIUB-GRL350A.gfc’, true));
gravityField = org.orekit.forces.gravity.potential.GravityFieldFactory.getNormalizedProvider(degree, order);
I am receiving the following error:
“org.orekit.errors.OrekitException: no gravity field data loaded”
Any help to get me started would be welcome. I think I just don’t fully understand what a .gfc file does or how to run GravityFieldFactory properly.
Thank you,
Erin
It worked!
Apparently all I had to do was to put the .gfc file into the orekit-data.zip file, under the Potential folder.
Thanks very much for your help.
Erin
Beware that Orekit will read the orekit-data directory or zip file automatically and will take the first gravity file that matches its “potential coefficients readers”.
This time it’s not a problem since you cleared the readers and explicitly gave Orekit the name of the file to read.
But later, if you use the default reader and want to orbit around Earth, beware that it doesn’t take the Moon gravity file instead of the Earth’s one !