Skip to content

Commit

Permalink
Merge pull request #308 from openclimatefix/issue/reduce-tolrence
Browse files Browse the repository at this point in the history
switch to 15 mintues data, if less than 1.5 hour of 5 min data
  • Loading branch information
peterdudfield authored Nov 8, 2024
2 parents 36c876f + 0f972f8 commit f871f08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ zarr==2.17.0
zict==3.0.0
zipp==3.17.0
sentry-sdk
flexparser==0.3.1
7 changes: 6 additions & 1 deletion satip/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,13 @@ def run(
start_date=start_date.strftime("%Y-%m-%d-%H:%M:%S"),
end_date=pd.Timestamp(start_time, tz="UTC").strftime("%Y-%m-%d-%H:%M:%S"),
)

# Check if any RSS imagery is available, if not, fall back to 15 minutely data
if (len(datasets) == 0) or use_hr_serviri:
# We want to check if there is at least 75% of the history data available
# If there is less than this, we move over to the 15 minute data
# note we need history data to be larger than this.
n_datasets_needed = int(pd.to_timedelta(history) / pd.Timedelta("5 min") * 0.75)
if (len(datasets) < n_datasets_needed) or use_hr_serviri:
log.warn(
f"No RSS Imagery available or using backup ({use_hr_serviri=}), "
f"falling back to 15-minutely data",
Expand Down

0 comments on commit f871f08

Please sign in to comment.