cartopy
cartopy copied to clipboard
Update nightshade.py to allow user-defined sub-solar coordinates
This allows for the specification of the sub solar coordinates directly, rather than calculating them using the date. This increases the usefulness of nightshade to those of us using cartopy for non-Earth bodies.
Rationale
Currently Nightshade produces the shade based off the sub-solar point at a defined time, based on the Earth. As cartopy is used for modelling other solar-system bodies, such as the Moon, which will have differing sub-solar points at a given time, the current use case for Nightshade is exclusive to the Earth. By allowing for user-defined sub-solar coordinates, this use case is extended to any sphere.
Implications
Nightshade is now also useable for Non-Earth bodies
The documentation should still be adjusted here (main docstring still says "Shade the darkside of the Earth..."; which is no longer true for Nightshade, but is still true that_solar_position is specific to Earth).
@dsheward-astro, would you be able to add a quick test for this? Let me know if you want any pointers for where to add it.
I also see that you added the subsolar point as (lat, lon)
, is that the order we are wanting all of our public facing conventions to be? In all of our plot functions we generally have (lon, lat)
due to the x, y ordering. But this also seems fine and is documented so I don't have a strong preference either way, maybe a +0.1 towards (lon, lat)
if I had to choose.