# Script to create a slightly more useful attempt
# at a prospecting guide.
areas = ['', '1a','1b','1c','1d', '2a', '2b', '2c', '2d', '3', '4', '5', '6','7', '8a', '8b', '8c', '8d', '9', '10', '11']
areanames = {
'': 'Location unclear',
'1a': '1a – Plateau: around Top Camp',
'1b': '1b – Western plateau near 182',
'1c': '1c – Eastern plateau near 204 walk-in path',
'1d': '1d – Further plateau around 76',
'2a': '2a – Southern Schwarzmooskogel near 201 path and the Nipple',
'2b': '2b – Eishöhle area',
'2c': '2c – Kaninchenhöhle area',
'2d': '2d – Steinbrückenhöhle area',
'3': '3 – Bräuning Alm',
'4': '4 – Kratzer valley',
'5': '5 – Schwarzmoos-Wildensee',
'6': '6 – Far plateau',
'7': '7 – Egglgrube',
'8a': '8a – Loser south face',
'8b': '8b – Loser below Dimmelwand',
'8c': '8c – Augst See',
'8d': '8d – Loser-Hochganger ridge',
'9': '9 – Gschwandt Alm',
'10': '10 – Altaussee',
'11': '11 – Augstbach'
}
areacolours = {
'1a' : '#00ffff',
'1b' : '#ff00ff',
'1c' : '#ffff00',
'1d' : '#ffffff',
'2a' : '#ff0000',
'2b' : '#00ff00',
'2c' : '#008800',
'2d' : '#ff9900',
'3' : '#880000',
'4' : '#0000ff',
'6' : '#000000', # doubles for surface fixed pts, and anything else
'7' : '#808080'
}
cavelists={}
for a in areas: cavelists[a]=[]
def chomp(s):
if not s: return s
if(s[-1]=="\n"): return s[:-1]
else: return s
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 longnumber(c, number):
"""Both numbers"""
if (c["Unofficial number"] and c["Unofficial number"] != number):
return number + " (" + c["Unofficial number"] + ")"
else:
return number
def find_location(cave):
for fixtype in ["tag point in dataset", "other point in dataset", "exact entrance in dataset (drip line/highest enclosed contour)", "GPS post SA", "GPS pre SA"]:
if(cave[fixtype]):
return positions[cave[fixtype]]
return 0
def is_explored(cave):
s = cave["Kat Status Code"]
if(not s): return "
"
s = s.replace("(?)","")
if s[-1] == " ": s=s[:-1]
if (not s):
print "Rogue space in " + find_effective_number(cave)
return "
"
code = s[-1]
if code == '+': status = "good"
elif code in ['=', 'x']: status = "bad"
elif code in ['-', '?']: status = "awful"
else: return "
%s
" % code
return "
%s
" % (status, code)
def is_tagged(cave):
s = chomp(cave["Marking"])
s = re.sub(r'\s+(?:\(\?\))?$', "", s)
if not s and cave["Multiple entrances"] in ["yes", "entrance", "last entrance"]:
return "
"
if s == "Tag": return "
%s
" % s
if s in ["Retag", "Paint", "Spit"]: return "
%s
" % s
if s == "Unmarked": return "
None
"
if s == "": return "
"
print "Unrecognised marking status on %s: %s" % (find_effective_number(cave), repr(s))
return "
ERROR
"
def findability_color(cave):
if cave["Findability"] == "Surveyed": return "good"
elif cave["Findability"] == "Refindable": return "bad"
elif cave["Findability"] == "Lost": return "awful"
else: return ""
def is_underground_surveyed(cave):
s = chomp(cave["Underground drawn survey"])
if(cave["Multiple entrances"] not in ["", "yes"]): return "
"
def have_survey_data(cave):
if(cave["Multiple entrances"] not in ["", "yes"]): return "
"
s = chomp(cave["Underground centre line"])
if s: return "
Yes
"
s = chomp(cave["Survex file to get length and depth"])
if s: return "
Yes
"
if cave["Kat Status Code"] and cave["Kat Status Code"][0] == '1':
# Cave < 50m deep and < 50m long...
# Sadly this band includes caves we really ought to have data for as
# well as caves small enough that a grade 1 sketch is justifiable.
return "
<50m
"
s = chomp(cave["Underground drawn survey"])
if s: return "
Missing
"
return "
None
"
def has_photo(cave):
s = chomp(cave["Photo of location"])
if ((cave["Multiple entrances"] not in ["", "yes"]) and chomp(cave["Autogen file"]) == ""):
return "
A marking status of \"Retag\" means a tag is in place but it carries a provisional number, or in some cases an incorrect number, and needs replacing with a new tag.
\n
Kataster status codes indicate the size of a cave, its character and its exploration status, as described here.
For more info on each cave, see the links to detailed description pages.
\n")
for maparea in mapcodes:
filename = get_img_name(maparea)
if maparea != "all":
htmlfile.write("
%s area detail
\n" % (maparea, maps[maparea][DESC]))
basename = filename[0:-3]
htmlfile.write("\n" % (maparea, maparea, basename, maparea, basename, maparea, maparea))
htmlfile.write("Note: this requires a login to work!\n")
htmlfile.write("\n" % imgs[maparea].size)
cachednumber = ""
cachedarea = ""
cachedname = ""
# Plot the subareas on the full map
for maparea in maps.keys():
if maparea == "all":
continue
m = maps[maparea]
l,t = mungecoord(m[L], m[T], "all")
r,b = mungecoord(m[R], m[B], "all")
text = maparea + " map"
textlen = draws['all'].textsize(text)[0] + 3
draws['all'].rectangle([l, t, l+textlen, t+SIZE+2], fill='#ffffff')
draws['all'].text((l+2, t+1), text, fill="#000000")
imgmaps['all'].append( [l, t, l+textlen, t+SIZE+2, "submap" + maparea, maparea + " subarea map"] )
draws['all'].rectangle([l, t, r, b], outline='#777777')
draws['all'].rectangle([l, t, l+textlen, t+SIZE+2], outline='#777777')
# Plot faked positions first so that real caves go on top of the large circles
fakedpositions = file("fakedpositions.dat")
for p in fakedpositions:
try:
(x,y,d,name) = re.match(r'\(([0-9.]*?),\t([0-9.]*?),\t([0-9.]*?)\)\t(.*?)[\t ]*#', chomp(p)).groups()
except:
print "Couldn't understand" + repr(chomp(p))
continue
# Find the area with this cave in
area = ''
for tryarea in areas:
for (number, cave, locn) in cavelists[tryarea]:
if name == number:
area = tryarea
break
# FIXME really want to break from both loops at once
# but I don't know how to in Python
if area != '':
break
(x,y,d) = map(float, (x,y,d))
for maparea in maps.keys():
lo = mungecoord(x-d, y+d, maparea)
hi = mungecoord(x+d, y-d, maparea)
lpos = mungecoord(x-d, y, maparea)
draw = draws[maparea]
draw.ellipse([lo,hi], outline="#000000")
draw.ellipse([lo[0]+1, lo[1]+1,hi[0]-1, hi[1]-1], outline=areacolours[area])
draw.ellipse([lo[0]+2, lo[1]+2,hi[0]-2, hi[1]-2], outline=areacolours[area])
draw.rectangle([lpos[0],lpos[1]-SIZE/2, lpos[0] + draw.textsize(name)[0], lpos[1]+SIZE/2], fill="#ffffff")
imgmaps[maparea].append( [lpos[0],lpos[1]-SIZE/2, lpos[0] + draw.textsize(name)[0], lpos[1]+SIZE/2, name, "Approx position of %s" % name] )
draw.text((lpos[0], lpos[1]-SIZE/2), name, fill="#000000")
plot(positions["laser.0_7"], "BNase", "6", "Bräuning Näse laser point")
plot(positions["226-96"], "BZkn", "6", "Bräuning Zinken trig point")
plot(positions["vd1"],"VD1","6", "VD1 survey point")
plot(positions["laser.kt114_96"],"HSK","6", "Hinterer Schwarzmooskogel trig point")
plot(positions["2000"],"Nipple","6", "Nipple (Weiße Warze)")
plot(positions["3000"],"VSK","6", "Vorderer Schwarzmooskogel summit")
plot(positions["topcamp"], "TC", "6", "Top Camp")
plot(positions["laser.0"], "LSR0", "6", "Laser Point 0")
plot(positions["laser.0_1"], "LSR1", "6", "Laser Point 0/1")
plot(positions["laser.0_5"], "LSR5", "6", "Laser Point 0/5")
for (loctuple, number, area, label) in cavestoplot:
plot(loctuple, number, area, label)
for area in areas:
if area:
htmlfile.write("
")
for (number, cave, locn) in cavelists[area]:
# We only check the "oursness" for the first entrance.
if cave["Multiple entrances"] in ["", "yes"]:
notours = not re.search(r'CUCC', cave['Explorers'])
if notours:
htmlfile.write("