adjtomo / pysep

Seismogram Extraction and Processing: Seismic data retrieval and record sections
https://pysep.readthedocs.io
MIT License
29 stars 15 forks source link

RecSec error when reading data saved with legacy file naming #127

Closed bch0w closed 11 months ago

bch0w commented 12 months ago

@ammcpherson caught a fun bug where RecSec cannot plot data saved from PySEP using the --legacy_naming flag

Since #124, RecSec tries to blindly read everything in the directory you pass to --pysep_path, and since the legacy file saving puts all the SAC files and the stream.ms in the same directory, it ends up reading the miniseed file too, which has no SAC headers. So RecSec is doubly reading the data, and then throwing the error you see when it tries to check the SAC headers on the miniseed data.

A short term workaround is to delete/move the stream.ms file, or put all your SAC files into a separate sub-directory. I will try to think of a bugfix to ensure this doesn't happen to others in the future.

bch0w commented 11 months ago

I've tried to address this with d6b6b4c and 7a11b63 where wildcards can be set individually for the files searched for with new parameters wildcard and syn_wildcard (optional)

bch0w commented 11 months ago

Hi @ammcpherson, wonder if you can try this feature out and see if it works as expected for the case where you were having issue plotting record sections with files saved using legacy_naming?

You can use the parameter --wildcard to explicitly tell RecSec how to look for data under --pysep_path. If your synthetics are of a different format, you can use the optional --syn_wildcard to set those. You'll need to wrap the command line arguments in quotation marks so that bash doesn't auto-fill the wildcards, something like:

recsec --pysep_path ./ --wildcard '*.BH.?' --syn_path ../OUTPUT_FILES --syn_wildcard '*.sem?' 
ammcpherson commented 11 months ago

Hi @bch0w,

I just downloaded a fresh copy of the devel branch, and was able to plot a record section of data saved with legacy_naming and a comparison between the same data and some synthetics with different naming.

Thank you!