Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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