From 55771b75336ec92bf24868df504e98cca4bfb830 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Tue, 26 Sep 2023 16:35:16 +0100 Subject: [PATCH] add adjust to gsp for getting specific forecast --- src/gsp.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gsp.py b/src/gsp.py index 9d9497f..c562a09 100644 --- a/src/gsp.py +++ b/src/gsp.py @@ -1,6 +1,7 @@ """Get GSP boundary data from eso """ from typing import List, Optional, Union +import os import structlog from fastapi import APIRouter, Depends, Request, Security, status from fastapi.responses import Response @@ -29,6 +30,7 @@ logger = structlog.stdlib.get_logger() +adjust_limit = float(os.getenv("ADJUST_MW_LIMIT", 0.0)) router = APIRouter() @@ -183,6 +185,11 @@ def get_forecasts_for_a_specific_gsp( creation_utc_limit=creation_limit_utc, ) + if gsp_id == 0: + forecast_values_for_specific_gsp = [ + f.adjust(limit=adjust_limit) for f in forecast_values_for_specific_gsp + ] + logger.debug("Got forecast values for a specific gsp.") return forecast_values_for_specific_gsp