Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Nov 12, 2024
1 parent 3355221 commit 30c4ffc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions india_forecast_app/adjuster.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from pvsite_datamodel.sqlmodels import ForecastValueSQL, GenerationSQL, ForecastSQL
from sqlalchemy.sql import func
from sqlalchemy import cast, INT, text

""" Adjuster code, adjust forecast by last 7 days of ME"""
from datetime import datetime, timedelta
import pandas as pd
from typing import Optional

import pandas as pd
from pvsite_datamodel.sqlmodels import ForecastSQL, ForecastValueSQL, GenerationSQL
from sqlalchemy import INT, cast, text
from sqlalchemy.sql import func

# Wad to get all the forecast for the last 7 days made, at this time.
# And find the ME for each forecast horizon

Expand Down Expand Up @@ -37,8 +38,9 @@ def get_me_values(
"""
Get the ME values for the last 7 days for a given hour, for a given hour creation time
args:
hour: the hour of whent he forecast is created
Args:
hour: the hour of when the forecast is created
site_uuid: the site this is for
start_datetime:: the start datetime to filter on.
session: sqlalchemy session
Expand Down
5 changes: 3 additions & 2 deletions india_forecast_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
import pandas as pd
import sentry_sdk
from pvsite_datamodel import DatabaseConnection
from pvsite_datamodel.read import get_pv_generation_by_sites, get_sites_by_country, get_site_by_uuid
from pvsite_datamodel.read import get_pv_generation_by_sites, get_site_by_uuid, get_sites_by_country
from pvsite_datamodel.sqlmodels import SiteAssetType, SiteSQL
from pvsite_datamodel.write import insert_forecast_values
from sqlalchemy.orm import Session

import india_forecast_app
from india_forecast_app.adjuster import get_me_values
from india_forecast_app.models import PVNetModel, get_all_models
from india_forecast_app.sentry import traces_sampler
from india_forecast_app.adjuster import get_me_values

log = logging.getLogger(__name__)
version = india_forecast_app.__version__
Expand Down Expand Up @@ -216,6 +216,7 @@ def save_forecast(
write_to_db: If true, forecast values are written to db, otherwise to stdout
ml_model_name: Name of the ML model used for the forecast
ml_model_version: Version of the ML model used for the forecast
use_adjuster: Make new model, adjusted by last 7 days of ME values
Raises:
IOError: An error if database save fails
Expand Down

0 comments on commit 30c4ffc

Please sign in to comment.