Skip to content
Open
Changes from 2 commits
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
13 changes: 11 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_point=None, **kwargs):
"""
Shade the darkside of the Earth, accounting for refraction.

Expand All @@ -29,6 +29,11 @@ def __init__(self, date=None, delta=0.1, refraction=-0.83,
refraction : float
The adjustment in degrees due to refraction,
thickness of the solar disc, elevation etc...
sub_solar_point : tuple of latitude, longitude
Comment thread
dsheward-astro marked this conversation as resolved.
Outdated
The coordinates in degrees of the point at which the sun is directly
overhead. If both sub_solar_point and date are provided, sub_solar_point
takes precedence.

Comment thread
dsheward-astro marked this conversation as resolved.
Outdated

Note
----
Expand All @@ -47,8 +52,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_point is None: #if not specified proceed as usual
lat, lon = _solar_position(date)
else:
lat, lon = sub_solar_point #if specified, use given coordinates
pole_lon = lon

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