mirror of
https://github.com/Dasemu/skipredictor.git
synced 2026-11-26 23:36:17 +00:00
fix(setup): enforce webcam crowd labels
This commit is contained in:
1 parent
f6a65f41d9
commit
f63913b23c
5 files changed
+261
-31
No files matched your search
@@ -204,7 +204,10 @@ class HistoricalWebcamCollector:
|
||||
if crowd_df.empty:
|
||||
existing_dates = set()
|
||||
else:
|
||||
existing_dates = set(pd.to_datetime(crowd_df["timestamp"]).dt.date)
|
||||
existing_dates = set(
|
||||
pd.to_datetime(crowd_df["analysis_date"], errors="coerce")
|
||||
.dt.date.dropna()
|
||||
)
|
||||
|
||||
# 4. Missing is the difference
|
||||
missing = sorted(list(station_dates - existing_dates))
|
||||
@@ -215,10 +218,11 @@ class HistoricalWebcamCollector:
|
||||
df = self.store.load_crowd_analyses(station_id=station_id)
|
||||
if df.empty:
|
||||
return False
|
||||
|
||||
# Convert timestamp strings to date objects
|
||||
df['date_only'] = pd.to_datetime(df['timestamp']).dt.date
|
||||
return day in df['date_only'].values
|
||||
|
||||
processed_dates = set(
|
||||
pd.to_datetime(df["analysis_date"], errors="coerce").dt.date.dropna()
|
||||
)
|
||||
return day in processed_dates
|
||||
|
||||
def process_day(self, station_id: str, day: date):
|
||||
"""Download and analyze a single snapshot for one day."""
|
||||
@@ -292,14 +296,18 @@ def main():
|
||||
collector = HistoricalWebcamCollector()
|
||||
stations = args.stations.split(",") if args.stations else None
|
||||
|
||||
if args.auto:
|
||||
if args.auto or (not args.start_date and not args.end_date):
|
||||
if not args.auto:
|
||||
logger.info(
|
||||
"No date range provided; defaulting to automatic sync mode."
|
||||
)
|
||||
collector.auto_sync(stations)
|
||||
elif args.start_date and args.end_date:
|
||||
start_date = datetime.strptime(args.start_date, "%Y-%m-%d").date()
|
||||
end_date = datetime.strptime(args.end_date, "%Y-%m-%d").date()
|
||||
collector.process_range(start_date, end_date, stations)
|
||||
else:
|
||||
parser.print_help()
|
||||
parser.error("Use --auto or provide both --start-date and --end-date.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user