Skip to content

Commit

Permalink
Merge pull request #60 from DubraskaS/my-contribution
Browse files Browse the repository at this point in the history
Change logging to show satellite delay in minutes
  • Loading branch information
dfulu authored Mar 26, 2024
2 parents 1b44fb6 + c8f50bf commit 2d304e7
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 2d304e7

Please sign in to comment.