Usage:

           gcdist [options]{ x,y | site }

 Reads from stdin two columns (u,v) and computes great circle distance
 between (x,y), the "from"-site, and (u,v), the "to"-site.
 Longitudes x,u, latitudes y,v, and result are given in degrees or radians.

 Instead of piping in a file, one "to"-site can be specified with the -t option.

 Instead of (x,y) you can enter 4-letter site names on the command line;
 the system will look up the environment to resolve  $REFF.stacov
 (if the  REFF string already ends on .stacov .scv or .sv, ".stacov" will not be added).

 As a new feature, also sta_pos files can be specified. The system will
  recognize them by the substring "sta_pos" occurring in the  name.
 

 Options:

 -r str  - use this file as the station catalog. The file string may contain
           wildcard characters, in which case the first 10 files will be scanned.
           The -r option may be re-issued after the -t option for the case that
           the "from"- and "to"-stations are listed in separate files.
           Stacov and sta_pos can be mixed.

 -i file - use this file for input instead of reading from stdin.
 -t u,v  - the other site's (the "to"-site's) longitude,latitude is u,v; don't read stdin or file
 -t site - the other site's name, 4-char. The locations are looked up in the site catalog.
 -b str  - locate first occurrence of str in record to read u,v from the columns beyond
 -B str  - locate last ...
 -b    - read input record starting at column number n.
 -c      - print result and a copy of the input string to stdout.
 -C text - like -c, also print text (text without blanks though!)
 -km     - output value in km (else: degrees)
 -R -D   - input values are in radians (default)or degrees
           (can be interweaved)
 -a[r]   - output azimuths at "to"-point followed by
           "from"-point. Radians if -ar, else degrees from North via East.

Column means character position in a record, not field number.

Examples:
In the following examples, the environment has been prepared by
setenv REFF /Bifrost/gps/RESULTS/HEFLIN/ref

(1)
   gcdist -km -r /goa/sta_info/sta_pos -t CAGL CASC
   1587.874
uses as the station catalog /goa/sta_info/sta_pos for both stations

(2)
   gcdist -km -t SVEG -r /goa/sta_info/sta_pos CASC
   3064.885
uses the station catalog derived from the $REFF enviroment variable
in the case of SVEG and /goa/sta_info/sta_pos in the case of CASC.

(3)
   cat ~/gps/maps/swepos-labels.dat | gcdist -km -c ONSA
   1041.973     18.1249   66.3180 12 0.0 0 1 ARJE
    181.335     13.7181   56.0922 12 0.0 0 1 HASS
   1043.902       .3363   50.8673 12 0.0 0 1 HERS
    132.959     14.0596   57.7455 12 0.0 0 1 JONK
    245.459     13.5056   59.4440 12 0.0 0 1 KARL
   1251.427     21.0602   67.8776 12 0.0 0 1 KIRU
    698.998      5.8096   52.1784 12 0.0 0 1 KOSG
    406.148     14.8770   60.7221 12 0.0 0 1 LEKS
   2211.776     -4.2497   40.4292 12 0.0 0 1 MADR
    468.243     17.2585   60.5951 12 0.0 0 1 MART
   1891.649     16.7045   40.6491 12 0.0 0 1 MATE
where ~/gps/maps/swepos-labels.dat contains
   18.1249   66.3180 12 0.0 0 1 ARJE
   13.7181   56.0922 12 0.0 0 1 HASS
     .3363   50.8673 12 0.0 0 1 HERS
   14.0596   57.7455 12 0.0 0 1 JONK
   13.5056   59.4440 12 0.0 0 1 KARL
   21.0602   67.8776 12 0.0 0 1 KIRU
    5.8096   52.1784 12 0.0 0 1 KOSG
   14.8770   60.7221 12 0.0 0 1 LEKS
   -4.2497   40.4292 12 0.0 0 1 MADR
   17.2585   60.5951 12 0.0 0 1 MART
   16.7045   40.6491 12 0.0 0 1 MATE
etc.
will add the distance at the left on each line.
 

(4) with a station given by longitude and latitude

   cat csdeu-lalodi.dat | gcdist -km -c -20,65
    225.063    -16.29    66.33     -0.284
   2873.574     13.17    46.33     -0.129
   4060.057     20.13    36.99     -0.168
   2872.973     12.50    46.05     -1.196

where csdeu-lalodi.dat contains
  -16.29    66.33     -0.284
   13.17    46.33     -0.129
   20.13    36.99     -0.168
   12.50    46.05     -1.196
 

(5)
    gcdist -km -t 18.1249,66.3180 15.0332,59.2124
    804.685
(is for ARJE OREB) uses explicit coordinates. No station files are needed
 
(6) Azimuth from Borås to Onsala:

    gcdist -a -km -t 11.94,57.39  12.59,57.72
    46.854   -133.694     53.340
      Output: azimuth of great circle at Onsala followed by the azimuth at Borås, and the distance.

.bye