Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to convert from geodetic and spherical coordinates to Cartesian coordinats #165

Closed
MarkWieczorek opened this issue Mar 17, 2024 · 6 comments
Labels
enhancement Idea or request for a new feature

Comments

@MarkWieczorek
Copy link
Contributor

In some cases, it is necessary to determine the Cartesian coordinates that correspond to a set of spherical or geodetic coordinates. The equations are trivial, and I propose adding the methods:

  • spherical_to_cartesian
  • geodetic_to_cartesian

These will be useful regarding my comments about the InSight lander....

@MarkWieczorek MarkWieczorek added the enhancement Idea or request for a new feature label Mar 17, 2024
@Phssilva
Copy link

In which class do you think these methods should be added?

@MarkWieczorek
Copy link
Contributor Author

I see two possible ways to do this, and it might even make sense to do both.

First, we could just create some generic functions in the top level namespace to do the transformations, and then to use these internally (where needed) in the ellipsoid classes. Necessary low level functionality would include

  • spherical_to_cartesian
  • cartesian_spherical
  • geodetic_to_cartesian
  • cartesian_geodetic

Second, we could create a method like Ellipsoid.cartesian_coordinates(latitude, longitude, height=None, geodetic=true). I don't think it would make sense to input (x, y, z) coordinates to an ellipsoid, but we really should have an easy way to go from cartesian to spherical, and this could be done using the functions of the first approach.

@Phssilva
Copy link

Hello, I cloned the project and as usual, I always run the test before starting to edit the code. In this case, when the test is already failing due to redundancy, what do you recommend? I couldn't find any redundancy in the init.py file. Is there any related issue regarding this?

@leouieda
Copy link
Member

@Phssilva see my comment on fatiando/ensaio#67

@leouieda
Copy link
Member

@MarkWieczorek I think we could have:

  1. Functions spherical_to_cartesian and cartesian_to_spherical. Neither of these require knowledge of the reference ellipsoid or reference sphere. They could be in a new boule/_transformations.py module.
  2. Methods Ellipsoid.geodetic_to_cartesian and Ellipsoid.cartesian_to_geodetic. They do require knowledge of the ellipsoid so it makes sense to have them here.

Since they don't rely on each other, they could also be implemented in 2 separate pull requests.

@MarkWieczorek
Copy link
Contributor Author

I'm going to close this, as the linked proposal supercedes this discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Idea or request for a new feature
Projects
None yet
Development

No branches or pull requests

3 participants