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

Update nightshade.py to allow user-defined sub-solar coordinates #2375

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dsheward-astro
Copy link

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

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.
@CLAassistant
Copy link

CLAassistant commented Apr 25, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense in general to be able to use the functionality on different bodies. I am not sure the best approach for providing either a date or a sub-solar point, but this seems reasonable.

You should also add a few tests making sure it is producing the values you expect.

lib/cartopy/feature/nightshade.py Outdated Show resolved Hide resolved
Copy link
Contributor

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits. Looks like pre-commit is complaining about trailing whitespace (might be the line I pointed out). Feature seems like a nice add.

lib/cartopy/feature/nightshade.py Outdated Show resolved Hide resolved
@lgolston
Copy link
Contributor

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).

@greglucas greglucas dismissed dopplershift’s stale review June 8, 2024 20:35

The minor nits were resolved

@greglucas
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants