Thread: SAC

Started: 2018-05-02 19:33:13
Last activity: 2018-05-03 07:55:03
Topics: SAC Help
Mary Muthoni
SAC
2018-05-02 19:33:13
Dear Sir/Madam,

How do I subdivide a continuous monthly data into days using SAC?

Thanks.

Mary

  • George Helffrich
    2018-05-03 07:55:03
    Dear All -

    Assuming your month-long data starts at midnight on the start of the month, a straightforward way — but one that re-reads the monthly data file a lot — is to use a macro like this:

    * SAC macro to cut monthly data file into days
    * Usage: dodaily mdat <monthly> days <days>
    $keys mdat days
    do d = 1 , $days$
    cut b (86400 * ($d$ - 1)) 86400
    read $mdat$
    cut off
    write day$d$
    enddo

    Copy/paste the data into a file, say “dodaily” and then invoke the macro in SAC supplying the monthly data file name (as mdat) and the number of days in the month (as days):

    macro dodaily mdat monthly days 28

    and it will leave a string of files named day1, day2, day3, … day28 in the directory where the macro is invoked. 28 days for Feb., 30 or 31 for the rest of the months.

    A more complex solution would read the monthly data file once and use CUTIM to make multiple cuts. It is not as clear as the previous solution ... and may cause some versions of SAC to choke on long command lines or odd statement syntax:

    * SAC macro to cut monthly data file into days, reading monthly file once only
    * Usage: dodaily mdat <monthly> days <days>
    $keys mdat days
    setbb cuts "" files ""
    do d = 1 , $days$
    setbb cuts append " (86400 * ($d$ - 1)) 86400"
    setbb files append " day$d$"
    enddo
    read $mdat$
    cutim %cuts%
    write %files%

    Use it the same way as before.

    Warning: neither suggestion tested on a real, month-long data file, so don’t expect perfection and check the results. This should provide ideas for your own processing scheme, however.

    On 2 May 2018, at 23:45, Mary Muthoni <marymuthoni09<at>gmail.com> wrote:

    Dear Sir/Madam,

    How do I subdivide a continuous monthly data into days using SAC?

    Thanks.

    Mary

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

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



    George Helffrich
    george<at>elsi.jp


05:33:45 v.b4412d20