Thread: Re: sac-help Digest, Vol 16, Issue 2

Started: 2006-11-12 03:15:48
Last activity: 2006-11-13 23:00:50
Topics: SAC Help
Geo .
2006-11-12 03:15:48
Hi,
I am having trouble with running a small macro that I am trying to write. I
have a bunch of sac files (Z, E, N) in a directory and I want to read event
specific files (i.e. Z,N,E of a given event) together, do a calculation and
give the out put. One I tried to use to read the files is

r $1$..BHZ.R.SAC $2$..BHN.R.SAC $3$..BHE.R.SAC

This wouldn't read the files and right now I am running out of options,
Would anyone have a good solution for this? Further is there a way to
preserve the original sac file name after doing a rotation? I need to add
.r and .t to the original file name at the same time? Any suggestion is
greatly appreciated !


Januka.


On 10/10/06, sac-help-request<at>iris.washington.edu <
sac-help-request<at>iris.washington.edu> wrote:

Send sac-help mailing list submissions to
sac-help<at>iris.washington.edu

To subscribe or unsubscribe via the World Wide Web, visit
http://www.iris.washington.edu/mailman/listinfo/sac-help
or, via email, send a message with subject or body 'help' to
sac-help-request<at>iris.washington.edu

You can reach the person managing the list at
sac-help-owner<at>iris.washington.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of sac-help digest..."


Today's Topics:

1. Re: get the header in ascii (andreas wessel)
2. Re: get header data (Peter Goldstein)
3. Re: get header data (Frederik Tilmann)
4. Passing commands to SAC using sac<<eof (andreas wessel)


----------------------------------------------------------------------

Message: 1
Date: Tue, 10 Oct 2006 13:17:59 +1300
From: "andreas wessel" <awbochum<at>gmail.com>
Subject: Re: [SAC-HELP] get the header in ascii
To: sac-help<at>iris.washington.edu
Message-ID:
<2afddd310610091717i60eeb6e8r555d3574b922a3c<at>mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello,

There is a way to write ascii, but it's far from perfect, as it is kind of
tricky to see which values belong to which variables.
If you have the file in SAC memory, you can write it as ascii with

SAC> WRITE ALPHA filename
and then look at the values in your terminal, the header is at the
beginning
(it shows only the values, but not the names)

$ head filename

Please let me know if you find a better way to do this.


Andreas



On 10/9/06, Heloise.Cadet<at>ujf-grenoble.fr <Heloise.Cadet<at>ujf-grenoble.fr>
wrote:


Good mornning

I'd like to know how to get the header of sac files into an ascii file?

thank you

Regards

Héloïse
_______________________________________________
sac-help mailing list
sac-help<at>iris.washington.edu
http://www.iris.washington.edu/mailman/listinfo/sac-help

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.iris.washington.edu/pipermail/sac-help/attachments/20061009/9d65a158/attachment-0001.html

------------------------------

Message: 2
Date: Mon, 9 Oct 2006 18:02:14 -0700
From: Peter Goldstein <peterg<at>llnl.gov>
Subject: Re: [SAC-HELP] get header data
To: <Heloise.Cadet<at>ujf-grenoble.fr>
Cc: sac-help<at>iris.washington.edu
Message-ID: <p06110409c1509d5fdfa8@[192.168.1.5]>
Content-Type: text/plain; charset="iso-8859-1" ; format="flowed"


As Art suggests, saclst will hopefully provide
the header list capabilities you need.
In the short term you can hopefully get by using listheader within a
script and
redirect the output to the file you want.

Something like the following script could be invoked as
sac_lh.csh "your_filename"
Note that the blank lines are needed to get all the headers and you'll
still have to edit the results if you want a particular format or to get
rid of
extraneous information and blank lines.


#!/bin/csh -xvf
# sac_lh.csh: script to list sac header listing to standard out
sac<<eof
r $argv[1]
lh inclusive on




q
eof
# end of sac_lh.csh

Good morning,

I'd like to get some information in the header but the subroutines getfhv
doesn't seem to work for depmin, depmax and dist

in a fortran code:

call GETFHV ('DEPMIN', depmin, nerr)

I got this error message:
ERROR: Undefined header field value. DEPMIN

but it works for:

call GETNHV ('NZYEAR', nyear, nerr)

is there a bug? or an other way to extract data from the header?

Best regards

HÈloÔse
CETE Nice, LGIT Grenoble



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


--

Peter Goldstein, Ph.D. (925) 423-1231 (office)
L-103, PO Box 808 (925) 422-5844 (fax)
Livermore, CA 94551 peterg<at>llnl.gov (email)
web page: http://www.llnl.gov/sac



------------------------------

Message: 3
Date: Tue, 10 Oct 2006 09:29:53 +0100
From: Frederik Tilmann <tilmann<at>esc.cam.ac.uk>
Subject: Re: [SAC-HELP] get header data
To: Heloise.Cadet<at>ujf-grenoble.fr
Cc: sac-help<at>iris.washington.edu
Message-ID: <452B5A01.80609<at>esc.cam.ac.uk>
Content-Type: text/plain; charset=us-ascii; format=flowed

Heloise

these values all need to be calculated by sac so when the sac file is
generated externally, e.g. by rdseed they are generally left undefined.

Try reading into sac and writing again, i.e.

sac<<eof
r file
w over
q
eof

Of course, for dist evla,evlo,stla,stlo all need to be set and lcalda
must be true.

Frederik


Heloise.Cadet<at>ujf-grenoble.fr wrote:
Good morning,

I'd like to get some information in the header but the subroutines
getfhv
doesn't seem to work for depmin, depmax and dist

in a fortran code:

call GETFHV ('DEPMIN', depmin, nerr)

I got this error message:
ERROR: Undefined header field value. DEPMIN

but it works for:

call GETNHV ('NZYEAR', nyear, nerr)

is there a bug? or an other way to extract data from the header?

Best regards

H?lo?se
CETE Nice, LGIT Grenoble



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


--
Frederik Tilmann
Bullard Laboratories Tel. +44 1223 765545
Department of Earth Sciences Fax. +44 1223 360779
University of Cambridge email: tilmann<at>esc.cam.ac.uk
Madingley Road
Cambridge CB3 0EZ
UK






------------------------------

Message: 4
Date: Tue, 10 Oct 2006 23:30:39 +1300
From: "andreas wessel" <awbochum<at>gmail.com>
Subject: [SAC-HELP] Passing commands to SAC using sac<<eof
To: sac-help<at>iris.washington.edu
Message-ID:
<2afddd310610100330t118cd90cg717e7c22a91d94b<at>mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Good evening,

I'm trying to pass some commands to SAC with <<
But all I get is the SAC startup lines:

SEISMIC ANALYSIS CODE [06/06/2005 (Version 100.1)]
Copyright 1995 Regents of the University of California

.. and a blinking cursor a few lines below. All I can do then is kill the
script with Ctrl+C.
I am running a minimal example. I get the "echo start", it's only the SAC
part that causes trouble.

#!/bin/sh
echo start
sac<<eof
r test.e
p
q
eof
exit 0

I also tried csh instead of sh, but that didn't help.
Are there any environmental things besides SACAUX I need to consider?

Thanks,
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.iris.washington.edu/pipermail/sac-help/attachments/20061010/3ef772f6/attachment-0001.html

------------------------------

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


End of sac-help Digest, Vol 16, Issue 2
***************************************




--
"Nothing can start to exist nor can cease to exist, only transformation is
possible"

Januka Attanayake
Center for Integrative Geosciences - Solid Earth Geophysics
University of Connecticut
Beach Hall U-2045
354,Mansfield Rd;
Storrs.CT 06269

Tel: 1 860 486 0475
http://www.geocities.com/jattanayake
http://earth.uconn.edu/

  • andreas wessel
    2006-11-13 23:00:50
    Hi Januka,

    I am using a similar syntax to read in files with a macro and it works fine.
    r $1$.e $2$.n $3$.z
    You have to be in the folder where the data files are located. Then run the
    macro and pass the arguments:
    SAC> m test.m lhut lhut lhut

    This would read lhut.e lhut.n lhut.z. Make sure you type the filename
    correct. If it's always the three files for a given event you want to read,
    then a
    r $1$.e $1$.n $1$.z
    would be enough. Then you just have to give the argument once and all three
    files will be read. (Assuming the extensions are always .e .n .z)

    It would be helpful to give the exact error message, because "it won't read
    the files" can mean a lot of things.

    Good luck,
    Andreas



    On 11/12/06, Januka Attanayake <jattanayake<at>gmail.com> wrote:

    Hi,
    I am having trouble with running a small macro that I am trying to write.
    I have a bunch of sac files (Z, E, N) in a directory and I want to
    read event specific files (i.e. Z,N,E of a given event) together, do a
    calculation and give the out put. One I tried to use to read the files is

    r $1$..BHZ.R.SAC $2$..BHN.R.SAC $3$..BHE.R.SAC

    This wouldn't read the files and right now I am running out of options,
    Would anyone have a good solution for this?


Page built 07:09:47 | v.b'ea7a92