computational-seismology / pytomo3d

seismic tomography toolkits
https://computational-seismology.github.io/pytomo3d/
GNU Lesser General Public License v3.0
34 stars 21 forks source link

Add option of padding zero #17

Open vsilwal opened 6 years ago

vsilwal commented 6 years ago

https://github.com/computational-seismology/pytomo3d/blob/77efedfe3863213ae348385fdd8a8552c2d8db13/pytomo3d/signal/process.py#L56

It might be good to have the option of padding zeroes here. One example were this would be beneficial would be when filtering specfem synthetics (that start from time=0) for near-field stations.

wjlei1990 commented 6 years ago

Good point!

Are you talking about something like this

I think I originally may think out that, but I realized there are 4 cases that I have to handle, which might lead me to give up code it up. 1) cut start time < trace start time 2) cut start time >= trace start time 3) cut end time < trace end time 4) cut end time >= trace end time

vsilwal commented 6 years ago

Great to see its already there.

Wouldn't trace.trim(cut_starttime, cut_endtime, pad=True, fill_value=0) take care of this?

For (1. start time < trace start time) and (4. end time >= trace end time) that would pad zero, and for (2. start time >= trace start time) and (3. end time < trace end time) it would cut.

Thanks,