Thread: SAC_macro

Started: 2009-03-13 00:25:40
Last activity: 2009-03-13 00:25:40
Topics: SAC Help
mary
2009-03-13 00:25:40
Dear Sir
I have three questions about macros in the SAC:
(1)In the example, particle motion plots are produced for five different two second time windows on the same data file: READ ABC
SETBB TIME1 0
DO TIME2 FROM 2 TO 10 BY 2
XLIM %TIME1 $TIME2
TITLE 'Particle Motion from %TIME1 to $TIME2$'
PLOTPM
SETBB TIME1 $TIME2
ENDDO
(Why is a dollar sign needed after TIME2 in the TITLE command?)

(2)In the example, we need to calculate the tangent of an angle that has already been stored in the blackboard in degrees:
u: GETBB ANGLE
s: ANGLE = 45.0
u: SETBB VALUE (TAN (DIVIDE (MULTIPLY (PI) %ANGLE%) 180.))
s: ==> SETBB VALUE 1.00000
We can rework the above example into a more natural form by intermixing regular (prefix) and embedded arithmetic functions:

u: SETBB VALUE (TAN ((PI) * %ANGLE / 180. ))
s: ==> SETBB VALUE 1.00000


(Why is the percent sign needed after ANGLE in the first example and is not needed in the second example?)

(3)The next example uses the SUBSTRING function to extract the month of the event and store it into a blackboard variable.

{u:} FUNCGEN SEISMOGRAM
{u:} SETBB MONTH (SUBSTRING 1 3 '&1,KZDATE&')
{s:} ==> SETBB MONTH MAR
(Why are the quotes needed around the header variable KZDATE?)

I am eager to hear from you! Thanks!



Sincerely Yours
Ma Li



00:52:20 v.01697673