source: SH_SHM/trunk/util/next_quarry.csh @ 92

Revision 16, 985 bytes checked in by marcus, 15 years ago (diff)

r1 | svn | 2007-12-13 11:10:29 +0100 (Do, 13 Dez 2007) | 2 lines

Initial import

  • Property svn:executable set to *
Line 
1#! /bin/csh
2#
3# file next_quarry.csh
4#      ===============
5#
6# version 1, 9-Apr-2003
7#
8# Shows distance to next quarry location
9# K. Stammler, 9-Apr-2003
10
11if  ("$2" == "")  then
12        echo "Usage: $0 <lat> <lon> [<quarryfile>]"
13        exit
14endif
15
16# get parameters
17set epilat=`echo $1 | sed 's/^-/s/'`
18set epilon=`echo $2 | sed 's/^-/w/'`
19set qfile=$3
20
21# set constants
22set tmpfile=$HOME/nexqu_$$.000
23
24if  ("$qfile" == "")  set qfile=$SH_INPUTS/german_quarries.dat
25
26if  (-e $tmpfile)  \rm $tmpfile
27touch $tmpfile
28set cnt=0
29while  (1 > 0)  # forever
30        @ cnt = $cnt + 1
31        set qline=`sed -n $cnt"p" $qfile`
32        if  ("$qline" == "")  break
33        if  ($#qline < 2)  continue
34        set qlat=`echo $qline[1] | sed 's/^-/s/'`
35        set qlon=`echo $qline[2] | sed 's/^-/w/'`
36        set res=`$SH_UTIL/locdiff $epilat $epilon $qlat $qlon`
37        if  ($#res < 2)  continue
38        set dist=$res[2]
39        echo "$dist $qlat $qlon" >>$tmpfile
40        echo "$dist $qlat $qlon"
41end
42
43echo ""
44echo "next five quarries:"
45
46sort -n -k 1 $tmpfile | head -5
47
48\rm $tmpfile
Note: See TracBrowser for help on using the repository browser.