mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-12-24 01:12:35 +00:00
200 lines
6.7 KiB
Python
200 lines
6.7 KiB
Python
#!/usr/bin/python
|
|
import sys,csv,os,cStringIO
|
|
|
|
CS_BINARY = os.path.join(os.path.dirname(os.path.realpath(__file__)),"cavestats")
|
|
N = 30 # Number to include in "N longest" and "N deepest" lists
|
|
|
|
# Utility functions
|
|
|
|
def chomp(s):
|
|
if(s[-1]=="\n"): return s[:-1]
|
|
else: return s
|
|
|
|
# Important functions
|
|
|
|
def find_effective_number(c):
|
|
"""Determine an appropriate number to use."""
|
|
if c["Kataster Number"]:
|
|
return c["Kataster Number"]
|
|
else:
|
|
return c["Unofficial number"]
|
|
def find_name(c):
|
|
if c["Name"]: return c["Name"]
|
|
elif c["Unofficial Name"]: return c["Unofficial Name"]
|
|
else: return "?"
|
|
|
|
def dataset_prefix(c):
|
|
translations = {"2002-xx" : "quarriesd", "la11" : "lunge", "la12" : "sternloch", "la34" : "raetsel", "2001-ms-01" : "bogen" }
|
|
if translations.has_key(c):
|
|
return translations[c]
|
|
else:
|
|
return c
|
|
|
|
def print_caveline(number, l, d, w, cave):
|
|
dplong.write("<tr><td>%s</td>" % number)
|
|
if cave["Autogen file"]: # single caves
|
|
dplong.write("""<td class="name"><a href="%s">%s</a></td>""" % (cave["Autogen file"], find_name(cave)))
|
|
dplong.write("""<td>%.1f</td><td>%.1f</td><td>%.1f</td></tr>\n""" % (l,d,w))
|
|
dump.write("%s\t%d\t%d\t%d\n" % (number, l, d, w))
|
|
else: # virtual entries for cave systems
|
|
dplong.write("""<td class="name">%s</td>""" % find_name(cave))
|
|
dplong.write("""<td><i>%.1f</i></td><td><i>%.1f</td><td><i>%.1f</i></td></tr>\n""" % (l,d,w))
|
|
|
|
|
|
def parse_csvfile():
|
|
caveslist = []
|
|
print ("Calculating SMK-system extent... "),
|
|
os.popen("cavern -v7 ../loser/smk-system.svx -o noinfo/smk-system.3d")
|
|
l,d,w = map(float, chomp(os.popen(CS_BINARY + " noinfo/smk-system -c ").read()).split("\t"))
|
|
caveslist.append(["", l,d,w, {"Name" : "<i>Schwarzmooskogelhöhlensystem</i>", "Autogen file" : ""}])
|
|
print ("done\nParsing Cave list")
|
|
for cavefile in os.listdir("noinfo/cave_data"):
|
|
cavetabfiles = dir("noinfo/cave_data/")
|
|
fieldnames=chomp(cavetabfile.next()).replace('"','').split(",")
|
|
cavetab = csv.DictReader(cavetabfile, fieldnames)
|
|
|
|
# Gratuitiously complicated progress bar widget.
|
|
k = 0
|
|
m = 1
|
|
L = 498 #L = len(cavetabfile.readlines()) doesn't work
|
|
print "0"+50*"-"+"100%\n|",
|
|
for cave in cavetab:
|
|
if((50*m)/L > k):
|
|
sys.stdout.write("=")
|
|
sys.stdout.flush()
|
|
k = k + 1
|
|
m = m + 1
|
|
if(cave["Multiple entrances"] not in ["", "yes"]): continue
|
|
|
|
number = find_effective_number(cave)
|
|
if((cave["Area"]=="1626") and (number not in ['LA11', 'LA12'])): continue
|
|
|
|
prefix = dataset_prefix(number.lower())
|
|
stats = os.popen(CS_BINARY + " noinfo/all -cs " + prefix).read()
|
|
if(stats.find("No") != -1):
|
|
continue # don't trust the rather erratic data in the table
|
|
#if(cave["Length"]): print number, "length:", cave["Length"]
|
|
#if(cave["Depth"]): print number, "depth:", cave["Depth"]
|
|
#if(cave["Extent"]): print number, "extent:", cave["Extent"]
|
|
else:
|
|
try:
|
|
l,d,w = map(float, chomp(stats).split("\t"))
|
|
caveslist.append([number,l,d,w,cave])
|
|
except:
|
|
print "Error on", number
|
|
raise
|
|
print "|%d\nWriting output file" % m
|
|
return caveslist
|
|
|
|
# Main routine:
|
|
|
|
|
|
# this doesn't seem to work, and is deprectaed anyway
|
|
#if (not os.access('CS_BINARY', os.X_OK)):
|
|
# print "%s not executable - skipping %s" % (CS_BINARY,__file__)
|
|
# exit(1)
|
|
|
|
caveslist = parse_csvfile()
|
|
|
|
dplong = file("dplong.htm", "w")
|
|
dump = file("noinfo/lengths.dat", "w")
|
|
|
|
dplong.write("""<!DOCTYPE html>
|
|
<html>
|
|
<!-- Do not edit this file - it is auto-generated. Edit noinfo/create_dplong_table.py instead. -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
<title>CUCC's deepest and longest caves</title>
|
|
<link rel="stylesheet" type="text/css" href="css/main2.css" />
|
|
<style type="text/css">
|
|
#funnytable { margin: 0 auto; border-collapse: collapse; border: 2px solid black }
|
|
#funnytable td,
|
|
#funnytable th { border: 1px solid black}
|
|
#funnytable th { border-bottom: 2px solid black }
|
|
#funnytable td { text-align: right; }
|
|
#funnytable td.name { text-align: left }
|
|
h3 {text-align: center}
|
|
</style>
|
|
<meta name="keywords" content="NOEDIT">
|
|
</head>
|
|
<body>
|
|
<h1>Lengths and depths of caves in the 1623 area</h1>
|
|
|
|
<p>This page lists the lengths, depths and horizontal extents of those caves on
|
|
the plateau for which we have survey centerline data. At present, that's only
|
|
%d out of 270 or so, but the missing ones are mostly very small and obscure;
|
|
the notable exceptions are some caves explored by other groups (35, LA25,
|
|
BS17), and CUCC caves 71, 92, 96 and 97.</p>
|
|
|
|
<p>The caves that comprise the Schwarzmooskogel master system (32, 40,
|
|
41, 78, 83, 87, 88, 107, 115, 136, 142, 143, 144, 161, 204, 258 and 264) are listed separately in the table,
|
|
although in some cases the divisions are more historical than structural or logical;
|
|
but for comparison I have also included the measurements of the whole system.
|
|
</p>
|
|
|
|
<p>In these tables "length" means the total length of (non-duplicated)
|
|
survey legs, not just the horizontal components, but "extent" is the
|
|
maximum horizontal distance between any two survey stations.</p>
|
|
|
|
<p><a href="#deepest">Deepest caves</a> — <a href="#longest">Longest
|
|
caves</a></p>
|
|
|
|
<table id="funnytable">
|
|
<tr>
|
|
<th>Kat. Nr.</th><th>Name</th><th>Length (m)</th><th>Depth (m)</th><th>Extent
|
|
(m)</th></tr>""" % len(caveslist))
|
|
|
|
for cave in caveslist:
|
|
print_caveline(*cave)
|
|
|
|
dplong.write("""</table>
|
|
<h3 id="deepest">The plateau's %d deepest caves</h3>
|
|
<table id="funnytable">
|
|
<tr>
|
|
<th>Kat. Nr.</th><th>Name</th><th>Length (m)</th><th>Depth (m)</th><th>Extent (m)</th></tr>""" % N)
|
|
|
|
dump.close()
|
|
dump = cStringIO.StringIO() # just throw it away!
|
|
|
|
caveslist.sort(lambda u, v: cmp(v[2],u[2]))
|
|
for cave in caveslist[:N]:
|
|
print_caveline(*cave)
|
|
|
|
dplong.write("""</table>
|
|
<h3 id="longest">The plateau's %d longest caves</h3>
|
|
<table id="funnytable">
|
|
<tr>
|
|
<th>Kat. Nr.</th><th>Name</th><th>Length (m)</th><th>Depth (m)</th><th>Extent (m)</th></tr>""" % N)
|
|
|
|
caveslist.sort(lambda u, v: cmp(v[1],u[1]))
|
|
for cave in caveslist[:N]:
|
|
print_caveline(*cave)
|
|
|
|
|
|
dplong.write("""</table>
|
|
|
|
|
|
<p>This page used to house a list of the deepest and longest caves in Austria,
|
|
with ours highlighted. Rather than maintaining our own independent database, it
|
|
seems much more sensible to link to the much more frequently updated list <a
|
|
href="http://www.nhm-wien.ac.at/NHM/Hoehle/lth.htm">here</a> maintained by Theo
|
|
Pfarr. For comparison, Bob Gulden of the American NSS maintains a list <a
|
|
href="http://www.caverbob.com/wlong.htm">here</a> of the world's longest
|
|
caves.</p>
|
|
|
|
|
|
<hr />
|
|
<ul id="links">
|
|
<li>Back to <a href="infodx.htm">Expedition Index</a> page</li>
|
|
<li><b>Cave description indices:</b>
|
|
<ul>
|
|
<li>Caves in CUCC's area <a href="indxal.htm">1623</a></li>
|
|
<li>Adjacent area <a href="1626/index.html">1626</a></li>
|
|
</ul></li>
|
|
<li>Back to <a href="https://camcaving.uk/">CUCC home page</a></li>
|
|
</ul>
|
|
</body>
|
|
</html>""")
|
|
|
|
dump.close()
|