mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-21 23:01:55 +00:00
more obscure scripts found - to be documented
This commit is contained in:
parent
d20968a9c9
commit
6e5cc11cae
8222
noinfo/scripts/loser-caves1624-raw-data/Uebersicht_2011.svx
Normal file
8222
noinfo/scripts/loser-caves1624-raw-data/Uebersicht_2011.svx
Normal file
File diff suppressed because it is too large
Load Diff
109
noinfo/scripts/loser-caves1624-raw-data/convert.py
Normal file
109
noinfo/scripts/loser-caves1624-raw-data/convert.py
Normal file
@ -0,0 +1,109 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import csv
|
||||
import re
|
||||
#import math
|
||||
|
||||
# dataset generated from CaveRenderer
|
||||
# *fix where from=to, convert grads to degrees and print out legs
|
||||
# A better conversion would identify caves and put in begin/end pairs
|
||||
# Offset Easting by 450k and Northing by 200k to fit with the CUCC standard
|
||||
|
||||
fin = open("Uebersicht_2011.txt")
|
||||
|
||||
fout = open("Uebersicht_2011.svx", "w")
|
||||
fout.write("*begin 1626\n")
|
||||
|
||||
rows = list(csv.reader(fin.readlines(), csv.excel_tab))
|
||||
assert rows[0] == ['RH\xf6hle', 'RGang', 'RPunkt', 'H\xf6hle', 'Gang', 'Punkt', 'Start', 'Ende', 'L\xe4nge', 'Azimut', 'Neigung', 'Links', 'Rechts', 'Oben', 'Unten', 'Ger\xe4t', 'Richtung', 'Ring', 'Farbe', 'Ebene', 'Datum', 'Vermesser', 'Bezeichnung', 'Material', 'Ma\xdfnahmen', 'Bemerkung', 'Datei/URL', 'Include-Datei', 'RefX', 'RefY', 'RefZ', 'X', 'Y', 'Z']
|
||||
headers = ['RHohle', 'RGang', 'RPunkt', 'Hohle', 'Gang', 'Punkt', 'Start', 'End', 'Tape', 'Compass', 'Clino', 'Left', 'Right', 'Up', 'Down', 'Instruments', 'Direction', 'Ring', 'Colour', 'Ebene', 'Date', 'Surveyor', 'Description', 'Material', 'Massnahmen', 'Marking', 'Datei-URL', 'Include-Datei', 'RefX', 'RefY', 'RefZ', 'X', 'Y', 'Z']
|
||||
#sfromfixes = set()
|
||||
|
||||
cave=instruments=None
|
||||
beginname=None
|
||||
|
||||
|
||||
for i, row in enumerate(rows[1:]):
|
||||
data = dict(zip(headers, row))
|
||||
|
||||
for k in ['RefX', 'RefY', 'RefZ', 'X', 'Y', 'Z', 'Left', 'Right', 'Up', 'Down', 'Tape', 'Compass', 'Clino']:
|
||||
data[k] = float(re.sub(",", ".", data[k]))
|
||||
assert data["Start"] == '0', (i, data)
|
||||
del data["Start"]
|
||||
assert data["End"] == '0', (i, data)
|
||||
del data["End"]
|
||||
assert not data['Include-Datei']
|
||||
del data["Include-Datei"]
|
||||
assert not data['Datei-URL']
|
||||
del data["Datei-URL"]
|
||||
|
||||
prevlinecave=cave
|
||||
cave=data['RHohle']
|
||||
|
||||
prevlineinstruments=instruments
|
||||
instruments=data["Instruments"]
|
||||
|
||||
if cave != prevlinecave:
|
||||
if beginname != None:
|
||||
fout.write("*end %s\n" % (beginname))
|
||||
beginname = None
|
||||
if row != i: #don't start new begin for last line
|
||||
fout.write("\n*begin %s\n" % (cave))
|
||||
beginname = cave
|
||||
|
||||
|
||||
|
||||
#'Geraet/Instruments' column indicates instruments used (360 degrees, 400 grads)
|
||||
#1 = azimuth in degrees, slope in degrees
|
||||
#2 = azimuth in grads, slope in grads
|
||||
#3 = azimuth in grads, slope in degrees
|
||||
#4 = azimuth in degrees, slope in grads
|
||||
|
||||
# Better to put data in as-is with appropriate *commands - this will do for now
|
||||
if data["Instruments"] in ["2", "3"]:
|
||||
bearing = data["Compass"] * 0.9
|
||||
else:
|
||||
bearing = data["Compass"]
|
||||
if data["Instruments"] in ["2", "4"]:
|
||||
slope = data["Clino"] * 0.9
|
||||
else:
|
||||
slope = data["Clino"]
|
||||
|
||||
|
||||
#vx, vy, vz = data["X"] - data["RefX"], data["Y"] - data["RefY"], data["Z"] - data["RefZ"]
|
||||
|
||||
#tape = math.sqrt(vx*vx + vy*vy + vz*vz)
|
||||
#if math.fabs(tape-data["Tape"]) > 0.2:
|
||||
# print (i, tape, tape-data["Tape"])
|
||||
|
||||
#compass = (math.degrees(math.atan2(vx, vy))+360) % 360
|
||||
#if math.fabs(((compass - data["Compass"] + 180) % 360) - 180) > 0.9:
|
||||
# print (i, data["Instruments"], compass, data["Compass"])
|
||||
|
||||
#clino = math.degrees(math.atan2(vz, math.sqrt(vx*vx + vy*vy)))
|
||||
#if math.fabs(clino - data["Clino"]) > 4.9:
|
||||
# print (i, data["Instruments"], clino, data["Clino"]), (vx,vy,vz)
|
||||
|
||||
#if i < 10: print data
|
||||
|
||||
sfrom = "%s-%s" % (data['RGang'], data['RPunkt'])
|
||||
sto = "%s-%s" % (data['Gang'], data['Punkt'])
|
||||
if data['Description']:
|
||||
fout.write(";%s\n" % data['Description'])
|
||||
if sfrom == sto:
|
||||
if data['RefX'] == data['X'] and data['RefY'] == data['Y'] and data['RefZ'] == data['Z']:
|
||||
fout.write("*fix %s %f %f %f\n" % (sfrom, data['RefX']-450000, data['RefY']-200000, data['RefZ']))
|
||||
else:
|
||||
print ("Fix 'leg' with non-matching co-ordinates - line i\n")
|
||||
else:
|
||||
fout.write("%s %s\t%s\t%s\t%s\n" % (sfrom, sto, data['Tape'], bearing, slope))
|
||||
# if sfrom not in sfromfixes:
|
||||
# fout.write("*fix %s %f %f %f\n" % (sfrom, data['RefX']-450000, data['RefY']-200000, data['RefZ']))
|
||||
# sfromfixes.add(sfrom)
|
||||
|
||||
if beginname != None:
|
||||
fout.write("*end %s\n" % (beginname))
|
||||
|
||||
fout.write("\n*end 1626\n")
|
||||
fout.close()
|
||||
|
BIN
noinfo/scripts/loser-caves1624-raw-data/data explanation.xls
Normal file
BIN
noinfo/scripts/loser-caves1624-raw-data/data explanation.xls
Normal file
Binary file not shown.
26
noinfo/scripts/loser-caves1624-raw-data/split.sh
Normal file
26
noinfo/scripts/loser-caves1624-raw-data/split.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
mkdir -p split
|
||||
file=split/start.svx
|
||||
kat=
|
||||
|
||||
while read line; do
|
||||
line=$(echo $line | sed 's/\t/ /g')
|
||||
line=$(echo $line | sed 's/ / /g')
|
||||
s=$(echo $line | sed 's/^\*begin \([0-9]*\)$/\1/')
|
||||
if [ "$s" == "$line" ]; then
|
||||
echo "$line" \
|
||||
| egrep -q -m 1 '^\*end [0-9]+$' \
|
||||
|| (echo "$line" >> $file)
|
||||
else
|
||||
echo ">>$line<<"
|
||||
echo ">>$s<<"
|
||||
echo "*end $kat" >> $file
|
||||
file=split/$s.svx
|
||||
kat=$s
|
||||
echo "Starting $kat"
|
||||
echo "*begin $kat" > $file
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue
Block a user