pygmt.Figure.solar
- Figure.solar(terminator='day_night', terminator_datetime=None, fill=None, pen=None, projection=None, region=None, frame=False, verbose=False, panel=False, perspective=False, transparency=None, **kwargs)
Plot day-night terminators and other sunlight parameters.
This method can plot the day-night terminator, and the civil, nautical, and astronomical twilights.
Full GMT docs at https://docs.generic-mapping-tools.org/6.7/solar.html.
Aliases
B = frame
G = fill
J = projection
R = region
T = terminator, +d/+z: terminator_datetime
V = verbose
W = pen
c = panel
p = perspective
t = transparency
- Parameters:
terminator (
Literal['astronomical','civil','day_night','nautical'], default:'day_night') –Set the type of terminator. Choose one of the following:
"astronomical": Astronomical twilight"civil": Civil twilight"day_night": Day-night terminator"nautical": Nautical twilight
Refer to https://en.wikipedia.org/wiki/Twilight for the definitions of different types of twilight.
terminator_datetime (
str|date|datetime|datetime64|Timestamp|None, default:None) – Set the date and time for the terminator calculation. It can be provided as a string or any datetime-like object recognized bypandas.to_datetime. The time can be specified in UTC or with a UTC offset of any precision [Default is the current UTC date and time].fill (
str|Pattern|None, default:None) – Set color or pattern for filling terminators [Default is no fill].pen (
str|None, default:None) – Set pen attributes for lines [Default is"0.25p,black,solid"].projection (
str|None, default:None) – projcode[projparams/]width|scale. Select map projection.region (
Sequence[float|str] |str|None, default:None) – [xmin, xmax, ymin, ymax] or xmin/xmax/ymin/ymax[+r][+uunit]. Specify the region of interest.frame (
Frame|Axis|Literal['none'] |str|Sequence[str] |bool, default:False) – Set frame and axes attributes for the plot. It can be a bool,"none", apygmt.params.Frameorpygmt.params.Axisobject. Raw GMT strings or sequences of strings are also supported for backward compatibility. Ifframe=True, the frame will be drawn with the default attributes. Ifframe="none", no frame will be drawn. Use apygmt.params.Frameorpygmt.params.Axisobject for more control over the attributes of the frame and axes. A tutorial is available at frame and axes attributes. Full documentation is at https://docs.generic-mapping-tools.org/6.7/gmt.html#b-full.verbose (
Literal['quiet','error','warning','timing','info','compat','debug'] |bool, default:False) – Select verbosity level [Full usage].panel (
int|Sequence[int] |bool, default:False) –Select a specific subplot panel. Only allowed when used in
Figure.subplotmode.Trueto advance to the next panel in the selected order.index to specify the index of the desired panel.
(row, col) to specify the row and column of the desired panel.
The panel order is determined by the
Figure.subplotmethod. row, col and index all start at 0.perspective (
Perspective|float|Sequence[float] |bool, default:False) – Select perspective view and set the viewpoint. Pass apygmt.params.Perspectiveobject to control the viewpoint. Alternatively, setperspective=Trueto reuse the perspective setting from the previous plotting method. It also accepts following shortcuts: a single value azimuth, a sequence of two values (azimuth, elevation), or a sequence of three values (azimuth, elevation, level). Refer topygmt.params.Perspectivefor meaning of the parameters.transparency (
float|None, default:None) – Set transparency level, in [0-100] percent range [Default is0, i.e., opaque]. Only visible when PDF or raster format output is selected. Only the PNG format selection adds a transparency layer in the image (for further processing).
Examples
Plot the day-night terminator at the current UTC date and time.
>>> import datetime >>> import pygmt
>>> fig = pygmt.Figure() >>> fig.coast(land="darkgreen", water="lightblue", projection="W10c", region="d") >>> fig.solar() >>> fig.show()
Plot the astronomical twilight at 8:52:18 on June 24, 1997 (time in UTC), with the night-section filled with navyblue at 75% transparency.
>>> import datetime >>> # Create a datetime object at 8:52:18 on June 24, 1997 (time in UTC) >>> date = datetime.datetime( ... year=1997, month=6, day=24, hour=8, minute=52, second=18 ... ) >>> fig = pygmt.Figure() >>> fig.coast(land="darkgreen", water="lightblue", projection="W10c", region="d") >>> fig.solar( ... terminator="astronomical", ... terminator_datetime=date, ... # Fill the night-section with navyblue at 75% transparency ... fill="navyblue@75", ... pen="1p,black", # Draw the terminator with a 1-point black line ... ) >>> fig.show()