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

Ignore negative values #267

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def get_metric_value(
if end_datetime_utc is not None:
query = query.filter(DatetimeIntervalSQL.end_datetime_utc <= end_datetime_utc)

#ignore negative values
query = query.filter(MetricValueSQL.value >= 0)

# filter on gsp_id
if gsp_id is not None:
query = query.join(LocationSQL)
Expand Down
3 changes: 3 additions & 0 deletions src/pvsite_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def calculate_penalty(df, region, asset_type, capacity_kw):
# Fetch penalty bands based on region and asset type
bands = penalty_bands.get((region, asset_type.lower()), default_bands)

#remove negative values
df = df[df["generation_power_kw"] >= 0]

# Calculate deviation and deviation percentage
deviation = df["generation_power_kw"] - df["forecast_power_kw"]
deviation_percentage = (deviation / capacity_kw) * 100
Expand Down
Loading