Currently, the sunrise/sunset lines need to be added separately which is a hassle.
I am imagining that two additional parameters can be added (latitude/longitude), which defaults to None (optional) and when they are both specified, then sunset/sunrise lines are added.
fig, ax = plt.subplots(figsize=(6, 3))
_ = solarpy.plotting.plot_intraday_heatmap(
time=data.index,
values=data["ghi"],
cmap=cmap,
norm=norm,
colorbar_label="GHI [W/m²]",
ax=ax, # pass in existing axes
)
# Overlay sunrise and sunset times
sun_rise_set = pvlib.solarposition.sun_rise_set_transit_spa(
pd.date_range(data.index.min(), data.index.max(), freq="1d"),
meta["latitude"],
meta["longitude"],
)
sunrise = (
sun_rise_set["sunrise"] - sun_rise_set["sunrise"].index.normalize()
).dt.total_seconds() / 3600
sunset = (
sun_rise_set["sunset"] - sun_rise_set["sunset"].index.normalize()
).dt.total_seconds() / 3600
ax.plot(sunrise, c="r", linestyle="dashed", lw=1.5, alpha=0.7)
ax.plot(sunset, c="r", linestyle="dashed", lw=1.5, alpha=0.7)
Currently, the sunrise/sunset lines need to be added separately which is a hassle.
I am imagining that two additional parameters can be added (
latitude/longitude), which defaults to None (optional) and when they are both specified, then sunset/sunrise lines are added.