Skip to content

Commit

Permalink
Make datastore writer ignore old events
Browse files Browse the repository at this point in the history
Some data provided to the writer will have been uploaded to Nikhef,
where the wsgi app was not as strict with marking events as suspect.
  • Loading branch information
153957 committed Jun 24, 2024
1 parent f37b089 commit 22ac969
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions writer/store_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,17 @@ def data_is_blob(uploadcode, blob_types):
def store_event_list(data_dir, station_id, cluster, event_list):
"""Store a list of events"""

minimum_year = 2020
prev_date = None
datafile = None
for event in event_list:
try:
timestamp = event['header']['datetime']
if timestamp:
date = timestamp.date()
if date.year < minimum_year:
logger.error(f'Old event ({date}), discarding event (station: {station_id})')
continue
if date != prev_date:
if datafile:
datafile.close()
Expand Down

0 comments on commit 22ac969

Please sign in to comment.