Skip to content

Commit

Permalink
Adding my take on the good first issue for improving the delay loggin
Browse files Browse the repository at this point in the history
  • Loading branch information
DubraskaS committed Mar 26, 2024
1 parent 29a482f commit c8f50bf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pvnet_app/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ def preprocess_sat_data(t0):
else:
ds_sat_5 = xr.open_zarr(sat_5_path)
latest_time_5 = pd.to_datetime(ds_sat_5.time.max().values)
sat_delay_5 = t0 - latest_time_5
sat_delay_5 = t0 - latest_time_5 #Timedelta for the delay
sat_delay_minutes = int(sat_delay_5.total_seconds() / 60) #To see the timedelta in minutes
logger.info(f"Latest 5-minute timestamp is {latest_time_5} for t0 time {t0}.")

if sat_delay_5 < timedelta(minutes=60):
logger.info(f"5-min satellite delay is only {sat_delay_5} - Using 5-minutely data.")
if sat_delay_minutes < 60:
logger.info(f"5-min satellite delay is only {sat_delay_minutes} minutes - Using 5-minutely data.")
os.system(f"mv {sat_5_path} {sat_path}")
else:
use_15_minute = True
logger.info(f"5-min satellite delay is {sat_delay_5} - "
logger.info(f"5-min satellite delay is {sat_delay_minutes} minutes - "
f"Switching to 15-minutely data.")

if use_15_minute:
Expand Down

0 comments on commit c8f50bf

Please sign in to comment.