mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-22 07:11:55 +00:00
c8cccbe7bb
lengths.dat (which is in turn calculated from dataset).
196 lines
6.7 KiB
Python
196 lines
6.7 KiB
Python
#!/usr/bin/python
|
|
import sys,csv,os,cStringIO
|
|
|
|
CS_BINARY = "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 dataset/loser/smk-system -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 CSV file"
|
|
cavetabfile = file("noinfo/CAVETAB2.CSV")
|
|
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:
|
|
|
|
caveslist = parse_csvfile()
|
|
|
|
dplong = file("dplong.htm", "w")
|
|
dump = file("noinfo/lengths.dat", "w")
|
|
|
|
dplong.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html>
|
|
<!-- Do not edit this file - it is auto-generated. Edit 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>
|
|
</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 250 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, 76, 92, 96 and 97. Of the latter 76 (by far the most
|
|
significant of these) is in the process of being re-explored, and the figures
|
|
in the table are for the portions revisited so far.</p>
|
|
|
|
<p>The eight main constitutent parts of the Schwarzmooskogel master system (40,
|
|
41, 78, 88, 115, 116, 136, 144 and 161) are listed separately in the table,
|
|
although in some cases there is some ambiguity as to where to draw the lines;
|
|
but for comparison I have also included the measurements of the whole system.
|
|
</p>
|
|
|
|
<p>In these tables "length" means the total length of survey legs, not just the
|
|
horizontal components, but "extent" is the maximum horizontal distance between
|
|
any two survey stations. (If anyone knows a good algorithm for finding the
|
|
maximum 3D spatial diameter of a set of points, and is willing to implement it,
|
|
please do so!)</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.pipeline.com/~caverbob/">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="../index.htm">CUCC home page</a></li>
|
|
</ul>
|
|
</body>
|
|
</html>""")
|
|
|
|
dump.close()
|