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

Issue/solar night time #130

Merged
merged 3 commits into from
Nov 20, 2024
Merged

Issue/solar night time #130

merged 3 commits into from
Nov 20, 2024

Conversation

peterdudfield
Copy link
Contributor

Pull Request

Description

fix for making sure soalr forcast are zero at night time
There was a bug, Need to change self.asset_type == SiteAssetType.pv: to self.asset_type == SiteAssetType.pv.name:

#129

How Has This Been Tested?

CI tests

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

# filter out night time
if self.asset_type == SiteAssetType.pv:
if self.asset_type == SiteAssetType.pv.name:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the main bit of code

for idx in range(8):
values_df["forecast_power_kw"][idx] -= (
values_df["forecast_power_kw"][idx] - final_gen_points
) * smooth_values[final_gen_index + idx]
log.debug(f"New values are {values_df['forecast_power_kw']}")

if self.asset_type == "solar":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didnt do anything due to above if loop

@@ -167,7 +172,8 @@ def set_night_time_zeros(batch, preds, sun_elevation_limit=0.0):
sun_elevation = sun_elevation.detach().cpu().numpy()

# expand dimension from (1,197) to (1,197,7), 7 is due to the number plevels
sun_elevation = np.repeat(sun_elevation[:, :, np.newaxis], 7, axis=2)
n_plevels = preds.shape[2]
sun_elevation = np.repeat(sun_elevation[:, :, np.newaxis], n_plevels, axis=2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only other relevant change

@peterdudfield peterdudfield marked this pull request as ready for review November 20, 2024 08:59
@peterdudfield peterdudfield merged commit 4984bbc into main Nov 20, 2024
3 checks passed
@peterdudfield peterdudfield deleted the issue/solar-night-time branch November 20, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants