Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Dec 18, 2024
1 parent 22f75f7 commit ab8e73a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pvliveconsumer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import pvliveconsumer
from pvliveconsumer.backup import make_gsp_yields_from_national
from pvliveconsumer.gsps import filter_gsps_which_have_new_data, get_gsps
from pvliveconsumer.nitghtime import make_night_time_zeros
from pvliveconsumer.nightime import make_night_time_zeros
from pvliveconsumer.time import check_uk_london_hour

logging.basicConfig(
Expand Down
6 changes: 3 additions & 3 deletions pvliveconsumer/nitghtime.py → pvliveconsumer/nightime.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def make_night_time_zeros(
latitude = gsp_location["latitude"]

# round start up to the nearest half hour
if start.minute >= 30:
start = start.replace(minute=0, second=0, microsecond=0) + timedelta(hours=1)
else:
if start.minute < 30 or (start.minute == 30 and start.second == 0):
start = start.replace(minute=30, second=0, microsecond=0)
else:
start = start.replace(minute=0, second=0, microsecond=0) + timedelta(hours=1)

times = pd.date_range(start=start, end=end, freq="30min")
# check if it is nighttime, and if so, set generation values to zero
Expand Down
2 changes: 1 addition & 1 deletion tests/test_nighttime.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pvliveconsumer.nitghtime import make_night_time_zeros
from pvliveconsumer.nightime import make_night_time_zeros
from datetime import datetime
from nowcasting_datamodel.models.gsp import LocationSQL, GSPYieldSQL
import pandas as pd
Expand Down

0 comments on commit ab8e73a

Please sign in to comment.