Thread: Re: CHANGE option in the setbb command and how to search the sac help messages

Started: 2016-07-11 17:00:06
Last activity: 2016-07-11 19:15:16
Topics: SAC Help
Hi,

Please, see the page 34 in the sac manual version pdf.

The “change" inline function and others (six) exits in 101.6, please check the syntax, perhaps
in your macro the change command is not recognized..

I include a page 34 of manual..

HTH,

M.








On Jul 11, 2016, at 02:28, Martha Savage <Martha.Savage<at>vuw.ac.nz> wrote:


Hi,

I thought I sent this message a couple weeks ago, but I didn't hear any replies so maybe it went to the wrong person.

I'm trying to get a script working that worked in the old versions of sac (before 101.5 I believe). It uses an option called CHANGE in the setbb command. Here is the relevant part of the script.

do file wild *.z
setbb vert $file
setbb east '( CHANGE '.z' '.e' %vert )'
setbb north '( CHANGE '.z' '.n' %vert )'
setbb rad '( CHANGE '.z' '.r' %vert )'
setbb tran '( CHANGE '.z' '.t' %vert )'
r %vert %east %north
synch
w over

Basically, CHANGE allowed one to operate on strings within the setbb command so that the new names east, north, rad, tran etc. now refer to the file.e, file.n, file.r, etc. files.

This option is explained in the SAC book written by George Helffrich.

101.6a does not recognize the "CHANGE" part of it. I know I can work around it by using a bash script to do a similar thing, and invoke SAC for each file. However, the old method is more satisfying because I don't need the overhead of invoking sac each time, which will take longer and hog system time.

Does anybody know of a way to manipulate strings from within SAC now?

I tried to look on the sac-help page because I thought it might have been discussed before after the changes to 101.6a. But there didn't seem to be any way to search the mails, except to browse each topic by clicking on each month since the start of 101.6a and reading all the topics.

Thanks in advance for any help.


Martha Savage
Professor of Geophysics, SGEES
Victoria University of Wellington
Cotton 529
Box 600, wellington, 6140
New Zealand

Email: Martha.Savage<at>vuw.ac.nz <Martha.Savage<at>vuw.ac.nz>
Phone: +64-4-463-5961
Cell: 021-262-7516


From: sac-help<at>iris.washington.edu <sac-help<at>iris.washington.edu> on behalf of Milton Plasencia <mpplasencia<at>gmail.com>
Sent: Wednesday, 8 June 2016 4:36 p.m.
To: SAC Help
Subject: Re: [sac-help] Trying to install SAC in Ubuntu

let see your steps:
See below

On Jun 8, 2016, at 03:46, Hugo Loyola <hugoe.loyolat<at>gmail.com <hugoe.loyolat<at>gmail.com>> wrote:

I am doing as follows:

#The first step is to expand the .tar.gz file
OK
#and I get this
# /home/hugo/Sismos/sac
OK



#at the ~/sac/bin I have files
#sacinit.csh and sacinit.sh
Ubuntu, as other Linux use bash shell, so you must use sacinit.sh
remember that sacinit.sh must have executable permission, so in the directory /home/hugo/Sismos/sac/bin run the command:
chmod +x sacinit.sh

#the README instructions say: ... and the sacinit file is modified accordingly.
Depending where was untar the the distribution

#In the bin folder I have sacinit.csh and sacinit.sh, in these two files I did:

setenv SACHOME /home/hugo/Sismos/sac #at sacinit.csh
not will be used, setenv is used in other Unix systems (Sun etc)

export SACHOME=/home/hugo/Sismos/sac #at sacinit.sh
OK, but here also you must also set the other variables as my anterior e-mail, in your case
export SACHOME=/home/hugo/Sismos/sac
export PATH=${PATH}:${SACHOME}/bin
export SACAUX=${SACHOME}/aux


#then gedit ~/.cshrc adding the lines
Bad
setenv SACHOME /home/hugo/Sismos/sac
replace by:
export SACHOME=/home/hugo/Sismos/sac

source ${SACHOME}/bin/sacinit.csh
replace by:
source ${SACHOME}/bin/sacinit.sh
or
source /home/hugo/Sismos/sac/bin/sacinit.sh

#After saving and exiting the file, enter
source ~/.cshrc
OK.

#and happen this:
No command 'setenv' found, did you mean:
Correct, your Linux not known the setenv command
Command 'netenv' from package 'netenv' (universe)
setenv: command not found
The same as anterior
bash: /bin/sacinit.csh: No such file or directory
perhaps sacinit.csh is not executable, but you must to use sacinit.sh


#also I did:
gedit ~/.bashrc

#and add to last the lines:
export SACHOME=/home/hugo/Sismos/sac
OK
. ${SACHOME}/bin/sacinit.sh
OK, but between the dot and $ must be a blank

#then saving and exiting the file

#then . ~/.bashrc
Also here . ~/.bashrc

#and happen
bash: ./home/hugo/Sismos/sac/bin/sacinit.sh: No such file or directory
Here or sacinit.sh is not in the PATH or it is not executable.

HTH,

M.

After all these steps, still I do not get SAC working, please, any suggestions

----------------------
SAC Help (http://ds.iris.edu/message-center/topic/sac-help/)

Sent via IRIS Message Center (http://ds.iris.edu/message-center/)
Update subscription preferences at http://ds.iris.edu/account/profile/

  • Dear Martha,
    There is a simple syntax change in later versions of SAC. You can do the following modification to your macro and get it to run as before. Simply, get rid of the first pair of quotes. The following piece of macro works just fine.

    e.g.
    do file wild *_LHZ.VEL.SAC
    setbb vert $file
    setbb rad (CHA '_LHZ.' '_RADIAL.' %vert)
    getbb rad
    setbb tran (CHA '_LHZ.' '_TRANSVERSE.' %vert)
    getbb tran
    r %vert %rad %tran
    color on inc l red blue green
    p1
    enddo

    Januka.
  • Dear Martha,
    There is a simple syntax change in later versions of SAC. You can do the
    following modification to your macro and get it to run as before. Simply,
    get rid of the first pair of quotes. The following macro works just fine.

    e.g.
    do file wild *_LHZ.VEL.SAC
    setbb vert $file
    setbb rad (CHA '_LHZ.' '_RADIAL.' %vert)
    getbb rad
    setbb tran (CHA '_LHZ.' '_TRANSVERSE.' %vert)
    getbb tran
    r %vert %rad %tran
    color on inc l red blue green
    p1
    enddo

    Januka.

    Januka Attanayake
    Postdoctoral Research Associate

    Institut für Geophysik
    Westfälische Wilhelms - Universität Münster
    CorrensstraBe 24
    48149 Münster
    Germany

    University email: jattanayake<at>uni-muenster.de
    Homepage: http://sites.google.com/site/janukaattanayake/

    On 11 July 2016 at 10:01, Milton Plasencia <mpplasencia<at>gmail.com> wrote:

    Hi,

    Please, see the page 34 in the sac manual version pdf.

    The “change" inline function and others (six) exits in 101.6, please check
    the syntax, perhaps
    in your macro the change command is not recognized..

    I include a page 34 of manual..

    HTH,

    M.







    On Jul 11, 2016, at 02:28, Martha Savage <Martha.Savage<at>vuw.ac.nz> wrote:


    Hi,

    I thought I sent this message a couple weeks ago, but I didn't hear any
    replies so maybe it went to the wrong person.

    I'm trying to get a script working that worked in the old versions of sac
    (before 101.5 I believe). It uses an option called CHANGE in the setbb
    command. Here is the relevant part of the script.

    do file wild *.z
    setbb vert $file
    setbb east '( CHANGE '.z' '.e' %vert )'
    setbb north '( CHANGE '.z' '.n' %vert )'
    setbb rad '( CHANGE '.z' '.r' %vert )'
    setbb tran '( CHANGE '.z' '.t' %vert )'
    r %vert %east %north
    synch
    w over

    Basically, CHANGE allowed one to operate on strings within the setbb
    command so that the new names east, north, rad, tran etc. now refer to the
    file.e, file.n, file.r, etc. files.

    This option is explained in the SAC book written by George Helffrich.

    101.6a does not recognize the "CHANGE" part of it. I know I can work
    around it by using a bash script to do a similar thing, and invoke SAC for
    each file. However, the old method is more satisfying because I don't need
    the overhead of invoking sac each time, which will take longer and hog
    system time.

    Does anybody know of a way to manipulate strings from within SAC now?

    I tried to look on the sac-help page because I thought it might have been
    discussed before after the changes to 101.6a. But there didn't seem to be
    any way to search the mails, except to browse each topic by clicking on
    each month since the start of 101.6a and reading all the topics.

    Thanks in advance for any help.


    Martha Savage
    Professor of Geophysics, SGEES
    Victoria University of Wellington
    Cotton 529
    Box 600, wellington, 6140
    New Zealand

    Email: Martha.Savage<at>vuw.ac.nz
    Phone: +64-4-463-5961
    Cell: 021-262-7516


    ------------------------------
    *From:* sac-help<at>iris.washington.edu <sac-help<at>iris.washington.edu> on
    behalf of Milton Plasencia <mpplasencia<at>gmail.com>
    *Sent:* Wednesday, 8 June 2016 4:36 p.m.
    *To:* SAC Help
    *Subject:* Re: [sac-help] Trying to install SAC in Ubuntu

    let see your steps:
    See below

    On Jun 8, 2016, at 03:46, Hugo Loyola <hugoe.loyolat<at>gmail.com> wrote:

    I am doing as follows:

    #The first step is to expand the .tar.gz file

    OK

    #and I get this
    # /home/hugo/Sismos/sac

    OK




    #at the ~/sac/bin I have files
    #sacinit.csh and sacinit.sh

    Ubuntu, as other Linux use bash shell, so you must use sacinit.sh
    remember that sacinit.sh must have executable permission, so in the
    directory /home/hugo/Sismos/sac/bin run the command:
    chmod +x sacinit.sh


    #the README instructions say: ... and the sacinit file is modified
    accordingly.

    Depending where was untar the the distribution


    #In the bin folder I have sacinit.csh and sacinit.sh, in these two files I
    did:

    setenv SACHOME /home/hugo/Sismos/sac #at sacinit.csh

    not will be used, setenv is used in other Unix systems (Sun etc)


    export SACHOME=/home/hugo/Sismos/sac #at sacinit.sh

    OK, but here also you must also set the other variables as my anterior
    e-mail, in your case
    export SACHOME=/home/hugo/Sismos/sac
    export PATH=${PATH}:${SACHOME}/bin
    export SACAUX=${SACHOME}/aux


    #then gedit ~/.cshrc adding the lines

    Bad

    setenv SACHOME /home/hugo/Sismos/sac

    replace by:
    export SACHOME=/home/hugo/Sismos/sac

    source ${SACHOME}/bin/sacinit.csh

    replace by:
    source ${SACHOME}/bin/sacinit.sh
    or
    source /home/hugo/Sismos/sac/bin/sacinit.sh


    #After saving and exiting the file, enter
    source ~/.cshrc

    OK.

    #and happen this:
    No command 'setenv' found, did you mean:

    Correct, your Linux not known the setenv command

    Command 'netenv' from package 'netenv' (universe)
    setenv: command not found

    The same as anterior

    bash: /bin/sacinit.csh: No such file or directory

    perhaps sacinit.csh is not executable, but you must to use sacinit.sh


    #also I did:
    gedit ~/.bashrc

    #and add to last the lines:
    export SACHOME=/home/hugo/Sismos/sac

    OK

    . ${SACHOME}/bin/sacinit.sh

    OK, but between the dot and $ must be a blank


    #then saving and exiting the file

    #then . ~/.bashrc

    Also here . ~/.bashrc


    #and happen
    bash: ./home/hugo/Sismos/sac/bin/sacinit.sh: No such file or directory

    Here or sacinit.sh is not in the PATH or it is not executable.

    HTH,

    M.


    After all these steps, still I do not get SAC working, please, any
    suggestions

    ----------------------
    SAC Help (http://ds.iris.edu/message-center/topic/sac-help/)

    Sent via IRIS Message Center (http://ds.iris.edu/message-center/)
    Update subscription preferences at http://ds.iris.edu/account/profile/




    ----------------------
    SAC Help (http://ds.iris.edu/message-center/topic/sac-help/)

    Sent via IRIS Message Center (http://ds.iris.edu/message-center/)
    Update subscription preferences at http://ds.iris.edu/account/profile/



13:44:26 v.01697673