source: SH_SHM/branches/2011.2/setup/insert_station_location.csh @ 376

Revision 16, 1.5 KB checked in by marcus, 14 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 insert_station_location.csh
4#      ===========================
5#
6# version 1, 15-Nov-2003
7#
8# Inserts/Modifies station location information ($SH_INPUTS/STATINF.DAT)
9# K. Stammler, 15-Nov-2003
10
11set xprog=$SH_ROOT/setup
12
13set infofile=$SH_INPUTS/STATINF.DAT
14
15echo ""
16echo -n "Station name: "
17set station="$<"
18set station=`echo $station | sed y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/`
19
20set res=`grep "^$station " $infofile`
21
22if  ("$res" == "")  then
23
24        set new_entry=1
25        set inp="y"
26
27else
28
29        set new_entry=0
30
31        echo "Current entry of $station :"
32        echo $res
33        echo -n "change ? [y/n/d]: "
34        set inp="$<"
35        if  ("$inp" != "y" && "$inp" != "d")  then
36                echo "No changes made."
37                exit
38        endif
39
40endif
41
42if  ("$inp" != "d")  then
43        echo -n "Latitude of ${station} (southern latitudes negative please): "
44        set lat="$<"
45        echo -n "Longitude of ${station} (western longitudes negative please): "
46        set lon="$<"
47        echo -n "Elevation in m: "
48        set elev="$<"
49
50        if  ("$elev" == "")  set elev="0.0"
51        if  ("$lat" == "" || "$lon" == "")  then
52                echo "Illegal input.  No changes made."
53                exit
54        endif
55endif
56
57if  ($new_entry == 1)  then
58
59        if  (-e $infofile.x)  \rm $infofile.x
60        mv $infofile $infofile.x
61
62else
63
64        if  (-e $infofile.x)  \rm $infofile.x
65        grep -v "^$station " $infofile >$infofile.x
66        \rm $infofile
67        if  ("$inp" == "d")  then
68                mv $infofile.x $infofile
69                echo "Station $station deleted from location file."
70                exit
71        endif
72
73endif
74
75echo "$station lat:$lat lon:$lon        elevation: $elev" >$infofile
76cat $infofile.x >>$infofile
77\rm $infofile.x
78
Note: See TracBrowser for help on using the repository browser.