Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions nowcasting_utils/visualization/data_sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The main satellite plot show a video for each satellite channel over.

<img src="images/satellite.png" width="200" />


# All

Makes an animation of the satellite, PV and GSP systems
Expand Down
21 changes: 21 additions & 0 deletions nowcasting_utils/visualization/data_sources/plot_sun.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
""" General functions for plotting PV data """

from typing import List

import plotly.graph_objects as go
from nowcasting_dataset.data_sources.sun.sun_model import Sun

from nowcasting_utils.visualization.line import make_trace


def get_elevation_and_azimuth_trace(sun: Sun, example_index: int) -> List[go.Scatter]:
"""Produce plot of centroid pv system"""

y1 = sun.elevation[example_index]
y2 = sun.azimuth[example_index]
x = sun.time[example_index]

trace_elevation = make_trace(x, y1, truth=True, name="elevation")
trace_azimuth = make_trace(x, y2, truth=True, name="azimuth")

return [trace_elevation, trace_azimuth]
1 change: 1 addition & 0 deletions tests/visualization/data_sources/test_satellite.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def test_make_traces_one_channel_one_time():

def test_make_traces_one_channel():
"""Test 'make_traces_one_channel' functions"""

satellite = satellite_fake(
batch_size=2, seq_length_5=5, satellite_image_size_pixels=32, number_satellite_channels=2
)
Expand Down
21 changes: 21 additions & 0 deletions tests/visualization/data_sources/test_sun.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os

import plotly.graph_objects as go
from nowcasting_dataset.data_sources.fake import sun_fake
from nowcasting_dataset.geospatial import osgb_to_lat_lon

from nowcasting_utils.visualization.data_sources.plot_sun import get_elevation_and_azimuth_trace


def test_get_trace_centroid_pv():

sun = sun_fake(batch_size=2, seq_length_5=19)

traces = get_elevation_and_azimuth_trace(sun=sun, example_index=1)

# here's if you need to plot the trace
fig = go.Figure()
for trace in traces:
fig.add_trace(trace)
if "CI" not in os.environ.keys():
fig.show(renderer="browser")