Hello everyone,
I am very new to sac. I am trying to cutim sac file from 1770 to 1830 in such a way that each cutim file will make 6 seconds window starting from 1770..1776 and it will proceed with 3 seconds step and the next cutim will be 1773..1779. It is quite hectic to repeat the commands again and again. Therefore, I am intending to make a bash script to do that. Can somebody guide me how to do that? Thanks in anticipation.
I am very new to sac. I am trying to cutim sac file from 1770 to 1830 in such a way that each cutim file will make 6 seconds window starting from 1770..1776 and it will proceed with 3 seconds step and the next cutim will be 1773..1779. It is quite hectic to repeat the commands again and again. Therefore, I am intending to make a bash script to do that. Can somebody guide me how to do that? Thanks in anticipation.
-
Hi,
Here's a bash script that you can directly use or modify to your needs.
#!/bin/sh
startt=1776
endt=1830
sigwin=3
steps=1000
t1=$startt
for (( i= 1; i<=$steps; i++ ))
do
t2=$(( $t1 + $sigwin ))
if [ $(echo "$t2 > $endt" | bc) -eq 1 ]
then
echo "reached $endt, exiting"
exit
fi
echo "start:$t1 end:$t2"
fname="${t1}_${t2}.SAC"
sac << END
READ myfile.sac
CUTIM $t1 $t2
WRITE $fname
END
t1=$(( $t1 + $sigwin ))
done
Januka
Januka Attanayake
Research Fellow/Lecturer | Earthquake Seismology Lead
Homepage: *https://sites.google.com/site/janukaattanayake
https://sites.google.com/site/janukaattanayake*
School of Geography, Earth & Atmospheric Sciences
University of Melbourne | Parkville 3010 VIC
Australia
On Wed, 21 Sept 2022 at 17:07, faisalumer1999<at>gmail.com (via IRIS) <
sac-help-bounce<at>lists.ds.iris.edu> wrote:
Hello everyone,
I am very new to sac. I am trying to cutim sac file from 1770 to 1830 in
such a way that each cutim file will make 6 seconds window starting from
1770..1776 and it will proceed with 3 seconds step and the next cutim will
be 1773..1779. It is quite hectic to repeat the commands again and again.
Therefore, I am intending to make a bash script to do that. Can somebody
guide me how to do that? Thanks in anticipation.
----------------------
SAC Help
Topic home: http://ds.iris.edu/message-center/topic/sac-help/ |
Unsubscribe: sac-help-unsubscribe<at>lists.ds.iris.edu
Sent from the IRIS Message Center (http://ds.iris.edu/message-center/)
Update subscription preferences at http://ds.iris.edu/account/profile/