From 4982480dcbd61f9de8cc194b5e8a31e81972aad8 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Thu, 15 Feb 2024 21:21:15 +0000 Subject: [PATCH] lint --- india_forecast_app/model.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/india_forecast_app/model.py b/india_forecast_app/model.py index f73d7f5..96ee3d6 100644 --- a/india_forecast_app/model.py +++ b/india_forecast_app/model.py @@ -1,7 +1,6 @@ """ Model classes (currently just allows for loading a dummy model) """ - import datetime as dt import math import random @@ -52,7 +51,9 @@ def _generate_dummy_forecast(self, timestamp: dt.datetime): values_df = pd.DataFrame(values) # smooth the wind forecast - values_df["forecast_power_kw"] = values_df["forecast_power_kw"].rolling(6, min_periods=1).mean() + values_df["forecast_power_kw"] = ( + values_df["forecast_power_kw"].rolling(6, min_periods=1).mean() + ) # turn back to list of dicts values = values_df.to_dict(orient="records") @@ -94,14 +95,12 @@ def _basicSolarYieldFunc(timeUnix: int, scaleFactor: int = 4000) -> float: # Remove negative values basefunc = max(0, basefunc) # Steepen the curve. The divisor is based on the max value - basefunc = basefunc**4 / 1.01**4 + basefunc = basefunc ** 4 / 1.01 ** 4 # Instead of completely random noise, apply based on the following process: # * A base noise function which is the product of long and short sines # * The resultant function modulates with very small amplitude around 1 - noise = (math.sin(math.pi * time.hour) / 20) * ( - math.sin(math.pi * time.hour / 3) - ) + 1 + noise = (math.sin(math.pi * time.hour) / 20) * (math.sin(math.pi * time.hour / 3)) + 1 noise = noise * random.random() / 20 + 0.97 # Create the output value from the base function, noise, and scale factor