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

rearrange sac header writer #154

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open

Conversation

casarotti
Copy link

I think there is a problem with the SAC header construction.

here

pysep/pysep/pysep.py

Line 1862 in 92c4c62

self.st = append_sac_headers(self.st, self.event, self.inv)

pysep constructs the SAC header (before the trim), which means that it calculates the B value from the stream start time
here

pysep/pysep/pysep.py

Line 1868 in 92c4c62

self.st = self.preprocess()

pysep calls the preprocess routine and trims the waves, setting the new stream start time.
Then it writes the SAC files (with the new start time and the previously defined header).

When the SAC file is read back, OBSPY takes into account the start time (defined by the trim) and the B value, and adjusts nzsec, nzmsec.
which will be used later to create the origin time.

So the origin time is modified in the sac files

I modified pysep.py moving the preprocess (where the trim occurs) before the sac header.

the proprocess routine assumed that a sac header was already written but only to write the scale_factor value, so I move this writing out of the routine after the sac header construction

move sac header writer after preprocess (trim rewrite b, e, and origin time)
reinstate the nzmsec conversion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant