JuliaSpace / SatelliteToolbox.jl

A toolbox for satellite analysis written in julia language.
MIT License
249 stars 33 forks source link

Make the GFC parser more generic #17

Closed helgee closed 5 years ago

helgee commented 5 years ago

I have successfully used the parse_gfc function to parse a lunar gravity field. But I had to massage the file a little to make it work, e.g. change some constant from Fortran-style 1D+0.0 to normal scientific notation and change gravity_constant in the header to earth_gravity_constant.

Could the parser be made more generic so that it handles other celestial bodies (or rather non-standard GFC files)? These can be found here for example (if the website is not down, as it is now).

ronisbr commented 5 years ago

Excellent idea! This should be easy. In fact, I have one proposal. See if this is good:

  1. parse_gfc will create a new structure called GFC probably with the header information stored in Dict.
  2. Then we need another function to convert this raw data into gravitational coefficients.
  3. The compute_u and compute_g function will use the coefficients, leading to a fast algorithm.

One question (the website is still down): the algorithm used to compute the gravitational force in other celestial bodies is precisely the same as the one we have now right? In this case, we can have a very general function to compute this.

helgee commented 5 years ago

One question (the website is still down): the algorithm used to compute the gravitational force in other celestial bodies is precisely the same as the one we have now right? In this case, we can have a very general function to compute this.

Yes 👍

When the website is back I will check what kind of differences can be expected.

ronisbr commented 5 years ago

Hi @helgee !

I found this specification for the GFC files:

http://icgem.gfz-potsdam.de/ICGEM-Format-2011.pdf

I will try to implement this. It should be a little difficult because it is also used for models that consider tides. Hence, if I do this, we will have a very generic system to compute gravitational forces!

ronisbr commented 5 years ago

Hi @helgee

This problem should be fixed in master now. You can parse your file (with FORTRAN numbers, and gravity_constant header instead of earth_gravity_constant) using:

G = create_gravity_models_coefs(parse_icgem(filename))

Then, you can use the coefficients in G to compute the gravity with the function compute_g.

Please, let me know if this works!