SYNOPSIS

PERL PROGRAM NAME:

AUTHOR: Juan Lorenzo (Perl module only)

DATE:

DESCRIPTION:

Version:

USE

NOTES

Examples

SYNOPSIS

SEISMIC UNIX NOTES SUAZIMUTH - compute trace AZIMUTH, offset, and midpoint coordinates

            and set user-specified header fields to these values       



 suazimuth <stdin >stdout [optional parameters]                        



Required parameters:                                                   

    none                                                               



Optional parameters:                                                   

  key=otrav      header field to store computed azimuths in            

  scale=1.0      value(key) = scale * azimuth                          

  az=0           azimuth convention flag                               

                  0: 0-179.999 deg, reciprocity assumed                

                  1: 0-359.999 deg, points from receiver to source     

                 -1: 0-359.999 deg, points from source to receiver     

  sector=1.0     if set, defines output in sectors of size             

                 sector=degrees_per_sector, the default mode is        

                 the full range of angles specified by az              



  offset=0       if offset=1 then set offset header field              

  offkey=offset  header field to store computed offsets in             



  cmp=0          if cmp=1, then compute midpoint coordinates and       

                 set header fields for (cmpx, cmpy)                    

  mxkey=ep       header field to store computed cmpx in                

  mykey=cdp      header field to store computed cmpy in                



Notes:                                                                 

  All values are computed from the values in the coordinate fields     

  sx,sy (source) and gx,gy (receiver).                                 

  The output field "otrav" for the azimuth was chosen arbitrarily as 

  an example of a little-used header field, however, the user may      

  choose any field that is convenient for his or her application.      



  Setting the sector=number_of_degrees_per_sector sets key field to    

  sector number rather than an angle in degrees.                       



  For az=0, azimuths are measured from the North, however, reciprocity 

  is assumed, so azimuths go from 0 to 179.9999 degrees. If sector     

  option is set, then the range is from 0 to 180/sector.               



  For az=1, azimuths are measured from the North, with the assumption  

  that the direction vector points from the receiver to the source.    

  For az=-1, the direction vector points from the source to the        

  receiver. No reciprocity is assumed in these cases, so the angles go 

  from 0 to 359.999 degrees.                                           

  If the sector option is set, then the range is from 0 to 360/sector. 



Caveat:                                                                

  This program honors the value of scalco in scaling the values of     

  sx,sy,gx,gy. Type "sukeyword scalco" for more information.         



  Type "sukeyword -o" to see the keywords and descriptions of all    

  header fields.                                                       



  To plot midpoints, use: su3dchart                                    





Credits:

 based on suchw, su3dchart

     CWP: John Stockwell and  UTulsa: Chris Liner, Oct. 1998

     UTulsa: Chris Liner added offset option, Feb. 2002

        cll: fixed offset option and added cmp option, May 2003

     RISSC: Nils Maercklin added key options for offset and 

            midpoints, and added azimuth direction option, Sep. 2006



 Algorithms:

     offset = osign * sqrt( (gx-sx)*(gx-sx) + (gy-sy)*(gy-sy) )

              with osign = sgn( min((sx-gx),(sy-gy)) )



     midpoint x  value  xm = (sx + gx)/2

     midpoint y  value  ym = (sy + gy)/2



 Azimuth will be defined as the angle, measured in degrees,

 turned from North, of a vector pointing to the source from the midpoint, 

 or from the midpoint to the source. Azimuths go from 0-179.000 degrees

 or from 0-180.0 degrees.

  

 value(key) = scale*[90.0 - (180.0/PI)*(atan((sy - ym)/(sx - xm))) ]

     or

 value(key) = scale*[180.0 - (180.0/PI)*(atan2((ym - sy),(xm - sx)) ]



 Trace header fields accessed: sx, sy, gx, gy, scalco. 

 Trace header fields modified: (user-specified keys)

User's notes (Juan Lorenzo) untested

CHANGES and their DATES

Import packages

instantiation of packages

Encapsulated hash of private variables

sub Step

collects switches and assembles bash instructions by adding the program name

sub note

collects switches and assembles bash instructions by adding the program name

sub clear

sub az

sub cmp

sub key

sub mxkey

sub mykey

sub offkey

sub offset

sub osign

sub scale

sub sector

sub xm

sub ym

sub get_max_index

max index = number of input variables -1