From c962416155a733bdb973f7fc12621f0fd13b364d Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Wed, 20 Nov 2024 19:27:48 +0000 Subject: [PATCH] un normalize sun elevation --- india_forecast_app/models/pvnet/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/india_forecast_app/models/pvnet/utils.py b/india_forecast_app/models/pvnet/utils.py index 1e3d575..378e487 100644 --- a/india_forecast_app/models/pvnet/utils.py +++ b/india_forecast_app/models/pvnet/utils.py @@ -7,6 +7,7 @@ import xarray as xr import yaml from ocf_datapipes.batch import BatchKey +from ocf_datapipes.utils.consts import ELEVATION_MEAN, ELEVATION_STD from .consts import ( nwp_ecmwf_path, @@ -174,6 +175,9 @@ def set_night_time_zeros(batch, preds, sun_elevation_limit=0.0): if not isinstance(sun_elevation, np.ndarray): sun_elevation = sun_elevation.detach().cpu().numpy() + # un normalize elevation + sun_elevation = sun_elevation * ELEVATION_STD + ELEVATION_MEAN + # expand dimension from (1,197) to (1,197,7), 7 is due to the number plevels n_plevels = preds.shape[2] sun_elevation = np.repeat(sun_elevation[:, :, np.newaxis], n_plevels, axis=2)