SUAZIMUTH - compute trace AZIMUTH given the sx,sy,gx,gy header fields and set a user-specified header field to this value 

  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             0-179.9999 deg convention, reciprocity assumed 
                  =1 0-359.999 deg convention, 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 
 Notes:                                              
 The value of header word "key" is computed from the values of   
 sx,sy,gx,gy. The output field "otrav" 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, no 
 reciprocity is assumed, 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.  

 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
 
  Algorithm:
    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.