Thread: Plotting seismograms from within a macro

Started: 2016-01-27 00:58:34
Last activity: 2016-01-28 06:35:48
Topics: SAC Help
Fiona Darbyshire
2016-01-27 00:58:34
I have recently purchased a new server, which has enabled me to
upgrade from SAC101.4 to SAC101.6a. I'm transferring and testing
various SAC-related programs and macros, and have run into something
rather strange.

The macro in question is one I wrote to facilitate rapid quality
control of seismograms; it reads a set of SAC files, plots them on the
screen, asks the user to input "y" or "n", and moves the seismograms
into a different directory according to the response. The problem I'm
having is that, when I execute the macro, I get a blank X window with
no seismogram plot. However, if I type manually the read, xlim and
plot1 commands I get a perfectly decent seismogram plot in the X
window.

Is there something extra that needs to be set at the beginning of the
macro to allow the seismograms to be plotted correctly, or have I
simply made some kind of mistake in the macro?

The pertinent part of the macro is as follows:

do file wild 13*/*HZ
setbb vert $file
setbb east (change 'HZ' 'HE' %vert%)
setbb north (change 'HZ' 'HN' %vert%)
r %east% %north% %vert%
xlim t1 -150 200
plot1 rel
setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")

If I run this with "echo on" for everything, I get:

SAC> m ./qualitycontrol1.sm
do file wild 13*/*HZ
setbb vert $file
==> setbb vert 13303022912/13303022912_D55A.BHZ
setbb east (change 'HZ' 'HE' %vert%)
==> setbb east 13303022912/13303022912_D55A.BHE
setbb north (change 'HZ' 'HN' %vert%)
==> setbb north 13303022912/13303022912_D55A.BHN
r %east% %north% %vert%
==> r 13303022912/13303022912_D55A.BHE
13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
xlim t1 -150 200
plot1 rel
setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")
Enter y for OK event, n for bad event, then press Enter

I get perfectly good seismograms if I manually enter the commands from
within SAC, outside the macro:

SAC> r 13303022912/13303022912_D55A.BHE
13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
SAC> xlim t1 -150 200
SAC> plot1 rel


Any suggestions gratefully received!

Fiona Darbyshire.

  • Milton Plasencia
    2016-01-27 11:38:45
    i reproduce the problem using your (slightly modify) macro in sac 101.6a (OSX and Linux),

    The sac macro plot only the last (3-comp) files in OSX and Linux.

    Milton


    On Jan 26, 2016, at 22:59, Fiona Darbyshire <f.darbyshire<at>gmail.com> wrote:

    I have recently purchased a new server, which has enabled me to
    upgrade from SAC101.4 to SAC101.6a. I'm transferring and testing
    various SAC-related programs and macros, and have run into something
    rather strange.

    The macro in question is one I wrote to facilitate rapid quality
    control of seismograms; it reads a set of SAC files, plots them on the
    screen, asks the user to input "y" or "n", and moves the seismograms
    into a different directory according to the response. The problem I'm
    having is that, when I execute the macro, I get a blank X window with
    no seismogram plot. However, if I type manually the read, xlim and
    plot1 commands I get a perfectly decent seismogram plot in the X
    window.

    Is there something extra that needs to be set at the beginning of the
    macro to allow the seismograms to be plotted correctly, or have I
    simply made some kind of mistake in the macro?

    The pertinent part of the macro is as follows:

    do file wild 13*/*HZ
    setbb vert $file
    setbb east (change 'HZ' 'HE' %vert%)
    setbb north (change 'HZ' 'HN' %vert%)
    r %east% %north% %vert%
    xlim t1 -150 200
    plot1 rel
    setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")

    If I run this with "echo on" for everything, I get:

    SAC> m ./qualitycontrol1.sm
    do file wild 13*/*HZ
    setbb vert $file
    ==> setbb vert 13303022912/13303022912_D55A.BHZ
    setbb east (change 'HZ' 'HE' %vert%)
    ==> setbb east 13303022912/13303022912_D55A.BHE
    setbb north (change 'HZ' 'HN' %vert%)
    ==> setbb north 13303022912/13303022912_D55A.BHN
    r %east% %north% %vert%
    ==> r 13303022912/13303022912_D55A.BHE
    13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
    xlim t1 -150 200
    plot1 rel
    setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")
    Enter y for OK event, n for bad event, then press Enter

    I get perfectly good seismograms if I manually enter the commands from
    within SAC, outside the macro:

    SAC> r 13303022912/13303022912_D55A.BHE
    13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
    SAC> xlim t1 -150 200
    SAC> plot1 rel


    Any suggestions gratefully received!

    Fiona Darbyshire.

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


    Attachments
    • Fiona Darbyshire
      2016-01-27 18:00:52
      Dear Milton,

      The SAC macro should simply plot a set of 3 seismograms (i.e. one
      3-component record); is this what you are referring to in your second
      paragraph? In what way did you modify the original macro, and what was
      the effect?

      Thanks,

      Fiona.

      PS. My server is Linux, running CentOS7.


      On Tue, Jan 26, 2016 at 9:39 PM, Milton Plasencia <mplasencia<at>inogs.it> wrote:
      i reproduce the problem using your (slightly modify) macro in sac 101.6a (OSX and Linux),

      The sac macro plot only the last (3-comp) files in OSX and Linux.

      Milton


      On Jan 26, 2016, at 22:59, Fiona Darbyshire <f.darbyshire<at>gmail.com> wrote:

      I have recently purchased a new server, which has enabled me to
      upgrade from SAC101.4 to SAC101.6a. I'm transferring and testing
      various SAC-related programs and macros, and have run into something
      rather strange.

      The macro in question is one I wrote to facilitate rapid quality
      control of seismograms; it reads a set of SAC files, plots them on the
      screen, asks the user to input "y" or "n", and moves the seismograms
      into a different directory according to the response. The problem I'm
      having is that, when I execute the macro, I get a blank X window with
      no seismogram plot. However, if I type manually the read, xlim and
      plot1 commands I get a perfectly decent seismogram plot in the X
      window.

      Is there something extra that needs to be set at the beginning of the
      macro to allow the seismograms to be plotted correctly, or have I
      simply made some kind of mistake in the macro?

      The pertinent part of the macro is as follows:

      do file wild 13*/*HZ
      setbb vert $file
      setbb east (change 'HZ' 'HE' %vert%)
      setbb north (change 'HZ' 'HN' %vert%)
      r %east% %north% %vert%
      xlim t1 -150 200
      plot1 rel
      setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")

      If I run this with "echo on" for everything, I get:

      SAC> m ./qualitycontrol1.sm
      do file wild 13*/*HZ
      setbb vert $file
      ==> setbb vert 13303022912/13303022912_D55A.BHZ
      setbb east (change 'HZ' 'HE' %vert%)
      ==> setbb east 13303022912/13303022912_D55A.BHE
      setbb north (change 'HZ' 'HN' %vert%)
      ==> setbb north 13303022912/13303022912_D55A.BHN
      r %east% %north% %vert%
      ==> r 13303022912/13303022912_D55A.BHE
      13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
      xlim t1 -150 200
      plot1 rel
      setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")
      Enter y for OK event, n for bad event, then press Enter

      I get perfectly good seismograms if I manually enter the commands from
      within SAC, outside the macro:

      SAC> r 13303022912/13303022912_D55A.BHE
      13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
      SAC> xlim t1 -150 200
      SAC> plot1 rel


      Any suggestions gratefully received!

      Fiona Darbyshire.

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


      • Milton Plasencia
        2016-01-28 00:34:36
        Dear Fiona,

        Yes, the sac macro plot 3-componets records, i read 6 files, 3 LH? and 3 BH?,
        the macro show me only the last read BH?…

        the small change is only regarding the xlim,

        do file wild *HZ.sac
        setbb vert $file
        setbb east (change 'HZ' 'HE' %vert%)
        setbb north (change 'HZ' 'HN' %vert%)
        r %east% %north% %vert%
        xlim 50 220
        p1 rel
        setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")
        enddo
        ~

        After the second “y” the X show me:



        Cheers,

        Milton


        On Jan 27, 2016, at 16:00, Fiona Darbyshire <f.darbyshire<at>gmail.com> wrote:

        Dear Milton,

        The SAC macro should simply plot a set of 3 seismograms (i.e. one
        3-component record); is this what you are referring to in your second
        paragraph? In what way did you modify the original macro, and what was
        the effect?

        Thanks,

        Fiona.

        PS. My server is Linux, running CentOS7.


        On Tue, Jan 26, 2016 at 9:39 PM, Milton Plasencia <mplasencia<at>inogs.it> wrote:
        i reproduce the problem using your (slightly modify) macro in sac 101.6a (OSX and Linux),

        The sac macro plot only the last (3-comp) files in OSX and Linux.

        Milton


        On Jan 26, 2016, at 22:59, Fiona Darbyshire <f.darbyshire<at>gmail.com> wrote:

        I have recently purchased a new server, which has enabled me to
        upgrade from SAC101.4 to SAC101.6a. I'm transferring and testing
        various SAC-related programs and macros, and have run into something
        rather strange.

        The macro in question is one I wrote to facilitate rapid quality
        control of seismograms; it reads a set of SAC files, plots them on the
        screen, asks the user to input "y" or "n", and moves the seismograms
        into a different directory according to the response. The problem I'm
        having is that, when I execute the macro, I get a blank X window with
        no seismogram plot. However, if I type manually the read, xlim and
        plot1 commands I get a perfectly decent seismogram plot in the X
        window.

        Is there something extra that needs to be set at the beginning of the
        macro to allow the seismograms to be plotted correctly, or have I
        simply made some kind of mistake in the macro?

        The pertinent part of the macro is as follows:

        do file wild 13*/*HZ
        setbb vert $file
        setbb east (change 'HZ' 'HE' %vert%)
        setbb north (change 'HZ' 'HN' %vert%)
        r %east% %north% %vert%
        xlim t1 -150 200
        plot1 rel
        setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")

        If I run this with "echo on" for everything, I get:

        SAC> m ./qualitycontrol1.sm
        do file wild 13*/*HZ
        setbb vert $file
        ==> setbb vert 13303022912/13303022912_D55A.BHZ
        setbb east (change 'HZ' 'HE' %vert%)
        ==> setbb east 13303022912/13303022912_D55A.BHE
        setbb north (change 'HZ' 'HN' %vert%)
        ==> setbb north 13303022912/13303022912_D55A.BHN
        r %east% %north% %vert%
        ==> r 13303022912/13303022912_D55A.BHE
        13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
        xlim t1 -150 200
        plot1 rel
        setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")
        Enter y for OK event, n for bad event, then press Enter

        I get perfectly good seismograms if I manually enter the commands from
        within SAC, outside the macro:

        SAC> r 13303022912/13303022912_D55A.BHE
        13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
        SAC> xlim t1 -150 200
        SAC> plot1 rel


        Any suggestions gratefully received!

        Fiona Darbyshire.

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



        • Fiona Darbyshire
          2016-01-27 20:55:58
          Hello,

          This poses a double problem for me:
          First of all, in a set of multiple files, why would the macro only show the
          last 3?
          Secondly, why would one have to press "y" twice before even seeing the
          seismograms?

          My aim is, for a large set of SAC files, to read and display them 3 at a
          time (the 3 components). For each seismogram set displayed, the question
          "Enter y for OK event..." is posed. Based on the response, the seismogram
          set is moved into one directory or another (that's the 2nd part of the
          macro, which I didn't include in the original email). So as soon as I press
          y the seismogram is moved and the next one is read. So I would just get a
          succession of blank X windows in the current situation, rendering the
          quality control useless. The macro was working perfectly in sac101.4; what
          has changed?

          I need to get this resolved as soon as possible, as I have a set of new
          students starting seismic-analysis projects with me, and they'll be
          depending on the quality-control macros to sort through their data in a
          timely fashion. None have any experience with Linux/SAC, so it's up to me
          to get scripts & macros running correctly for their analyses.

          FYI, here's the entire macro to illustrate [I also tried it with absolute x
          limits as in Milton's modification]:

          do file wild 13*/*HZ
          setbb vert $file
          setbb east (change 'HZ' 'HE' %vert%)
          setbb north (change 'HZ' 'HN' %vert%)
          r %east% %north% %vert%
          xlim t1 -150 200
          plot1 rel
          setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
          ")
          if %resp% eq "y" then
          sc mv %vert% NOTBAD
          sc mv %east% NOTBAD
          sc mv %north% NOTBAD
          else if %resp% eq "n" then
          sc mv %vert% BAD
          sc mv %east% BAD
          sc mv %north% BAD
          endif
          enddo

          Thanks a lot,

          Fiona.


          On Wed, Jan 27, 2016 at 10:37 AM, Milton Plasencia <mplasencia<at>inogs.it>
          wrote:

          Dear Fiona,

          Yes, the sac macro plot 3-componets records, i read 6 files, 3 LH? and 3
          BH?,
          the macro show me only the last read BH?…

          the small change is only regarding the xlim,

          do file wild *HZ.sac
          setbb vert $file
          setbb east (change 'HZ' 'HE' %vert%)
          setbb north (change 'HZ' 'HN' %vert%)
          r %east% %north% %vert%
          xlim 50 220
          p1 rel
          setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
          ")
          enddo
          ~

          After the second “y” the X show me:

          Cheers,

          Milton


          On Jan 27, 2016, at 16:00, Fiona Darbyshire <f.darbyshire<at>gmail.com>
          wrote:

          Dear Milton,

          The SAC macro should simply plot a set of 3 seismograms (i.e. one
          3-component record); is this what you are referring to in your second
          paragraph? In what way did you modify the original macro, and what was
          the effect?

          Thanks,

          Fiona.

          PS. My server is Linux, running CentOS7.


          On Tue, Jan 26, 2016 at 9:39 PM, Milton Plasencia <mplasencia<at>inogs.it>
          wrote:

          i reproduce the problem using your (slightly modify) macro in sac 101.6a
          (OSX and Linux),

          The sac macro plot only the last (3-comp) files in OSX and Linux.

          Milton


          On Jan 26, 2016, at 22:59, Fiona Darbyshire <f.darbyshire<at>gmail.com>
          wrote:

          I have recently purchased a new server, which has enabled me to
          upgrade from SAC101.4 to SAC101.6a. I'm transferring and testing
          various SAC-related programs and macros, and have run into something
          rather strange.

          The macro in question is one I wrote to facilitate rapid quality
          control of seismograms; it reads a set of SAC files, plots them on the
          screen, asks the user to input "y" or "n", and moves the seismograms
          into a different directory according to the response. The problem I'm
          having is that, when I execute the macro, I get a blank X window with
          no seismogram plot. However, if I type manually the read, xlim and
          plot1 commands I get a perfectly decent seismogram plot in the X
          window.

          Is there something extra that needs to be set at the beginning of the
          macro to allow the seismograms to be plotted correctly, or have I
          simply made some kind of mistake in the macro?

          The pertinent part of the macro is as follows:

          do file wild 13*/*HZ
          setbb vert $file
          setbb east (change 'HZ' 'HE' %vert%)
          setbb north (change 'HZ' 'HN' %vert%)
          r %east% %north% %vert%
          xlim t1 -150 200
          plot1 rel
          setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
          ")

          If I run this with "echo on" for everything, I get:

          SAC> m ./qualitycontrol1.sm
          do file wild 13*/*HZ
          setbb vert $file
          ==> setbb vert 13303022912/13303022912_D55A.BHZ
          setbb east (change 'HZ' 'HE' %vert%)
          ==> setbb east 13303022912/13303022912_D55A.BHE
          setbb north (change 'HZ' 'HN' %vert%)
          ==> setbb north 13303022912/13303022912_D55A.BHN
          r %east% %north% %vert%
          ==> r 13303022912/13303022912_D55A.BHE
          13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
          xlim t1 -150 200
          plot1 rel
          setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
          ")
          Enter y for OK event, n for bad event, then press Enter

          I get perfectly good seismograms if I manually enter the commands from
          within SAC, outside the macro:

          SAC> r 13303022912/13303022912_D55A.BHE
          13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
          SAC> xlim t1 -150 200
          SAC> plot1 rel


          Any suggestions gratefully received!

          Fiona Darbyshire.

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




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



          • Milton Plasencia
            2016-01-28 06:35:48
            See below

            On Jan 27, 2016, at 18:55, Fiona Darbyshire <f.darbyshire<at>gmail.com> wrote:

            Hello,

            This poses a double problem for me:
            First of all, in a set of multiple files, why would the macro only show the last 3?
            I is the original problem.
            Secondly, why would one have to press "y" twice before even seeing the seismograms?
            In my case i read 2 groups of data, so to plot the first group i press “y” one time and
            another “y” to plot the second group, and it is not the expected behavior.

            My aim is, for a large set of SAC files, to read and display them 3 at a time (the 3 components). For each seismogram set displayed, the question "Enter y for OK event..." is posed. Based on the response, the seismogram set is moved into one directory or another (that's the 2nd part of the macro, which I didn't include in the original email). So as soon as I press y the seismogram is moved and the next one is read. So I would just get a succession of blank X windows in the current situation, rendering the quality control useless. The macro was working perfectly in sac101.4; what has changed?
            Perhaps the developers have a answer.

            I need to get this resolved as soon as possible, as I have a set of new students starting seismic-analysis projects with me, and they'll be depending on the quality-control macros to sort through their data in a timely fashion. None have any experience with Linux/SAC, so it's up to me to get scripts & macros running correctly for their analyses.
            In the meantime you can use the 101.4 version where the macro working fine.

            FYI, here's the entire macro to illustrate [I also tried it with absolute x limits as in Milton's modification]:

            do file wild 13*/*HZ
            setbb vert $file
            setbb east (change 'HZ' 'HE' %vert%)
            setbb north (change 'HZ' 'HN' %vert%)
            r %east% %north% %vert%
            xlim t1 -150 200
            plot1 rel
            setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")
            if %resp% eq "y" then
            sc mv %vert% NOTBAD
            sc mv %east% NOTBAD
            sc mv %north% NOTBAD
            else if %resp% eq "n" then
            sc mv %vert% BAD
            sc mv %east% BAD
            sc mv %north% BAD
            endif
            enddo

            Thanks a lot,

            Fiona.


            On Wed, Jan 27, 2016 at 10:37 AM, Milton Plasencia <mplasencia<at>inogs.it <mplasencia<at>inogs.it>> wrote:
            Dear Fiona,

            Yes, the sac macro plot 3-componets records, i read 6 files, 3 LH? and 3 BH?,
            the macro show me only the last read BH?…

            the small change is only regarding the xlim,

            do file wild *HZ.sac
            setbb vert $file
            setbb east (change 'HZ' 'HE' %vert%)
            setbb north (change 'HZ' 'HN' %vert%)
            r %east% %north% %vert%
            xlim 50 220
            p1 rel
            setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")
            enddo
            ~

            After the second “y” the X show me:

            Cheers,

            Milton


            On Jan 27, 2016, at 16:00, Fiona Darbyshire <f.darbyshire<at>gmail.com <f.darbyshire<at>gmail.com>> wrote:

            Dear Milton,

            The SAC macro should simply plot a set of 3 seismograms (i.e. one
            3-component record); is this what you are referring to in your second
            paragraph? In what way did you modify the original macro, and what was
            the effect?

            Thanks,

            Fiona.

            PS. My server is Linux, running CentOS7.


            On Tue, Jan 26, 2016 at 9:39 PM, Milton Plasencia <mplasencia<at>inogs.it <mplasencia<at>inogs.it>> wrote:
            i reproduce the problem using your (slightly modify) macro in sac 101.6a (OSX and Linux),

            The sac macro plot only the last (3-comp) files in OSX and Linux.

            Milton


            On Jan 26, 2016, at 22:59, Fiona Darbyshire <f.darbyshire<at>gmail.com <f.darbyshire<at>gmail.com>> wrote:

            I have recently purchased a new server, which has enabled me to
            upgrade from SAC101.4 to SAC101.6a. I'm transferring and testing
            various SAC-related programs and macros, and have run into something
            rather strange.

            The macro in question is one I wrote to facilitate rapid quality
            control of seismograms; it reads a set of SAC files, plots them on the
            screen, asks the user to input "y" or "n", and moves the seismograms
            into a different directory according to the response. The problem I'm
            having is that, when I execute the macro, I get a blank X window with
            no seismogram plot. However, if I type manually the read, xlim and
            plot1 commands I get a perfectly decent seismogram plot in the X
            window.

            Is there something extra that needs to be set at the beginning of the
            macro to allow the seismograms to be plotted correctly, or have I
            simply made some kind of mistake in the macro?

            The pertinent part of the macro is as follows:

            do file wild 13*/*HZ
            setbb vert $file
            setbb east (change 'HZ' 'HE' %vert%)
            setbb north (change 'HZ' 'HN' %vert%)
            r %east% %north% %vert%
            xlim t1 -150 200
            plot1 rel
            setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")

            If I run this with "echo on" for everything, I get:

            SAC> m ./qualitycontrol1.sm http://qualitycontrol1.sm/
            do file wild 13*/*HZ
            setbb vert $file
            ==> setbb vert 13303022912 <tel:13303022912>/13303022912 <tel:13303022912>_D55A.BHZ
            setbb east (change 'HZ' 'HE' %vert%)
            ==> setbb east 13303022912 <tel:13303022912>/13303022912 <tel:13303022912>_D55A.BHE
            setbb north (change 'HZ' 'HN' %vert%)
            ==> setbb north 13303022912 <tel:13303022912>/13303022912 <tel:13303022912>_D55A.BHN
            r %east% %north% %vert%
            ==> r 13303022912 <tel:13303022912>/13303022912 <tel:13303022912>_D55A.BHE
            13303022912 <tel:13303022912>/13303022912 <tel:13303022912>_D55A.BHN 13303022912 <tel:13303022912>/13303022912 <tel:13303022912>_D55A.BHZ
            xlim t1 -150 200
            plot1 rel
            setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter ")
            Enter y for OK event, n for bad event, then press Enter

            I get perfectly good seismograms if I manually enter the commands from
            within SAC, outside the macro:

            SAC> r 13303022912 <tel:13303022912>/13303022912_D55A.BHE
            13303022912 <tel:13303022912>/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
            SAC> xlim t1 -150 200
            SAC> plot1 rel


            Any suggestions gratefully received!

            Fiona Darbyshire.

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




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




            Attachments
            • Fiona Darbyshire
              2016-01-28 02:19:30
              Hello,

              Calling the macro from within the shell script results in the same
              problem of a blank Xwindow where the seismograms should be. Thanks
              anyway for the script suggestion. I'm quite keen to use 101.6a on the
              new server if possible, as it has some features that I like very much
              (e.g. the "saveimg" command).

              I decided, just in case, to try a different "plot" command instead of
              "plot1" - if I use "plotpk" the seismograms appear just fine. This is
              a feasible workaround, though it does involve a bit more mouse work
              that could get tedious when quality-controlling hundreds of
              seismograms - you have to click on the Xwindow and type "q" before you
              can get to the prompt for the "y/n" quality responses.
              This suggests to me that the issue is presumably something to do with
              the behaviour of the "plot1" command from within a macro. Any thoughts
              on this from the developers?

              Thanks,

              Fiona.


              On Wed, Jan 27, 2016 at 4:36 PM, Milton Plasencia <mplasencia<at>inogs.it> wrote:
              See below

              On Jan 27, 2016, at 18:55, Fiona Darbyshire <f.darbyshire<at>gmail.com> wrote:

              Hello,

              This poses a double problem for me:
              First of all, in a set of multiple files, why would the macro only show the
              last 3?

              I is the original problem.

              Secondly, why would one have to press "y" twice before even seeing the
              seismograms?

              In my case i read 2 groups of data, so to plot the first group i press “y”
              one time and
              another “y” to plot the second group, and it is not the expected behavior.


              My aim is, for a large set of SAC files, to read and display them 3 at a
              time (the 3 components). For each seismogram set displayed, the question
              "Enter y for OK event..." is posed. Based on the response, the seismogram
              set is moved into one directory or another (that's the 2nd part of the
              macro, which I didn't include in the original email). So as soon as I press
              y the seismogram is moved and the next one is read. So I would just get a
              succession of blank X windows in the current situation, rendering the
              quality control useless. The macro was working perfectly in sac101.4; what
              has changed?

              Perhaps the developers have a answer.


              I need to get this resolved as soon as possible, as I have a set of new
              students starting seismic-analysis projects with me, and they'll be
              depending on the quality-control macros to sort through their data in a
              timely fashion. None have any experience with Linux/SAC, so it's up to me to
              get scripts & macros running correctly for their analyses.

              In the meantime you can use the 101.4 version where the macro working fine.


              FYI, here's the entire macro to illustrate [I also tried it with absolute x
              limits as in Milton's modification]:

              do file wild 13*/*HZ
              setbb vert $file
              setbb east (change 'HZ' 'HE' %vert%)
              setbb north (change 'HZ' 'HN' %vert%)
              r %east% %north% %vert%
              xlim t1 -150 200
              plot1 rel
              setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
              ")
              if %resp% eq "y" then
              sc mv %vert% NOTBAD
              sc mv %east% NOTBAD
              sc mv %north% NOTBAD
              else if %resp% eq "n" then
              sc mv %vert% BAD
              sc mv %east% BAD
              sc mv %north% BAD
              endif
              enddo

              Thanks a lot,

              Fiona.


              On Wed, Jan 27, 2016 at 10:37 AM, Milton Plasencia <mplasencia<at>inogs.it>
              wrote:

              Dear Fiona,

              Yes, the sac macro plot 3-componets records, i read 6 files, 3 LH? and 3
              BH?,
              the macro show me only the last read BH?…

              the small change is only regarding the xlim,

              do file wild *HZ.sac
              setbb vert $file
              setbb east (change 'HZ' 'HE' %vert%)
              setbb north (change 'HZ' 'HN' %vert%)
              r %east% %north% %vert%
              xlim 50 220
              p1 rel
              setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
              ")
              enddo
              ~

              After the second “y” the X show me:

              Cheers,

              Milton


              On Jan 27, 2016, at 16:00, Fiona Darbyshire <f.darbyshire<at>gmail.com>
              wrote:

              Dear Milton,

              The SAC macro should simply plot a set of 3 seismograms (i.e. one
              3-component record); is this what you are referring to in your second
              paragraph? In what way did you modify the original macro, and what was
              the effect?

              Thanks,

              Fiona.

              PS. My server is Linux, running CentOS7.


              On Tue, Jan 26, 2016 at 9:39 PM, Milton Plasencia <mplasencia<at>inogs.it>
              wrote:

              i reproduce the problem using your (slightly modify) macro in sac 101.6a
              (OSX and Linux),

              The sac macro plot only the last (3-comp) files in OSX and Linux.

              Milton


              On Jan 26, 2016, at 22:59, Fiona Darbyshire <f.darbyshire<at>gmail.com>
              wrote:

              I have recently purchased a new server, which has enabled me to
              upgrade from SAC101.4 to SAC101.6a. I'm transferring and testing
              various SAC-related programs and macros, and have run into something
              rather strange.

              The macro in question is one I wrote to facilitate rapid quality
              control of seismograms; it reads a set of SAC files, plots them on the
              screen, asks the user to input "y" or "n", and moves the seismograms
              into a different directory according to the response. The problem I'm
              having is that, when I execute the macro, I get a blank X window with
              no seismogram plot. However, if I type manually the read, xlim and
              plot1 commands I get a perfectly decent seismogram plot in the X
              window.

              Is there something extra that needs to be set at the beginning of the
              macro to allow the seismograms to be plotted correctly, or have I
              simply made some kind of mistake in the macro?

              The pertinent part of the macro is as follows:

              do file wild 13*/*HZ
              setbb vert $file
              setbb east (change 'HZ' 'HE' %vert%)
              setbb north (change 'HZ' 'HN' %vert%)
              r %east% %north% %vert%
              xlim t1 -150 200
              plot1 rel
              setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
              ")

              If I run this with "echo on" for everything, I get:

              SAC> m ./qualitycontrol1.sm
              do file wild 13*/*HZ
              setbb vert $file
              ==> setbb vert 13303022912/13303022912_D55A.BHZ
              setbb east (change 'HZ' 'HE' %vert%)
              ==> setbb east 13303022912/13303022912_D55A.BHE
              setbb north (change 'HZ' 'HN' %vert%)
              ==> setbb north 13303022912/13303022912_D55A.BHN
              r %east% %north% %vert%
              ==> r 13303022912/13303022912_D55A.BHE
              13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
              xlim t1 -150 200
              plot1 rel
              setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
              ")
              Enter y for OK event, n for bad event, then press Enter

              I get perfectly good seismograms if I manually enter the commands from
              within SAC, outside the macro:

              SAC> r 13303022912/13303022912_D55A.BHE
              13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
              SAC> xlim t1 -150 200
              SAC> plot1 rel


              Any suggestions gratefully received!

              Fiona Darbyshire.

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




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


              • Brian Savage
                2016-01-28 02:36:56
                Fiona,

                I have been following your discussion and have looked into the issue.

                The REPLY inline function in 101.6a blocks all I/O waiting for input from the keyboard, this includes updating the plotting window. This is why nothing appears in the plot window and nothing updates even if you resize the plot window.

                I have a simple fix for this issue and I am currently making sure it does not cause problems elsewhere. It will be available in the next version.

                Using ppk is the best workaround at this point; not great but workable.

                This bug was introduced when we added the updated parser. My apologies for this.

                Brian

                On Jan 27, 2016, at 6:20 PM, Fiona Darbyshire <f.darbyshire<at>gmail.com> wrote:

                Hello,

                Calling the macro from within the shell script results in the same
                problem of a blank Xwindow where the seismograms should be. Thanks
                anyway for the script suggestion. I'm quite keen to use 101.6a on the
                new server if possible, as it has some features that I like very much
                (e.g. the "saveimg" command).

                I decided, just in case, to try a different "plot" command instead of
                "plot1" - if I use "plotpk" the seismograms appear just fine. This is
                a feasible workaround, though it does involve a bit more mouse work
                that could get tedious when quality-controlling hundreds of
                seismograms - you have to click on the Xwindow and type "q" before you
                can get to the prompt for the "y/n" quality responses.
                This suggests to me that the issue is presumably something to do with
                the behaviour of the "plot1" command from within a macro. Any thoughts
                on this from the developers?

                Thanks,

                Fiona.


                On Wed, Jan 27, 2016 at 4:36 PM, Milton Plasencia <mplasencia<at>inogs.it> wrote:
                See below

                On Jan 27, 2016, at 18:55, Fiona Darbyshire <f.darbyshire<at>gmail.com> wrote:

                Hello,

                This poses a double problem for me:
                First of all, in a set of multiple files, why would the macro only show the
                last 3?

                I is the original problem.

                Secondly, why would one have to press "y" twice before even seeing the
                seismograms?

                In my case i read 2 groups of data, so to plot the first group i press “y”
                one time and
                another “y” to plot the second group, and it is not the expected behavior.


                My aim is, for a large set of SAC files, to read and display them 3 at a
                time (the 3 components). For each seismogram set displayed, the question
                "Enter y for OK event..." is posed. Based on the response, the seismogram
                set is moved into one directory or another (that's the 2nd part of the
                macro, which I didn't include in the original email). So as soon as I press
                y the seismogram is moved and the next one is read. So I would just get a
                succession of blank X windows in the current situation, rendering the
                quality control useless. The macro was working perfectly in sac101.4; what
                has changed?

                Perhaps the developers have a answer.


                I need to get this resolved as soon as possible, as I have a set of new
                students starting seismic-analysis projects with me, and they'll be
                depending on the quality-control macros to sort through their data in a
                timely fashion. None have any experience with Linux/SAC, so it's up to me to
                get scripts & macros running correctly for their analyses.

                In the meantime you can use the 101.4 version where the macro working fine.


                FYI, here's the entire macro to illustrate [I also tried it with absolute x
                limits as in Milton's modification]:

                do file wild 13*/*HZ
                setbb vert $file
                setbb east (change 'HZ' 'HE' %vert%)
                setbb north (change 'HZ' 'HN' %vert%)
                r %east% %north% %vert%
                xlim t1 -150 200
                plot1 rel
                setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
                ")
                if %resp% eq "y" then
                sc mv %vert% NOTBAD
                sc mv %east% NOTBAD
                sc mv %north% NOTBAD
                else if %resp% eq "n" then
                sc mv %vert% BAD
                sc mv %east% BAD
                sc mv %north% BAD
                endif
                enddo

                Thanks a lot,

                Fiona.


                On Wed, Jan 27, 2016 at 10:37 AM, Milton Plasencia <mplasencia<at>inogs.it>
                wrote:

                Dear Fiona,

                Yes, the sac macro plot 3-componets records, i read 6 files, 3 LH? and 3
                BH?,
                the macro show me only the last read BH?…

                the small change is only regarding the xlim,

                do file wild *HZ.sac
                setbb vert $file
                setbb east (change 'HZ' 'HE' %vert%)
                setbb north (change 'HZ' 'HN' %vert%)
                r %east% %north% %vert%
                xlim 50 220
                p1 rel
                setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
                ")
                enddo
                ~

                After the second “y” the X show me:

                Cheers,

                Milton


                On Jan 27, 2016, at 16:00, Fiona Darbyshire <f.darbyshire<at>gmail.com>
                wrote:

                Dear Milton,

                The SAC macro should simply plot a set of 3 seismograms (i.e. one
                3-component record); is this what you are referring to in your second
                paragraph? In what way did you modify the original macro, and what was
                the effect?

                Thanks,

                Fiona.

                PS. My server is Linux, running CentOS7.


                On Tue, Jan 26, 2016 at 9:39 PM, Milton Plasencia <mplasencia<at>inogs.it>
                wrote:

                i reproduce the problem using your (slightly modify) macro in sac 101.6a
                (OSX and Linux),

                The sac macro plot only the last (3-comp) files in OSX and Linux.

                Milton


                On Jan 26, 2016, at 22:59, Fiona Darbyshire <f.darbyshire<at>gmail.com>
                wrote:

                I have recently purchased a new server, which has enabled me to
                upgrade from SAC101.4 to SAC101.6a. I'm transferring and testing
                various SAC-related programs and macros, and have run into something
                rather strange.

                The macro in question is one I wrote to facilitate rapid quality
                control of seismograms; it reads a set of SAC files, plots them on the
                screen, asks the user to input "y" or "n", and moves the seismograms
                into a different directory according to the response. The problem I'm
                having is that, when I execute the macro, I get a blank X window with
                no seismogram plot. However, if I type manually the read, xlim and
                plot1 commands I get a perfectly decent seismogram plot in the X
                window.

                Is there something extra that needs to be set at the beginning of the
                macro to allow the seismograms to be plotted correctly, or have I
                simply made some kind of mistake in the macro?

                The pertinent part of the macro is as follows:

                do file wild 13*/*HZ
                setbb vert $file
                setbb east (change 'HZ' 'HE' %vert%)
                setbb north (change 'HZ' 'HN' %vert%)
                r %east% %north% %vert%
                xlim t1 -150 200
                plot1 rel
                setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
                ")

                If I run this with "echo on" for everything, I get:

                SAC> m ./qualitycontrol1.sm
                do file wild 13*/*HZ
                setbb vert $file
                ==> setbb vert 13303022912/13303022912_D55A.BHZ
                setbb east (change 'HZ' 'HE' %vert%)
                ==> setbb east 13303022912/13303022912_D55A.BHE
                setbb north (change 'HZ' 'HN' %vert%)
                ==> setbb north 13303022912/13303022912_D55A.BHN
                r %east% %north% %vert%
                ==> r 13303022912/13303022912_D55A.BHE
                13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
                xlim t1 -150 200
                plot1 rel
                setbb resp (REPLY "Enter y for OK event, n for bad event, then press Enter
                ")
                Enter y for OK event, n for bad event, then press Enter

                I get perfectly good seismograms if I manually enter the commands from
                within SAC, outside the macro:

                SAC> r 13303022912/13303022912_D55A.BHE
                13303022912/13303022912_D55A.BHN 13303022912/13303022912_D55A.BHZ
                SAC> xlim t1 -150 200
                SAC> plot1 rel


                Any suggestions gratefully received!

                Fiona Darbyshire.

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




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


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


Page built 10:06:37 | v.b'ea7a92