Thread: Problem with MERGE function

Started: 2018-08-15 20:25:02
Last activity: 2018-08-17 01:42:43
Topics: SAC Help
NANNI Ugo
2018-08-15 20:25:02
Hi,

I am using SAC on debian and I have encountered a problem using the MERGE
function. The problem I have is the same as the one discussed 2015 :
https://seiscode.iris.washington.edu/issues/683

My problem is that the MERGE option GAP interp does not works correctly.
I have attached you three files, m1.SAC, m2.SAC and m1m2.SAC the result
from MERGE gap interp overlap average. I cannot use gap zero because the
signals are not centered in zero and have a different mean. One solution
could be to be able to calculate the mean of the whole signal but rmean
remove the mean of each signal.

The user of the former problem suggested:

" I have fix the problem, in the program xmerge.c at line 341, I make this
change
// y[i] = yb + i *(ye-yb)/(e-b); //old
y[i] = yb + (i-b) *(ye-yb)/(e-b); //new "

I am trying to do the same but cannot find/modify the program xmerge.c. I
have looked in /usr/local/sac/bin then into the sac file but I did not
figure out how to modify the xmerge.c.

Could you help me on that ?

Thank you,

--------------------
Ugo Nanni
1st year PhD at IGE
GLACE and CYME Research team
(+33) 06 43 29 31 41
Attachments
  • Milton Plasencia
    2018-08-16 03:23:33
    Hi,

    I f I understand correctly, I do:

    Macton:Downloads milton$ sac

    SAC> r ./m1.SAC

    SAC> qdp off

    SAC> p

    SAC> rmean

    SAC> r more ./m2.SAC

    SAC> p1

    SAC> rmean

    SAC> p1

    SAC> merge verbose gap zero

    merging 2 files => 500001 data points

    merge: Gap zero fill: [n: 300001 t: 300.001007]

    merge: Gap zero fill: [n: 300002 t: 300.002014]

    merge: Gap zero fill: [n: 300003 t: 300.003021]

    merge: Gap zero fill: [n: 300004 t: 300.004028]

    merge: Gap zero fill: [n: 300005 t: 300.005005]

    merge: Gap zero fill: [n: 300006 t: 300.006012]

    merge: Gap zero fill: [n: 300007 t: 300.007019]

    merge: Gap zero fill: [n: 300008 t: 300.008026]

    merge: Gap zero fill: [n: 300009 t: 300.009003]

    merge: Gap zero fill: [n: 300010 t: 300.010010]

    merge: Gap zero fill: [n: 300011 t: 300.011017]

    merge: Gap zero fill: [n: 300012 t: 300.012024]

    merge: Gap zero fill: [n: 300013 t: 300.013000]

    merge: Gap zero fill: [n: 300014 t: 300.014008]

    merge: Gap zero fill

    .

    .

    .


    and obtain the attached figure..

    I running sac on OSX High Sierra 10.13.6 and SACv.101.6a.


    HTH,


    Milton





    ----------------------------
    Milton Plasencia
    mplasencia<at>inogs.it



    On Wed, Aug 15, 2018 at 6:56 PM NANNI Ugo <ugo.nanni<at>univ-grenoble-alpes.fr>
    wrote:

    Hi,

    I am using SAC on debian and I have encountered a problem using the MERGE
    function. The problem I have is the same as the one discussed 2015 :
    https://seiscode.iris.washington.edu/issues/683

    My problem is that the MERGE option GAP interp does not works correctly.
    I have attached you three files, m1.SAC, m2.SAC and m1m2.SAC the result
    from MERGE gap interp overlap average. I cannot use gap zero because the
    signals are not centered in zero and have a different mean. One solution
    could be to be able to calculate the mean of the whole signal but rmean
    remove the mean of each signal.

    The user of the former problem suggested:

    " I have fix the problem, in the program xmerge.c at line 341, I make this
    change
    // y[i] = yb + i *(ye-yb)/(e-b); //old
    y[i] = yb + (i-b) *(ye-yb)/(e-b); //new "

    I am trying to do the same but cannot find/modify the program xmerge.c. I
    have looked in /usr/local/sac/bin then into the sac file but I did not
    figure out how to modify the xmerge.c.

    Could you help me on that ?

    Thank you,

    --------------------
    Ugo Nanni
    1st year PhD at IGE
    GLACE and CYME Research team
    (+33) 06 43 29 31 41
    ----------------------
    SAC Help
    Topic home: http://ds.iris.edu/message-center/topic/sac-help/ |
    Unsubscribe: sac-help-unsubscribe<at>lists.ds.iris.edu

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


    Attachments
    • NANNI Ugo
      2018-08-16 16:00:36
      Hi,
      Thank you for your prompt response. However this is not what I am looking for.

      In your case you do:
      m1 - mean(m1)
      m2 - mean(m2)
      and then you merge the signals and fill the gap by zero. This is similar as doing:
      r ./m1.SAC ./m2.SAC
      rmean
      merge gap zero

      but what I would like to do is to merge m1 and m2 and then retrieve the mean of (m1+m2), so I keep the difference of baseline between m1 and m2. To do so I have two choices:
      1) read m1.SAc m2.SAC
      and find a way to remove the global mean and then > merge gap zero
      2) read m1.SAC m2.SAC
      merge gap interp
      rmean

      but gap interp is not working currently unless I modify the xmerge.c

      Do yo think one of these options is feasible ?

      thank you,
      Ugo
      • Milton Plasencia
        2018-08-17 01:42:43
        Here my commands, in all case all works..
        Your option 1 is feasible, I try it, and not change if you do read all
        files or one by one,
        as I do in first e-mail and you cited in option 1.

        SAC> r ./m1.SAC ./m2.SAC

        SAC> qdp off

        SAC> p2

        SAC> p1

        SAC> p2

        SAC> merge gap interp

        merge: Gap interp fill

        SAC> p

        SAC> rmean

        SAC> p

        SAC> r ./m1.SAC

        SAC> r more ./m2.SAC

        SAC> p2

        SAC> rmean

        SAC> p2

        SAC> merge gap interp

        merge: Gap interp fill

        SAC> p2

        SAC> r ./m1.SAC

        SAC> r more ./m2.SAC

        SAC> p2

        SAC> rmean

        SAC> p2

        SAC> merge gap zero

        merge: Gap zero fill

        SAC> p2

        SAC>

        SAC> r ./m1.SAC ./m2.SAC

        SAC> p2

        SAC> rmean

        SAC> p2

        SAC> merge gap zero

        merge: Gap zero fill

        SAC> p2

        Cheers,

        M.


        ************************************
        Milton P. PLASENCIA LINARES

        Centro di Ricerche Sismologiche (CRS)
        OGS - Istituto Nazionale di Oceanografia e di Geofisica Sperimentale

        Borgo Grotta Gigante 42/C
        (34010) Sgonico - Trieste - Italia
        Tel: +39 040 2140 156 (Udine)
        Tel: +39 040 2140 256 (Trieste)
        Cel.: +39 331 6481 935

        E-mail: mplasencia<at>inogs.it

        GPG Key: 22FCFFA8

        ASAIN (Antarctic Seismographic Argentinean Italian Network)
        **************************************


        On Thu, 16 Aug 2018 at 18:01, NANNI Ugo <ugo.nanni<at>univ-grenoble-alpes.fr>
        wrote:

        Hi,
        Thank you for your prompt response. However this is not what I am looking
        for.

        In your case you do:
        m1 - mean(m1)
        m2 - mean(m2)
        and then you merge the signals and fill the gap by zero. This is similar
        as doing:
        r ./m1.SAC ./m2.SAC
        rmean
        merge gap zero

        but what I would like to do is to merge m1 and m2 and then retrieve the
        mean of (m1+m2), so I keep the difference of baseline between m1 and m2. To
        do so I have two choices:
        1) read m1.SAc m2.SAC
        and find a way to remove the global mean and then > merge gap zero
        2) read m1.SAC m2.SAC
        merge gap interp
        rmean

        but gap interp is not working currently unless I modify the xmerge.c

        Do yo think one of these options is feasible ?

        thank you,
        Ugo

        ----------------------
        SAC Help
        Topic home: http://ds.iris.edu/message-center/topic/sac-help/ |
        Unsubscribe: sac-help-unsubscribe<at>lists.ds.iris.edu

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


06:35:28 v.22510d55