From 30c4ffcd41c4727698ff8ef32bf5c7b0710c2bd2 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Tue, 12 Nov 2024 16:06:39 +0000 Subject: [PATCH] lint --- india_forecast_app/adjuster.py | 16 +++++++++------- india_forecast_app/app.py | 5 +++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/india_forecast_app/adjuster.py b/india_forecast_app/adjuster.py index 63495c2..96f002d 100644 --- a/india_forecast_app/adjuster.py +++ b/india_forecast_app/adjuster.py @@ -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 @@ -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 diff --git a/india_forecast_app/app.py b/india_forecast_app/app.py index b1c2291..4e99401 100644 --- a/india_forecast_app/app.py +++ b/india_forecast_app/app.py @@ -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__ @@ -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