fatiando / boule

Reference ellipsoids for geodesy and geophysics
https://www.fatiando.org/boule
BSD 3-Clause "New" or "Revised" License
38 stars 17 forks source link

Remove inhertiance between Ellipsoid, Sphere, TriaxialEllipsoid #124

Closed leouieda closed 2 years ago

leouieda commented 2 years ago

All three classes need to implement fundamentally different things. While the parameters could be retained somewhat (spheres can have 0 flattening but what about triaxial ellipsoids?), the gravity inputs are different and they can calculate fundamentally different things. Coordinate conversions also don't make much sense when transitioning.

So while geometrically both Ellipsoid and Sphere are special cases of TriaxialEllipsoid, in practice they have very little in common. So it's better to leave the classes as stand-alone and only implement the parameters/methods that make sense for that class.

My proposal for Sphere is:

  1. Only define the flattenings, semi-axis, and eccentricities for pymap3d compatibility.
  2. No coordinate conversion methods.
  3. No surface radius or mean radius (it's just the radius).
  4. No gravity at pole and equator (only used for Somigliana which is not valid for the sphere).
  5. Include normal gravity and normal gravitation

The triaxial ellipsoid is already not inheriting so there is nothing to be done there right now.

leouieda commented 2 years ago

cc @santisoler