ortk95 / planetmapper

PlanetMapper: An open source Python package for visualising, navigating and mapping Solar System observations
https://planetmapper.readthedocs.io
MIT License
10 stars 1 forks source link

Allow customisation of the altitude when converting from `lonlat` coordinates #365

Closed ortk95 closed 3 months ago

ortk95 commented 3 months ago

Added an additional alt keyword only parameter to transformations from longitude/latitude coordinates, which allows the altitude of the point to be specified. For example, you can now specify the altitude with methods like:

body.lonlat2radec(..., alt=500)
body.test_if_lonlat_visible(..., alt=500)
body.visible_lonlat_grid_radec(alt=500)

The altitude is specified in kilometers above the planet's surface, and defaults to alt=0 (so the default behaviour is unchanged).

This example shows how this new PlanetMapper functionality can be used to plot a longitide/latitude grid at an altitude of 10,000km above the surface (i.e. the 1-bar level) of Jupiter:

body = planetmapper.Body('Jupiter', utc='2005-01-01T00:00:00')
body.plot_wireframe_radec()
for ras, decs in body.visible_lonlat_grid_radec(alt=1e4):
    plt.plot(ras, decs, color='r', alpha=0.5)
plt.show()

image

The calculation of if a point is visible (Body.test_if_lonlat_visible) has also been rewritten to work correctly with arbitrary altitudes. If the altitude is zero (i.e. the point is on the surface), the calculation is unchanged, using the SPICE illumf function. However, for a non-zero altitude, the calculation now searches for any intercept with the target's surface along the line of sight from the observer (using SPICE's sincpt), and uses this to identify if the point is visible, or obscured by the target. This ensures that points at altitude that are "behind" the target, but still visible, are calculated correctly.

Closes #359.

Pull request checklist

See CONTRIBUTING.md for more details.

coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9486249194

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Totals Coverage Status
Change from base Build 9481105926: 0.002%
Covered Lines: 2960
Relevant Lines: 2972

💛 - Coveralls