Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Reading triggered events when using locate with partial days of data #132

Open
hemmelig opened this issue Oct 5, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@hemmelig
Copy link
Member

hemmelig commented Oct 5, 2021

Describe the bug
When running Locate for a window of time with start/end times that are not an integer number of days apart and that cross a dateline, the process of reading in triggered event files will fail (silently) for the final day. It will simply not read in the triggered event file for the last day, and will only locate events for Julian days before this.

For example, running Detect, Trigger, and Locate with the starttime/endtime:

starttime = "2018-121T22:00:00.0"
endtime = "2018-122T02:00:00.0"

Any events triggered between 22:00 and 00:00 will be successfully located, but any between 00:00 and 02:00 will not.

This arises in the `quakemigrate/io/triggered_events.py' file, for lines 53-66:

trigger_files = []
readstart = starttime
while readstart <= endtime:
    fstem = f"{run.name}_{readstart.year}_{readstart.julday:03d}"
    file = (fpath / f"{fstem}_TriggeredEvents").with_suffix(".csv")
    if file.is_file():
        trigger_files.append(file)
    else:
        logging.info(f"\n\t    Cannot find file: {fstem}")
    readstart += 86400
if len(trigger_files) == 0:
    raise util.NoTriggerFilesFound
events = pd.concat((pd.read_csv(f) for f in trigger_files),
                   ignore_index=True)

The initial readstart <= endtime test returns False for the final day, if the hour/minutes of the starttime are later than the hour/minutes of the endtime.

This may also be an issue when reading the availability files and plotting during Trigger - I am investigating and will update this Issue accordingly.

To Reproduce
Run Detect and Trigger using a small sample of data over a dateline (start and end times either side of midnight, e.g. those above). Locate will successfully register events triggered before midnight, but not after.

Expected behavior
All event should be detected, as triggered event files (which are stored as day files, named by the Julian day) exist.

Desktop (please complete the following information):

  • Operating System: macOS Big Sur
  • Python version: 3.8
  • QuakeMigrate version: 1.0.1

Additional context
This was identified when running tests on seismic data from the HVO network.

@TomWinder TomWinder added the bug Something isn't working label Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants