Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

un normalize sun elevation #132

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions india_forecast_app/models/pvnet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
Loading