Thread: Bug---- interpolate

Started: 2013-08-01 23:11:04
Last activity: 2013-08-02 21:13:56
Topics: SAC Help
  • Arthur Snoke
    2013-08-02 16:33:35
    I think there is something wrong with your file. I reproduced your result with v101.6, but when I included only the first 1000 values it worked okay. It looks like the only problem with interpolate is not finding and flagging the error. I will look more closely at your file, but I wanted to share this with you now.

    Thank you for including the file test.ans.

    Arthur

    sac
    SEISMIC ANALYSIS CODE [06/12/2013 (Version 101.6)]
    Copyright 1995 Regents of the University of California

    SAC> readtable content P test.ans
    SAC> lh


    FILE: test.ans - 1
    --------------

    NPTS = 2033 B = -8.520000e+01
    E = 3.232471e+02 IFTYPE = TIME SERIES FILE
    LEVEN = FALSE DEPMIN = -9.998000e-01
    DEPMAX = 5.324000e-01 DEPMEN = -4.770257e-03
    LOVROK = TRUE NVHDR = 6
    LPSPOL = FALSE LCALDA = TRUE
    SAC> interpolate delta 0.2
    SAC> lh


    FILE: test.ans - 1
    --------------

    NPTS = 2042 B = -8.520000e+01
    E = 3.230000e+02 IFTYPE = TIME SERIES FILE
    LEVEN = TRUE DELTA = 2.000000e-01
    DEPMIN = -1.621000e-01 DEPMAX = nan
    DEPMEN = nan LOVROK = TRUE
    NVHDR = 6 LPSPOL = FALSE
    LCALDA = TRUE
    SAC> quit

    The nan is probably what you got and is clearly wrong.

    head -1000 test.ans > test1000.ans
    SAC> readtable content P test1000.ans
    SAC> lh


    FILE: test1000.ans - 1
    ------------------

    NPTS = 1000 B = -8.520000e+01
    E = 1.151752e+02 IFTYPE = TIME SERIES FILE
    LEVEN = FALSE DEPMIN = -9.998000e-01
    DEPMAX = 5.324000e-01 DEPMEN = -6.679517e-03
    LOVROK = TRUE NVHDR = 6
    LPSPOL = FALSE LCALDA = TRUE
    SAC> interpolate delta 0.2
    SAC> lh


    FILE: test1000.ans - 1
    ------------------

    NPTS = 1002 B = -8.520000e+01
    E = 1.150000e+02 IFTYPE = TIME SERIES FILE
    LEVEN = TRUE DELTA = 2.000000e-01
    DEPMIN = -9.998001e-01 DEPMAX = 5.324001e-01
    DEPMEN = -7.755071e-03 LOVROK = TRUE
    NVHDR = 6 LPSPOL = FALSE
    LCALDA = TRUE
    SAC> quit

    On Aug 1, 2013, at 4:11 AM, wangxin wrote:

    Dear,

    When I was trying to use SAC to interpolate unevenly-spaced data to evenly-spaced data, I got a trouble.

    ("test.ans" is my unevenly-spaced data.)




    • Brian Savage
      2013-08-02 21:13:56
      Dear Wangxin,

      Your file has a duplicate time value

      % awk '{print $1}' test.ans | sort | uniq -d
      243.6050

      % grep 243.6050 test.ans
      243.6050 -0.1160
      243.6050 -0.1193

      The unevenly spaced interpolation routine should handle this properly, but does not. The routine relies on the computation of slope dy/dt and if the time value between your points is zero, the slope and all values derived from the slope become inf or nan. This includes the interpolated amplitude.

      We will work on a fix for this. An easy, but non optimal, fix for this is to average your duplicate points.

      Brian

      On Aug 2, 2013, at 9:33 AM, Arthur Snoke wrote:

      I think there is something wrong with your file. I reproduced your result with v101.6, but when I included only the first 1000 values it worked okay. It looks like the only problem with interpolate is not finding and flagging the error. I will look more closely at your file, but I wanted to share this with you now.

      Thank you for including the file test.ans.

      Arthur

      sac
      SEISMIC ANALYSIS CODE [06/12/2013 (Version 101.6)]
      Copyright 1995 Regents of the University of California

      SAC> readtable content P test.ans
      SAC> lh


      FILE: test.ans - 1
      --------------

      NPTS = 2033 B = -8.520000e+01
      E = 3.232471e+02 IFTYPE = TIME SERIES FILE
      LEVEN = FALSE DEPMIN = -9.998000e-01
      DEPMAX = 5.324000e-01 DEPMEN = -4.770257e-03
      LOVROK = TRUE NVHDR = 6
      LPSPOL = FALSE LCALDA = TRUE
      SAC> interpolate delta 0.2
      SAC> lh


      FILE: test.ans - 1
      --------------

      NPTS = 2042 B = -8.520000e+01
      E = 3.230000e+02 IFTYPE = TIME SERIES FILE
      LEVEN = TRUE DELTA = 2.000000e-01
      DEPMIN = -1.621000e-01 DEPMAX = nan
      DEPMEN = nan LOVROK = TRUE
      NVHDR = 6 LPSPOL = FALSE
      LCALDA = TRUE
      SAC> quit

      The nan is probably what you got and is clearly wrong.

      head -1000 test.ans > test1000.ans
      SAC> readtable content P test1000.ans
      SAC> lh


      FILE: test1000.ans - 1
      ------------------

      NPTS = 1000 B = -8.520000e+01
      E = 1.151752e+02 IFTYPE = TIME SERIES FILE
      LEVEN = FALSE DEPMIN = -9.998000e-01
      DEPMAX = 5.324000e-01 DEPMEN = -6.679517e-03
      LOVROK = TRUE NVHDR = 6
      LPSPOL = FALSE LCALDA = TRUE
      SAC> interpolate delta 0.2
      SAC> lh


      FILE: test1000.ans - 1
      ------------------

      NPTS = 1002 B = -8.520000e+01
      E = 1.150000e+02 IFTYPE = TIME SERIES FILE
      LEVEN = TRUE DELTA = 2.000000e-01
      DEPMIN = -9.998001e-01 DEPMAX = 5.324001e-01
      DEPMEN = -7.755071e-03 LOVROK = TRUE
      NVHDR = 6 LPSPOL = FALSE
      LCALDA = TRUE
      SAC> quit

      On Aug 1, 2013, at 4:11 AM, wangxin wrote:

      Dear,

      When I was trying to use SAC to interpolate unevenly-spaced data to evenly-spaced data, I got a trouble.

      ("test.ans" is my unevenly-spaced data.)



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



07:33:03 v.ad6b513c