Skip to content

Commit

Permalink
update to show lots of models
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed May 22, 2024
1 parent 0d4e775 commit 79800d5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
altair==4.2.2
nowcasting_datamodel==1.5.39
nowcasting_datamodel==1.5.42
pvsite-datamodel==1.0.24
numpy==1.24.1
pandas==1.5.3
Expand Down
9 changes: 8 additions & 1 deletion src/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
get_all_locations,
)
from nowcasting_datamodel.read.read_gsp import get_gsp_yield, get_gsp_yield_sum
from nowcasting_datamodel.read.read_models import get_models

from plots.utils import get_colour_from_model_name

Expand Down Expand Up @@ -41,7 +42,13 @@ def forecast_page():
location.installed_capacity_mw for location in locations if location.gsp_id == gsp_id
][0]

models = ["cnn", "National_xg", "pvnet_v2", "blend"]
models = get_models(
session=session,
with_forecasts=True,
forecast_created_utc=datetime.today() - timedelta(days=7),
)
models = [model.name for model in models]

if show_pvnet_gsp_sum:
models.append("pvnet_gsp_sum")
forecast_models = st.sidebar.multiselect("Select a model", models, ["pvnet_v2"])
Expand Down
18 changes: 14 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import streamlit as st
from nowcasting_datamodel.connection import DatabaseConnection
from nowcasting_datamodel.models.metric import MetricValue
from nowcasting_datamodel.read.read_models import get_models

from auth import check_password
from forecast import forecast_page
Expand Down Expand Up @@ -50,15 +51,24 @@ def metric_page():
use_adjuster = st.sidebar.radio("Use adjuster", [True, False], index=1)

st.sidebar.subheader("Select Forecast Model")
models = ["cnn", "National_xg", "pvnet_v2"]
if show_pvnet_gsp_sum:
models.append("pvnet_gsp_sum")
model_name = st.sidebar.selectbox("Select", models, 2)

# set up database connection
url = os.environ["DB_URL"]
connection = DatabaseConnection(url=url, echo=True)

with connection.get_session() as session:
# this gets all the models used in the last week
models = get_models(
session=session,
with_forecasts=True,
forecast_created_utc=datetime.today() - timedelta(days=7),
)
models = [model.name for model in models]

if show_pvnet_gsp_sum:
models.append("pvnet_gsp_sum")
model_name = st.sidebar.selectbox("Select", models, 2)

# get metrics for comparing MAE and RMSE without forecast horizon

with connection.get_session() as session:
Expand Down

0 comments on commit 79800d5

Please sign in to comment.