Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Dec 12, 2023
1 parent 6a9e7f7 commit 53c2e1c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 0 additions & 2 deletions quartz_solar_forecast/eval/nwp.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,10 @@ def get_nwp_for_one_timestamp_one_location(timestamp: pd.Timestamp, latitude, lo
times = pd.to_datetime(data_at_location.time.values) + pd.to_timedelta(
data_at_location.step.values, unit="h"
)
print(times)

# convert to pandas dataframe
df = pd.DataFrame(times, columns=["time"])
for variable in variables:
print(variable)
df[variable] = data_at_location[variable].values

# make wind speed out of u and v
Expand Down
5 changes: 3 additions & 2 deletions quartz_solar_forecast/eval/pv.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,20 @@ def get_pv_truth(testset: pd.DataFrame):
# Calculate future timestamps up to the max horizon
for i in range(0, 49): # 48 hours in steps of 1 hour
future_datetime = base_datetime + pd.DateOffset(hours=i)
horizon = i * 60 # Convert hours to minutes
horizon = i # horizon in hours

try:
# Attempt to select data for the future datetime
selected_data = pv_ds[pv_id].sel(datetime=future_datetime)
value = selected_data.values.item()
value = value /1000 *12 # to convert from wh to kw
except KeyError:
# If data is not found for the future datetime, set value as NaN
value = np.nan

# Add the data to the DataFrame
combined_data.append(pd.DataFrame(
{"pv_id": pv_id, "timestamp": base_datetime, "value": value, "horizon_hour": horizon}, index=[i])
{"pv_id": pv_id, "timestamp": future_datetime, "value": value, "horizon_hour": horizon}, index=[i])
)
combined_data = pd.concat(combined_data)
return combined_data

0 comments on commit 53c2e1c

Please sign in to comment.