Thread: SAC POLEZERO option

Started: 2015-04-21 19:51:59
Last activity: 2015-04-23 08:49:37
Topics: SAC Help
Kees Weemstra
2015-04-21 19:51:59
Dear Mr/Mrs,

I have a question regarding the removal of the instrument response.
I possess a data set stored in the mseed format. Fortunately, a colleague
of mine wrote a fortran library to read and/or filter mseed files (in CC).
I am used to using SAC for my processing, but since I simply don't have the
data in the SAC format, I deemed it wise to use this mseed fortran library
(I am an experienced user of fortran).

What we would like to achieve is to remove the instrument response
ourselves using the polezero files. Most stations were deployed
using Trillium Compact (120 s) instruments. Below (italic) is the polezero
file (PZ_TRILLIUM120) for such an instrument:

** OUTPUT UNIT : COUNTS*
** INSTTYPE : Trillium compact 120s*
** AD-conversion : 1.6393*10^7 counts/V*
** SENSITIVITY : 749.1 V/(m/s)*
** A0 : 8.184*10^11*
** Constant : 1.0049949e+22 (AD-conversion*sensitivity*A0
)*
** CONSTANT 1.0049949*10^22*
*ZEROS 3*
*0.0 0.0*
*0.0 0.0*
*-434.1 0.0*
*POLES 7*
*-0.03691 0.03712*
*-0.03691 -0.03712*
*-371.2 0.0*
*-373.9 475.5*
*-373.9 -475.5*
*-588.4 1508*
*-588.4 -150*
*CONSTANT 10049949000000000000000*

In case I would have the data in SAC-format, I would use "TRANS FROM
POLEZERO S PZ_TRILLIUM120 TO NONE FREQ 0.01 0.02 5.0 10.0" to remove the
instrument response. However, I don't have the data in SAC-format, but
simply as an array of numbers in my fortran code. And I don't want to write
hundreds of gigabytes of data to the SAC format, while I later need perform
additional processing and hence would need to read the same SAC files again.
My question therefore is: how can I use the details in the Polezero file
above to remove the instrument response?
This essentially requires the answer to a number of questions. Which poles
and zeros are required by SAC. If I understand the SAC manual correctly,
the poles and zeros required are the ones associated with the laplace
transform of the transfer function. We would like to use an IIR filter to
remove the instrument response and hence would need to convert these
`s-poles' and `s-zeros' to `z-poles' and 'z-zeros' . If I am correct, this
involves a conversion z=e^(s dt), where s is a pole or zero (as given above
in the POLEZERO file).
Another question involves the corner frequencies, how does SAC `filter' the
data between 0.02 and 5 Hz (in our case)? And which taper is applied
between 0.01 and 0.02 Hz, and 5 and 10 Hz.

Thanks in advance!

Best Regards,
Kees

________________________________________________________

Dr. Cornelis Weemstra
(http://www.kweemstra.com)

Department of Geoscience and Engineering
Delft University of Technology
Stevinweg 1
2628 CN Delft
The Netherlands

e-mail: kweemstra<at>gmail.com
tel:
cell: 0031 645012455
__________________________________________________________________

  • Milton Plasencia
    2015-04-21 20:40:24
    Dear Kees,

    Also exists libraries for reading a write mseed format from IRIS.

    i suggest you to use SAC to remove the instrument response and your command
    and PZ_TRILLIUM120 file look OK (your channels are 20 sps).

    Regarding the corner frequencies, the response is flat between 0.02 to 5,
    decay from 5 up to 10 and after 10 is zero, the same between 0.01 and 0.02,
    after 0.01 is zero.

    0.02 5
    - \—————————————————\
    - -
    - -
    - -
    ———\ -\————— Freq.
    0.01 10

    HTH,

    Milton

    On Apr 21, 2015, at 12:51, Kees Weemstra <kweemstra<at>gmail.com> wrote:

    Dear Mr/Mrs,

    I have a question regarding the removal of the instrument response.
    I possess a data set stored in the mseed format. Fortunately, a colleague of mine wrote a fortran library to read and/or filter mseed files (in CC). I am used to using SAC for my processing, but since I simply don't have the data in the SAC format, I deemed it wise to use this mseed fortran library (I am an experienced user of fortran).

    What we would like to achieve is to remove the instrument response ourselves using the polezero files. Most stations were deployed using Trillium Compact (120 s) instruments. Below (italic) is the polezero file (PZ_TRILLIUM120) for such an instrument:

    * OUTPUT UNIT : COUNTS
    * INSTTYPE : Trillium compact 120s
    * AD-conversion : 1.6393*10^7 counts/V
    * SENSITIVITY : 749.1 V/(m/s)
    * A0 : 8.184*10^11
    * Constant : 1.0049949e+22 (AD-conversion*sensitivity*A0 )
    * CONSTANT 1.0049949*10^22
    ZEROS 3
    0.0 0.0
    0.0 0.0
    -434.1 0.0
    POLES 7
    -0.03691 0.03712
    -0.03691 -0.03712
    -371.2 0.0
    -373.9 475.5
    -373.9 -475.5
    -588.4 1508
    -588.4 -150
    CONSTANT 10049949000000000000000

    In case I would have the data in SAC-format, I would use "TRANS FROM POLEZERO S PZ_TRILLIUM120 TO NONE FREQ 0.01 0.02 5.0 10.0" to remove the instrument response. However, I don't have the data in SAC-format, but simply as an array of numbers in my fortran code. And I don't want to write hundreds of gigabytes of data to the SAC format, while I later need perform additional processing and hence would need to read the same SAC files again.
    My question therefore is: how can I use the details in the Polezero file above to remove the instrument response?
    This essentially requires the answer to a number of questions. Which poles and zeros are required by SAC. If I understand the SAC manual correctly, the poles and zeros required are the ones associated with the laplace transform of the transfer function. We would like to use an IIR filter to remove the instrument response and hence would need to convert these `s-poles' and `s-zeros' to `z-poles' and 'z-zeros' . If I am correct, this involves a conversion z=e^(s dt), where s is a pole or zero (as given above in the POLEZERO file).
    Another question involves the corner frequencies, how does SAC `filter' the data between 0.02 and 5 Hz (in our case)? And which taper is applied between 0.01 and 0.02 Hz, and 5 and 10 Hz.

    Thanks in advance!

    Best Regards,
    Kees

    ________________________________________________________

    Dr. Cornelis Weemstra
    (http://www.kweemstra.com http://www.kweemstra.com/)

    Department of Geoscience and Engineering
    Delft University of Technology
    Stevinweg 1
    2628 CN Delft
    The Netherlands

    e-mail: kweemstra<at>gmail.com <kweemstra<at>gmail.com>
    tel:
    cell: 0031 645012455
    __________________________________________________________________
    _______________________________________________
    sac-help mailing list
    sac-help<at>iris.washington.edu
    http://www.iris.washington.edu/mailman/listinfo/sac-help


    • George Helffrich
      2015-04-22 05:43:06
      Dear All -

      Also note that SAC/BRIS reads mseed data (and CSS, GSE, Guralp, …) directly as well as SAC files. So a perfectly viable approach is to avoid re-implementing all the filtering and instrument correction functionality of SAC in your program and considering how you could do your downstream processing in SAC. The SAC book has suggestions and case studies on doing just that — one of the reasons I and my co-authors wrote it.

      On 21 Apr 2015, at 20:40, Milton Plasencia <mplasencia<at>inogs.it> wrote:

      Dear Kees,

      Also exists libraries for reading a write mseed format from IRIS.

      i suggest you to use SAC to remove the instrument response and your command
      and PZ_TRILLIUM120 file look OK (your channels are 20 sps).

      Regarding the corner frequencies, the response is flat between 0.02 to 5,
      decay from 5 up to 10 and after 10 is zero, the same between 0.01 and 0.02,
      after 0.01 is zero.

      0.02 5
      - \—————————————————\
      - -
      - -
      - -
      ———\ -\————— Freq.
      0.01 10

      HTH,

      Milton

      On Apr 21, 2015, at 12:51, Kees Weemstra <kweemstra<at>gmail.com> wrote:

      Dear Mr/Mrs,

      I have a question regarding the removal of the instrument response.
      I possess a data set stored in the mseed format. Fortunately, a colleague of mine wrote a fortran library to read and/or filter mseed files (in CC). I am used to using SAC for my processing, but since I simply don't have the data in the SAC format, I deemed it wise to use this mseed fortran library (I am an experienced user of fortran).

      What we would like to achieve is to remove the instrument response ourselves using the polezero files. Most stations were deployed using Trillium Compact (120 s) instruments. Below (italic) is the polezero file (PZ_TRILLIUM120) for such an instrument:

      * OUTPUT UNIT : COUNTS
      * INSTTYPE : Trillium compact 120s
      * AD-conversion : 1.6393*10^7 counts/V
      * SENSITIVITY : 749.1 V/(m/s)
      * A0 : 8.184*10^11
      * Constant : 1.0049949e+22 (AD-conversion*sensitivity*A0 )
      * CONSTANT 1.0049949*10^22
      ZEROS 3
      0.0 0.0
      0.0 0.0
      -434.1 0.0
      POLES 7
      -0.03691 0.03712
      -0.03691 -0.03712
      -371.2 0.0
      -373.9 475.5
      -373.9 -475.5
      -588.4 1508
      -588.4 -150
      CONSTANT 10049949000000000000000

      In case I would have the data in SAC-format, I would use "TRANS FROM POLEZERO S PZ_TRILLIUM120 TO NONE FREQ 0.01 0.02 5.0 10.0" to remove the instrument response. However, I don't have the data in SAC-format, but simply as an array of numbers in my fortran code. And I don't want to write hundreds of gigabytes of data to the SAC format, while I later need perform additional processing and hence would need to read the same SAC files again.
      My question therefore is: how can I use the details in the Polezero file above to remove the instrument response?
      This essentially requires the answer to a number of questions. Which poles and zeros are required by SAC. If I understand the SAC manual correctly, the poles and zeros required are the ones associated with the laplace transform of the transfer function. We would like to use an IIR filter to remove the instrument response and hence would need to convert these `s-poles' and `s-zeros' to `z-poles' and 'z-zeros' . If I am correct, this involves a conversion z=e^(s dt), where s is a pole or zero (as given above in the POLEZERO file).
      Another question involves the corner frequencies, how does SAC `filter' the data between 0.02 and 5 Hz (in our case)? And which taper is applied between 0.01 and 0.02 Hz, and 5 and 10 Hz.

      Thanks in advance!

      Best Regards,
      Kees

      ________________________________________________________

      Dr. Cornelis Weemstra
      (http://www.kweemstra.com)

      Department of Geoscience and Engineering
      Delft University of Technology
      Stevinweg 1
      2628 CN Delft
      The Netherlands

      e-mail: kweemstra<at>gmail.com
      tel:
      cell: 0031 645012455
      __________________________________________________________________
      _______________________________________________
      sac-help mailing list
      sac-help<at>iris.washington.edu
      http://www.iris.washington.edu/mailman/listinfo/sac-help

      _______________________________________________
      sac-help mailing list
      sac-help<at>iris.washington.edu
      http://www.iris.washington.edu/mailman/listinfo/sac-help



      George Helffrich
      george.helffrich<at>bris.ac.uk


      • Kees Weemstra
        2015-04-23 00:47:27
        Dear all,

        First, I wasn't aware of the existence of SAC/BRIS altogether. Therefore
        thank you for that.
        Nevertheless, I quickly installed it on my system (ubuntu 14.04) ad I am
        only able to read one mseed file at a time. Moreover, I can't use the merge
        command to concatenate mseed files and subsequently do my processing. Being
        able to read the mseed files directly into my code, using the fortran mseed
        library I mentioned, would simply save me a lot of time. This library is
        able to read multiple files from a single directory, select specific
        channels, define start and end-time, etc.

        The only thing we still need to implement is the instrument response
        removal. Now, of course I can write all this data to .SAC files, remove the
        instrument response using SAC, and then read it again and continue with my
        processing. It is just quite cumbersome. I prefer to spend a bit of time
        and write a subroutine to remove the instrument response using the polezero
        details (poles, zeros and constant) in the polezero files required by sac.
        We just don't know exactly, as I mentioned in my first message, how to
        interpret the the details in the polezero files, i.e., which poles and
        zeros does SAC require. Once again, if I understand the SAC manual
        correctly, the poles and zeros required are the ones associated with the
        laplace transform of the transfer function. We would like to use an IIR
        filter to remove the instrument response and hence would need to convert
        these `s-poles' and `s-zeros' to `z-poles' and 'z-zeros', respectively. If
        I am correct, this involves a conversion z=e^(s dt), where s is a pole or
        zero (as given above in the POLEZERO file). Is this correct?

        The other question is also still not clear to me. If I understand Milton's
        answer correctly, the taper applied by sac's transfer command is between
        zero and unit amplitude. I would expect this to be a cosine (or something
        similar) taper...

        Regards,
        Kees

        __________________________________________________________________

        Dr. Cornelis Weemstra
        (http://www.kweemstra.com)

        Department of Geoscience and Engineering
        Delft University of Technology
        Stevinweg 1
        2628 CN Delft
        The Netherlands

        e-mail: kweemstra<at>gmail.com
        tel:
        cell: 0031 645012455
        __________________________________________________________________

        On Tue, Apr 21, 2015 at 3:43 PM, George Helffrich <
        George.Helffrich<at>bristol.ac.uk> wrote:

        Dear All -

        Also note that SAC/BRIS reads mseed data (and CSS, GSE, Guralp, …)
        directly as well as SAC files. So a perfectly viable approach is to avoid
        re-implementing all the filtering and instrument correction functionality
        of SAC in your program and considering how you could do your downstream
        processing in SAC. The SAC book has suggestions and case studies on doing
        just that — one of the reasons I and my co-authors wrote it.

        On 21 Apr 2015, at 20:40, Milton Plasencia <mplasencia<at>inogs.it> wrote:

        Dear Kees,

        Also exists libraries for reading a write mseed format from IRIS.

        i suggest you to use SAC to remove the instrument response and your
        command
        and PZ_TRILLIUM120 file look OK (your channels are 20 sps).

        Regarding the corner frequencies, the response is flat between 0.02 to 5,
        decay from 5 up to 10 and after 10 is zero, the same between 0.01 and 0.02,
        after 0.01 is zero.

        0.02
        5
        - \—————————————————\
        -
        -
        - -
        - -
        ———\ -\————— Freq.
        0.01 10

        HTH,

        Milton

        On Apr 21, 2015, at 12:51, Kees Weemstra <kweemstra<at>gmail.com> wrote:

        Dear Mr/Mrs,

        I have a question regarding the removal of the instrument response.
        I possess a data set stored in the mseed format. Fortunately, a colleague
        of mine wrote a fortran library to read and/or filter mseed files (in CC).
        I am used to using SAC for my processing, but since I simply don't have the
        data in the SAC format, I deemed it wise to use this mseed fortran library
        (I am an experienced user of fortran).

        What we would like to achieve is to remove the instrument response
        ourselves using the polezero files. Most stations were deployed
        using Trillium Compact (120 s) instruments. Below (italic) is the polezero
        file (PZ_TRILLIUM120) for such an instrument:

        ** OUTPUT UNIT : COUNTS*
        ** INSTTYPE : Trillium compact 120s*
        ** AD-conversion : 1.6393*10^7 counts/V*
        ** SENSITIVITY : 749.1 V/(m/s)*
        ** A0 : 8.184*10^11*
        ** Constant : 1.0049949e+22 (AD-conversion*sensitivity*A0
        )*
        ** CONSTANT 1.0049949*10^22*
        *ZEROS 3*
        *0.0 0.0*
        *0.0 0.0*
        *-434.1 0.0*
        *POLES 7*
        *-0.03691 0.03712*
        *-0.03691 -0.03712*
        *-371.2 0.0*
        *-373.9 475.5*
        *-373.9 -475.5*
        *-588.4 1508*
        *-588.4 -150*
        *CONSTANT 10049949000000000000000*

        In case I would have the data in SAC-format, I would use "TRANS FROM
        POLEZERO S PZ_TRILLIUM120 TO NONE FREQ 0.01 0.02 5.0 10.0" to remove the
        instrument response. However, I don't have the data in SAC-format, but
        simply as an array of numbers in my fortran code. And I don't want to write
        hundreds of gigabytes of data to the SAC format, while I later need perform
        additional processing and hence would need to read the same SAC files again.
        My question therefore is: how can I use the details in the Polezero file
        above to remove the instrument response?
        This essentially requires the answer to a number of questions. Which poles
        and zeros are required by SAC. If I understand the SAC manual correctly,
        the poles and zeros required are the ones associated with the laplace
        transform of the transfer function. We would like to use an IIR filter to
        remove the instrument response and hence would need to convert these
        `s-poles' and `s-zeros' to `z-poles' and 'z-zeros' . If I am correct, this
        involves a conversion z=e^(s dt), where s is a pole or zero (as given above
        in the POLEZERO file).
        Another question involves the corner frequencies, how does SAC `filter'
        the data between 0.02 and 5 Hz (in our case)? And which taper is applied
        between 0.01 and 0.02 Hz, and 5 and 10 Hz.

        Thanks in advance!

        Best Regards,
        Kees

        ________________________________________________________

        Dr. Cornelis Weemstra
        (http://www.kweemstra.com)

        Department of Geoscience and Engineering
        Delft University of Technology
        Stevinweg 1
        2628 CN Delft
        The Netherlands

        e-mail: kweemstra<at>gmail.com
        tel:
        cell: 0031 645012455
        __________________________________________________________________
        _______________________________________________
        sac-help mailing list
        sac-help<at>iris.washington.edu
        http://www.iris.washington.edu/mailman/listinfo/sac-help


        _______________________________________________
        sac-help mailing list
        sac-help<at>iris.washington.edu
        http://www.iris.washington.edu/mailman/listinfo/sac-help




        George Helffrich
        george.helffrich<at>bris.ac.uk



        • Milton Plasencia
          2015-04-23 02:03:07

          Hi,

          Please, see below,

          M.

          On Apr 22, 2015, at 17:47, Kees Weemstra <kweemstra<at>gmail.com> wrote:

          Dear all,

          First, I wasn't aware of the existence of SAC/BRIS altogether. Therefore thank you for that.


          Nevertheless, I quickly installed it on my system (ubuntu 14.04) ad I am only able to read one mseed file at a time. Moreover, I can't use the merge command to concatenate mseed files and subsequently do my processing. Being able to read the mseed files directly into my code, using the fortran mseed library I mentioned, would simply save me a lot of time. This library is able to read multiple files from a single directory, select specific channels, define start and end-time, etc.
          miniseed files can be merge simply using the command cat
          cat msed1 mseed2 …mseedn > big_mseed

          The only thing we still need to implement is the instrument response removal. Now, of course I can write all this data to .SAC files, remove the instrument response using SAC, and then read it again and continue with my processing. It is just quite cumbersome. I prefer to spend a bit of time and write a subroutine to remove the instrument response using the polezero details (poles, zeros and constant) in the polezero files required by sac.
          We just don't know exactly, as I mentioned in my first message, how to interpret the the details in the polezero files, i.e., which poles and zeros does SAC require. Once again, if I understand the SAC manual correctly, the poles and zeros required are the ones associated with the laplace transform of the transfer function. We would like to use an IIR filter to remove the instrument response and hence would need to convert these `s-poles' and `s-zeros' to `z-poles' and 'z-zeros', respectively. If I am correct, this involves a conversion z=e^(s dt), where s is a pole or zero (as given above in the POLEZERO file). Is this correct?

          In short the poles and zeros files only (generally) contains the response of the sensor (seismometer in your station),
          so, the FIR and IIR filter living in the digitizer, that it suppose have flat response, so add only your gain to the total
          response of seismograph (sensor + digitizer).
          I recommend read the book Poles and Zeros of Frank Sherbaum.


          The other question is also still not clear to me. If I understand Milton's answer correctly, the taper applied by sac's transfer command is between zero and unit amplitude. I would expect this to be a cosine (or something similar) taper…
          It is not a Hanning (cos) taper, Freqlimits are two filters a low pass and high pass.
          See the help on transfer command.

          HTH,

          Milton

          Regards,
          Kees

          __________________________________________________________________

          Dr. Cornelis Weemstra
          (http://www.kweemstra.com http://www.kweemstra.com/)

          Department of Geoscience and Engineering
          Delft University of Technology
          Stevinweg 1
          2628 CN Delft
          The Netherlands

          e-mail: kweemstra<at>gmail.com <kweemstra<at>gmail.com>
          tel:
          cell: 0031 645012455
          __________________________________________________________________

          On Tue, Apr 21, 2015 at 3:43 PM, George Helffrich <George.Helffrich<at>bristol.ac.uk <George.Helffrich<at>bristol.ac.uk>> wrote:
          Dear All -

          Also note that SAC/BRIS reads mseed data (and CSS, GSE, Guralp, …) directly as well as SAC files. So a perfectly viable approach is to avoid re-implementing all the filtering and instrument correction functionality of SAC in your program and considering how you could do your downstream processing in SAC. The SAC book has suggestions and case studies on doing just that — one of the reasons I and my co-authors wrote it.

          On 21 Apr 2015, at 20:40, Milton Plasencia <mplasencia<at>inogs.it <mplasencia<at>inogs.it>> wrote:

          Dear Kees,

          Also exists libraries for reading a write mseed format from IRIS.

          i suggest you to use SAC to remove the instrument response and your command
          and PZ_TRILLIUM120 file look OK (your channels are 20 sps).

          Regarding the corner frequencies, the response is flat between 0.02 to 5,
          decay from 5 up to 10 and after 10 is zero, the same between 0.01 and 0.02,
          after 0.01 is zero.

          0.02 5
          - \—————————————————\
          - -
          - -
          - -
          ———\ -\————— Freq.
          0.01 10

          HTH,

          Milton

          On Apr 21, 2015, at 12:51, Kees Weemstra <kweemstra<at>gmail.com <kweemstra<at>gmail.com>> wrote:

          Dear Mr/Mrs,

          I have a question regarding the removal of the instrument response.
          I possess a data set stored in the mseed format. Fortunately, a colleague of mine wrote a fortran library to read and/or filter mseed files (in CC). I am used to using SAC for my processing, but since I simply don't have the data in the SAC format, I deemed it wise to use this mseed fortran library (I am an experienced user of fortran).

          What we would like to achieve is to remove the instrument response ourselves using the polezero files. Most stations were deployed using Trillium Compact (120 s) instruments. Below (italic) is the polezero file (PZ_TRILLIUM120) for such an instrument:

          * OUTPUT UNIT : COUNTS
          * INSTTYPE : Trillium compact 120s
          * AD-conversion : 1.6393*10^7 counts/V
          * SENSITIVITY : 749.1 V/(m/s)
          * A0 : 8.184*10^11
          * Constant : 1.0049949e+22 (AD-conversion*sensitivity*A0 )
          * CONSTANT 1.0049949*10^22
          ZEROS 3
          0.0 0.0
          0.0 0.0
          -434.1 0.0
          POLES 7
          -0.03691 0.03712
          -0.03691 -0.03712
          -371.2 0.0
          -373.9 475.5
          -373.9 -475.5
          -588.4 1508
          -588.4 -150
          CONSTANT 10049949000000000000000

          In case I would have the data in SAC-format, I would use "TRANS FROM POLEZERO S PZ_TRILLIUM120 TO NONE FREQ 0.01 0.02 5.0 10.0" to remove the instrument response. However, I don't have the data in SAC-format, but simply as an array of numbers in my fortran code. And I don't want to write hundreds of gigabytes of data to the SAC format, while I later need perform additional processing and hence would need to read the same SAC files again.
          My question therefore is: how can I use the details in the Polezero file above to remove the instrument response?
          This essentially requires the answer to a number of questions. Which poles and zeros are required by SAC. If I understand the SAC manual correctly, the poles and zeros required are the ones associated with the laplace transform of the transfer function. We would like to use an IIR filter to remove the instrument response and hence would need to convert these `s-poles' and `s-zeros' to `z-poles' and 'z-zeros' . If I am correct, this involves a conversion z=e^(s dt), where s is a pole or zero (as given above in the POLEZERO file).
          Another question involves the corner frequencies, how does SAC `filter' the data between 0.02 and 5 Hz (in our case)? And which taper is applied between 0.01 and 0.02 Hz, and 5 and 10 Hz.

          Thanks in advance!

          Best Regards,
          Kees

          ________________________________________________________

          Dr. Cornelis Weemstra
          (http://www.kweemstra.com http://www.kweemstra.com/)

          Department of Geoscience and Engineering
          Delft University of Technology
          Stevinweg 1
          2628 CN Delft
          The Netherlands

          e-mail: kweemstra<at>gmail.com <kweemstra<at>gmail.com>
          tel:
          cell: 0031 645012455 <tel:0031%20645012455>
          __________________________________________________________________
          _______________________________________________
          sac-help mailing list
          sac-help<at>iris.washington.edu <sac-help<at>iris.washington.edu>
          http://www.iris.washington.edu/mailman/listinfo/sac-help

          _______________________________________________
          sac-help mailing list
          sac-help<at>iris.washington.edu <sac-help<at>iris.washington.edu>
          http://www.iris.washington.edu/mailman/listinfo/sac-help



          George Helffrich
          george.helffrich<at>bris.ac.uk <george.helffrich<at>bris.ac.uk>




        • Arthur Snoke
          2015-04-23 04:33:06
          Kees,

          SAC follows the conventions given in the SEED manual. A link to it is in the TRANSFER Help file in the SAC manual: http://ds.iris.edu/files/sac-manual/commands/transfer.html>. (I just found a typo …) Quoting from that file: “The filters applied between f1 and f2 and between f3 and f4 are quarter cycles of a cosine wave.” The SEED manual also includes the equations for the other stages of filtering done in the instrument corrections. All this should be in the RESP files

          EVALRESP is an alternative to SAC for producing files for instrument correction. The only additional program you might need is one that can handle a FAP file.

          Arthur


          On Apr 22, 2015, at 11:47 AM, Kees Weemstra <kweemstra<at>gmail.com> wrote:

          Dear all,

          First, I wasn't aware of the existence of SAC/BRIS altogether. Therefore thank you for that.
          Nevertheless, I quickly installed it on my system (ubuntu 14.04) ad I am only able to read one mseed file at a time. Moreover, I can't use the merge command to concatenate mseed files and subsequently do my processing. Being able to read the mseed files directly into my code, using the fortran mseed library I mentioned, would simply save me a lot of time. This library is able to read multiple files from a single directory, select specific channels, define start and end-time, etc.

          The only thing we still need to implement is the instrument response removal. Now, of course I can write all this data to .SAC files, remove the instrument response using SAC, and then read it again and continue with my processing. It is just quite cumbersome. I prefer to spend a bit of time and write a subroutine to remove the instrument response using the polezero details (poles, zeros and constant) in the polezero files required by sac.
          We just don't know exactly, as I mentioned in my first message, how to interpret the the details in the polezero files, i.e., which poles and zeros does SAC require. Once again, if I understand the SAC manual correctly, the poles and zeros required are the ones associated with the laplace transform of the transfer function. We would like to use an IIR filter to remove the instrument response and hence would need to convert these `s-poles' and `s-zeros' to `z-poles' and 'z-zeros', respectively. If I am correct, this involves a conversion z=e^(s dt), where s is a pole or zero (as given above in the POLEZERO file). Is this correct?

          The other question is also still not clear to me. If I understand Milton's answer correctly, the taper applied by sac's transfer command is between zero and unit amplitude. I would expect this to be a cosine (or something similar) taper...

          Regards,
          Kees

          __________________________________________________________________

          Dr. Cornelis Weemstra
          (http://www.kweemstra.com http://www.kweemstra.com/)

          Department of Geoscience and Engineering
          Delft University of Technology
          Stevinweg 1
          2628 CN Delft
          The Netherlands

          e-mail: kweemstra<at>gmail.com <kweemstra<at>gmail.com>
          tel:
          cell: 0031 645012455
          __________________________________________________________________

          On Tue, Apr 21, 2015 at 3:43 PM, George Helffrich <George.Helffrich<at>bristol.ac.uk <George.Helffrich<at>bristol.ac.uk>> wrote:
          Dear All -

          Also note that SAC/BRIS reads mseed data (and CSS, GSE, Guralp, …) directly as well as SAC files. So a perfectly viable approach is to avoid re-implementing all the filtering and instrument correction functionality of SAC in your program and considering how you could do your downstream processing in SAC. The SAC book has suggestions and case studies on doing just that — one of the reasons I and my co-authors wrote it.

          On 21 Apr 2015, at 20:40, Milton Plasencia <mplasencia<at>inogs.it <mplasencia<at>inogs.it>> wrote:

          Dear Kees,

          Also exists libraries for reading a write mseed format from IRIS.

          i suggest you to use SAC to remove the instrument response and your command
          and PZ_TRILLIUM120 file look OK (your channels are 20 sps).

          Regarding the corner frequencies, the response is flat between 0.02 to 5,
          decay from 5 up to 10 and after 10 is zero, the same between 0.01 and 0.02,
          after 0.01 is zero.

          0.02 5
          - \—————————————————\
          - -
          - -
          - -
          ———\ -\————— Freq.
          0.01 10

          HTH,

          Milton

          On Apr 21, 2015, at 12:51, Kees Weemstra <kweemstra<at>gmail.com <kweemstra<at>gmail.com>> wrote:

          Dear Mr/Mrs,

          I have a question regarding the removal of the instrument response.
          I possess a data set stored in the mseed format. Fortunately, a colleague of mine wrote a fortran library to read and/or filter mseed files (in CC). I am used to using SAC for my processing, but since I simply don't have the data in the SAC format, I deemed it wise to use this mseed fortran library (I am an experienced user of fortran).

          What we would like to achieve is to remove the instrument response ourselves using the polezero files. Most stations were deployed using Trillium Compact (120 s) instruments. Below (italic) is the polezero file (PZ_TRILLIUM120) for such an instrument:

          * OUTPUT UNIT : COUNTS
          * INSTTYPE : Trillium compact 120s
          * AD-conversion : 1.6393*10^7 counts/V
          * SENSITIVITY : 749.1 V/(m/s)
          * A0 : 8.184*10^11
          * Constant : 1.0049949e+22 (AD-conversion*sensitivity*A0 )
          * CONSTANT 1.0049949*10^22
          ZEROS 3
          0.0 0.0
          0.0 0.0
          -434.1 0.0
          POLES 7
          -0.03691 0.03712
          -0.03691 -0.03712
          -371.2 0.0
          -373.9 475.5
          -373.9 -475.5
          -588.4 1508
          -588.4 -150
          CONSTANT 10049949000000000000000

          In case I would have the data in SAC-format, I would use "TRANS FROM POLEZERO S PZ_TRILLIUM120 TO NONE FREQ 0.01 0.02 5.0 10.0" to remove the instrument response. However, I don't have the data in SAC-format, but simply as an array of numbers in my fortran code. And I don't want to write hundreds of gigabytes of data to the SAC format, while I later need perform additional processing and hence would need to read the same SAC files again.
          My question therefore is: how can I use the details in the Polezero file above to remove the instrument response?
          This essentially requires the answer to a number of questions. Which poles and zeros are required by SAC. If I understand the SAC manual correctly, the poles and zeros required are the ones associated with the laplace transform of the transfer function. We would like to use an IIR filter to remove the instrument response and hence would need to convert these `s-poles' and `s-zeros' to `z-poles' and 'z-zeros' . If I am correct, this involves a conversion z=e^(s dt), where s is a pole or zero (as given above in the POLEZERO file).
          Another question involves the corner frequencies, how does SAC `filter' the data between 0.02 and 5 Hz (in our case)? And which taper is applied between 0.01 and 0.02 Hz, and 5 and 10 Hz.

          Thanks in advance!

          Best Regards,
          Kees

          ________________________________________________________

          Dr. Cornelis Weemstra
          (http://www.kweemstra.com http://www.kweemstra.com/)

          Department of Geoscience and Engineering
          Delft University of Technology
          Stevinweg 1
          2628 CN Delft
          The Netherlands

          e-mail: kweemstra<at>gmail.com <kweemstra<at>gmail.com>
          tel:
          cell: 0031 645012455 <tel:0031%20645012455>
          __________________________________________________________________
          _______________________________________________
          sac-help mailing list
          sac-help<at>iris.washington.edu <sac-help<at>iris.washington.edu>
          http://www.iris.washington.edu/mailman/listinfo/sac-help

          _______________________________________________
          sac-help mailing list
          sac-help<at>iris.washington.edu <sac-help<at>iris.washington.edu>
          http://www.iris.washington.edu/mailman/listinfo/sac-help



          George Helffrich
          george.helffrich<at>bris.ac.uk <george.helffrich<at>bris.ac.uk>


          _______________________________________________
          sac-help mailing list
          sac-help<at>iris.washington.edu
          http://www.iris.washington.edu/mailman/listinfo/sac-help


        • George Helffrich
          2015-04-23 08:49:37
          Dear All -

          The READ command can read multiple files, no matter whether in MSEED or SAC format. (I just verified that functionality even with MSEED data.) READ MORE reads files into SAC’s memory without deleting previous ones.

          Merging MSEED data is easy: just use the Unix cat command to make a data stream as long as you want from individual files of blockettes. No need to use SAC for this.

          SAC’s filtering primitives can be called from Fortran routines through the XAPIIR library, which is distributed with the SAC that you built. See HELP XAPIIR.

          Re-implementing decades-old, debugged functionality always takes longer than you think it should. But your ubuntu install was from Fortran source code, so all the details you are asking for are in there, in a form more concise than English prose.

          SAC’s HELP TRANSFER also contains details on pole-zero file content. IRIS’ online SAC documentation has more theoretical detail.

          On 23 Apr 2015, at 00:47, Kees Weemstra <kweemstra<at>gmail.com> wrote:

          Dear all,

          First, I wasn't aware of the existence of SAC/BRIS altogether. Therefore thank you for that.
          Nevertheless, I quickly installed it on my system (ubuntu 14.04) ad I am only able to read one mseed file at a time. Moreover, I can't use the merge command to concatenate mseed files and subsequently do my processing. Being able to read the mseed files directly into my code, using the fortran mseed library I mentioned, would simply save me a lot of time. This library is able to read multiple files from a single directory, select specific channels, define start and end-time, etc.

          The only thing we still need to implement is the instrument response removal. Now, of course I can write all this data to .SAC files, remove the instrument response using SAC, and then read it again and continue with my processing. It is just quite cumbersome. I prefer to spend a bit of time and write a subroutine to remove the instrument response using the polezero details (poles, zeros and constant) in the polezero files required by sac.
          We just don't know exactly, as I mentioned in my first message, how to interpret the the details in the polezero files, i.e., which poles and zeros does SAC require. Once again, if I understand the SAC manual correctly, the poles and zeros required are the ones associated with the laplace transform of the transfer function. We would like to use an IIR filter to remove the instrument response and hence would need to convert these `s-poles' and `s-zeros' to `z-poles' and 'z-zeros', respectively. If I am correct, this involves a conversion z=e^(s dt), where s is a pole or zero (as given above in the POLEZERO file). Is this correct?

          The other question is also still not clear to me. If I understand Milton's answer correctly, the taper applied by sac's transfer command is between zero and unit amplitude. I would expect this to be a cosine (or something similar) taper...

          Regards,
          Kees

          __________________________________________________________________

          Dr. Cornelis Weemstra
          (http://www.kweemstra.com)

          Department of Geoscience and Engineering
          Delft University of Technology
          Stevinweg 1
          2628 CN Delft
          The Netherlands

          e-mail: kweemstra<at>gmail.com
          tel:
          cell: 0031 645012455
          __________________________________________________________________

          On Tue, Apr 21, 2015 at 3:43 PM, George Helffrich <George.Helffrich<at>bristol.ac.uk> wrote:
          Dear All -

          Also note that SAC/BRIS reads mseed data (and CSS, GSE, Guralp, …) directly as well as SAC files. So a perfectly viable approach is to avoid re-implementing all the filtering and instrument correction functionality of SAC in your program and considering how you could do your downstream processing in SAC. The SAC book has suggestions and case studies on doing just that — one of the reasons I and my co-authors wrote it.

          On 21 Apr 2015, at 20:40, Milton Plasencia <mplasencia<at>inogs.it> wrote:

          Dear Kees,

          Also exists libraries for reading a write mseed format from IRIS.

          i suggest you to use SAC to remove the instrument response and your command
          and PZ_TRILLIUM120 file look OK (your channels are 20 sps).

          Regarding the corner frequencies, the response is flat between 0.02 to 5,
          decay from 5 up to 10 and after 10 is zero, the same between 0.01 and 0.02,
          after 0.01 is zero.

          0.02 5
          - \—————————————————\
          - -
          - -
          - -
          ———\ -\————— Freq.
          0.01 10

          HTH,

          Milton

          On Apr 21, 2015, at 12:51, Kees Weemstra <kweemstra<at>gmail.com> wrote:

          Dear Mr/Mrs,

          I have a question regarding the removal of the instrument response.
          I possess a data set stored in the mseed format. Fortunately, a colleague of mine wrote a fortran library to read and/or filter mseed files (in CC). I am used to using SAC for my processing, but since I simply don't have the data in the SAC format, I deemed it wise to use this mseed fortran library (I am an experienced user of fortran).

          What we would like to achieve is to remove the instrument response ourselves using the polezero files. Most stations were deployed using Trillium Compact (120 s) instruments. Below (italic) is the polezero file (PZ_TRILLIUM120) for such an instrument:

          * OUTPUT UNIT : COUNTS
          * INSTTYPE : Trillium compact 120s
          * AD-conversion : 1.6393*10^7 counts/V
          * SENSITIVITY : 749.1 V/(m/s)
          * A0 : 8.184*10^11
          * Constant : 1.0049949e+22 (AD-conversion*sensitivity*A0 )
          * CONSTANT 1.0049949*10^22
          ZEROS 3
          0.0 0.0
          0.0 0.0
          -434.1 0.0
          POLES 7
          -0.03691 0.03712
          -0.03691 -0.03712
          -371.2 0.0
          -373.9 475.5
          -373.9 -475.5
          -588.4 1508
          -588.4 -150
          CONSTANT 10049949000000000000000

          In case I would have the data in SAC-format, I would use "TRANS FROM POLEZERO S PZ_TRILLIUM120 TO NONE FREQ 0.01 0.02 5.0 10.0" to remove the instrument response. However, I don't have the data in SAC-format, but simply as an array of numbers in my fortran code. And I don't want to write hundreds of gigabytes of data to the SAC format, while I later need perform additional processing and hence would need to read the same SAC files again.
          My question therefore is: how can I use the details in the Polezero file above to remove the instrument response?
          This essentially requires the answer to a number of questions. Which poles and zeros are required by SAC. If I understand the SAC manual correctly, the poles and zeros required are the ones associated with the laplace transform of the transfer function. We would like to use an IIR filter to remove the instrument response and hence would need to convert these `s-poles' and `s-zeros' to `z-poles' and 'z-zeros' . If I am correct, this involves a conversion z=e^(s dt), where s is a pole or zero (as given above in the POLEZERO file).
          Another question involves the corner frequencies, how does SAC `filter' the data between 0.02 and 5 Hz (in our case)? And which taper is applied between 0.01 and 0.02 Hz, and 5 and 10 Hz.

          Thanks in advance!

          Best Regards,
          Kees

          ________________________________________________________

          Dr. Cornelis Weemstra
          (http://www.kweemstra.com)

          Department of Geoscience and Engineering
          Delft University of Technology
          Stevinweg 1
          2628 CN Delft
          The Netherlands

          e-mail: kweemstra<at>gmail.com
          tel:
          cell: 0031 645012455
          __________________________________________________________________
          _______________________________________________
          sac-help mailing list
          sac-help<at>iris.washington.edu
          http://www.iris.washington.edu/mailman/listinfo/sac-help

          _______________________________________________
          sac-help mailing list
          sac-help<at>iris.washington.edu
          http://www.iris.washington.edu/mailman/listinfo/sac-help



          George Helffrich
          george.helffrich<at>bris.ac.uk





          George Helffrich
          george.helffrich<at>bris.ac.uk


15:35:55 v.01697673