Thread: Macro error

Started: 2019-11-14 12:16:14
Last activity: 2019-11-15 13:40:08
Topics: SAC Help
claudia pavez
2019-11-14 12:16:14
Hello everyone,
I am trying to use a MACRO for data processing that is available in the
Charles Ammon's webpage.
The entire code is working quite well, but for some reason that I can not
understand the code is not capable to read the files continuously. When I
try to process a lot of data, I just can process the vertical component
continuously but the files for the N and E components don't change. So, at
the end, I just finish processing vertical seismograms, which is not that I
need to do :/

This is the code and the error that I get

sc mkdir Trash
sc mkdir Good
qdp off
ygrid on
do file1 wild *BHZ
setbb vert $file1
setbb east '( CHANGE 'BHZ' 'BHE' %vert )'
setbb north '( CHANGE 'BHZ' 'BHN' %vert )'
r %vert %east %north
synch
w over
r %vert
rmean
rtr
ppk
setbb t0 &1,t0
r %vert %east %north
ch t0 %t0
w over
cut t0 -30 t0 +90
r %vert %east %north
rmean
rtr
taper w 0.2
w over
p1
cut off
enddo

WARNING: File does not exist: (
WARNING: File does not exist: ( CHANGE
WARNING: File does not exist: ( CHANGE (
WARNING: File does not exist: ( CHANGE ( CHANGE
WARNING: Unable to read some files reading the rest of the files.

If anyone of you is using the code or understand the what the problem is,
it would be very helpful. Thanks in advance,

Claudia

  • Robert Casey
    2019-11-14 07:45:13

    Hi Claudia-

    I think that the issue may be the placement of your single quotes in your CHANGE expressions. Because of the leading single quote before ( CHANGE, then next single quote places BHZ outside of string quoting, making the interpreter try to evaluate BHZ as something, which may come up null. In fact, with the multiple errors you show that seem to expand, it's almost like it sees an array of string elements. Just guessing here. See if this works for you:

    setbb east ( CHANGE 'BHZ' 'BHE' %vert )
    setbb north ( CHANGE 'BHZ' 'BHN' %vert )

    -Rob


    On Nov 14, 2019, at 3:17 AM, claudia pavez <cv.pavez.o<at>gmail.com> wrote:

    Hello everyone,
    I am trying to use a MACRO for data processing that is available in the Charles Ammon's webpage.
    The entire code is working quite well, but for some reason that I can not understand the code is not capable to read the files continuously. When I try to process a lot of data, I just can process the vertical component continuously but the files for the N and E components don't change. So, at the end, I just finish processing vertical seismograms, which is not that I need to do :/

    This is the code and the error that I get

    sc mkdir Trash
    sc mkdir Good
    qdp off
    ygrid on
    do file1 wild *BHZ
    setbb vert $file1
    setbb east '( CHANGE 'BHZ' 'BHE' %vert )'
    setbb north '( CHANGE 'BHZ' 'BHN' %vert )'
    r %vert %east %north
    synch
    w over
    r %vert
    rmean
    rtr
    ppk
    setbb t0 &1,t0
    r %vert %east %north
    ch t0 %t0
    w over
    cut t0 -30 t0 +90
    r %vert %east %north
    rmean
    rtr
    taper w 0.2
    w over
    p1
    cut off
    enddo

    WARNING: File does not exist: (
    WARNING: File does not exist: ( CHANGE
    WARNING: File does not exist: ( CHANGE (
    WARNING: File does not exist: ( CHANGE ( CHANGE
    WARNING: Unable to read some files reading the rest of the files.

    If anyone of you is using the code or understand the what the problem is, it would be very helpful. Thanks in advance,

    Claudia


    ----------------------
    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/


  • George Helffrich
    2019-11-15 08:10:25
    Dear All -

    I suspect those macros were written in an era when SAC was not as fastidious about checking for syntactical errors as it is now.

    The two offending lines should be written,

    setbb east '(CHANGE BHZ BHE %vert%)'
    setbb north '(CHANGE BHZ BHN %vert%)’

    to avoid any misinterpretation. In particular, note the absence of a blank between ( and CHANGE and %…% around the blackboard variable named vert.

    On 14 Nov 2019, at 20:17, claudia pavez <cv.pavez.o<at>gmail.com> wrote:

    Hello everyone,
    I am trying to use a MACRO for data processing that is available in the Charles Ammon's webpage.
    The entire code is working quite well, but for some reason that I can not understand the code is not capable to read the files continuously. When I try to process a lot of data, I just can process the vertical component continuously but the files for the N and E components don't change. So, at the end, I just finish processing vertical seismograms, which is not that I need to do :/

    This is the code and the error that I get

    sc mkdir Trash
    sc mkdir Good
    qdp off
    ygrid on
    do file1 wild *BHZ
    setbb vert $file1
    setbb east '( CHANGE 'BHZ' 'BHE' %vert )'
    setbb north '( CHANGE 'BHZ' 'BHN' %vert )'
    r %vert %east %north
    synch
    w over
    r %vert
    rmean
    rtr
    ppk
    setbb t0 &1,t0
    r %vert %east %north
    ch t0 %t0
    w over
    cut t0 -30 t0 +90
    r %vert %east %north
    rmean
    rtr
    taper w 0.2
    w over
    p1
    cut off
    enddo

    WARNING: File does not exist: (
    WARNING: File does not exist: ( CHANGE
    WARNING: File does not exist: ( CHANGE (
    WARNING: File does not exist: ( CHANGE ( CHANGE
    WARNING: Unable to read some files reading the rest of the files.

    If anyone of you is using the code or understand the what the problem is, it would be very helpful. Thanks in advance,

    Claudia


    ----------------------
    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/



    George Helffrich
    george<at>elsi.jp


    • claudia pavez
      2019-11-15 13:40:08
      Dear all,

      Thank you very much for your help. The answer at the end was this one:

      do file1 wild *BHZ
      setbb east (CHANGE BHZ BHE %vert%)
      setbb north (CHANGE BHZ BHN %vert%)

      Lines without the space between '(' and ' CHANGE', no quotes at the
      beginning and at the end of the CHANGE function, and also the '%' around
      the key blackboard variable. A mixture of your suggestions.
      I also tried different similar functions and the sintaxis should be eqaul
      in most of the cases.

      Thanks again,

      Regards,
      Claudia



      El vie., 15 nov. 2019 a las 0:12, George Helffrich (<george<at>elsi.jp>)
      escribió:

      Dear All -

      I suspect those macros were written in an era when SAC was not as
      fastidious about checking for syntactical errors as it is now.

      The two offending lines should be written,

      setbb east '(CHANGE BHZ BHE %vert%)'
      setbb north '(CHANGE BHZ BHN %vert%)’

      to avoid any misinterpretation. In particular, note the absence of a
      blank between ( and CHANGE and %…% around the blackboard variable named
      vert.

      On 14 Nov 2019, at 20:17, claudia pavez <cv.pavez.o<at>gmail.com> wrote:

      Hello everyone,
      I am trying to use a MACRO for data processing that is available in the
      Charles Ammon's webpage.
      The entire code is working quite well, but for some reason that I can not
      understand the code is not capable to read the files continuously. When I
      try to process a lot of data, I just can process the vertical component
      continuously but the files for the N and E components don't change. So, at
      the end, I just finish processing vertical seismograms, which is not that I
      need to do :/

      This is the code and the error that I get

      sc mkdir Trash
      sc mkdir Good
      qdp off
      ygrid on
      do file1 wild *BHZ
      setbb vert $file1
      setbb east '( CHANGE 'BHZ' 'BHE' %vert )'
      setbb north '( CHANGE 'BHZ' 'BHN' %vert )'
      r %vert %east %north
      synch
      w over
      r %vert
      rmean
      rtr
      ppk
      setbb t0 &1,t0
      r %vert %east %north
      ch t0 %t0
      w over
      cut t0 -30 t0 +90
      r %vert %east %north
      rmean
      rtr
      taper w 0.2
      w over
      p1
      cut off
      enddo

      WARNING: File does not exist: (
      WARNING: File does not exist: ( CHANGE
      WARNING: File does not exist: ( CHANGE (
      WARNING: File does not exist: ( CHANGE ( CHANGE
      WARNING: Unable to read some files reading the rest of the files.

      If anyone of you is using the code or understand the what the problem is,
      it would be very helpful. Thanks in advance,

      Claudia


      ----------------------
      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/




      George Helffrich
      george<at>elsi.jp


      ----------------------
      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/


01:25:09 v.22510d55