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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/cartopy/feature/nightshade.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class Nightshade(ShapelyFeature):
def __init__(self, date=None, delta=0.1, refraction=-0.83,
color="k", alpha=0.5, **kwargs):
color="k", alpha=0.5, sub_solar_coords=None, **kwargs):
dsheward-astro marked this conversation as resolved.
Show resolved Hide resolved
"""
Shade the darkside of the Earth, accounting for refraction.

Expand Down Expand Up @@ -47,8 +47,12 @@ def __init__(self, date=None, delta=0.1, refraction=-0.83,

# Returns the Greenwich hour angle,
# need longitude (opposite direction)
lat, lon = _solar_position(date)
if sub_solar_coords is None: #if not specified proceed as usual
lat, lon = _solar_position(date)
else:
lat, lon = sub_solar_coords #if specified, use given coordinates
pole_lon = lon

if lat > 0:
pole_lat = -90 + lat
central_lon = 180
Expand Down
Loading