# 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', '4' : '#0000ff', '6' : '#000000', # doubles for surface fixed pts '7' : '#808080' } cavelists={} for a in areas: cavelists[a]=[] def chomp(s): if not s: return s if s[-1]=="\n": return chomp(s[:-1]) elif s[-1]==" ": return chomp(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 munge_allposline(line): x, y, z, name = re.match(r'\(([0-9.]*?),\s*([0-9.]*?),\s*([0-9.]*?)\s*\)\s*(.*)\n', line).groups() x,y, z = map(float, [x,y,z]) return (name, x,y,z) 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 ""+s[-1]+"" def is_tagged(cave): s = chomp(cave["Marking"].replace("(?)", "")) 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" or not s: return "None" 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 "" if not s: return "None" if s and (s.find(" -1 or s.find(" -1): return "Yes" else: return "Missing" def has_photo(cave): s = chomp(cave["Photo of location"]) if ((cave["Multiple entrances"] not in ["", "yes"]) and chomp(cave["Autogen file"]) == ""): return "" if not s: return "None" if s and (s.find(" -1 or s.find(" -1): return "Yes" else: return "Missing" import csv, re, time cavetabfile = file("../CAVETAB2.CSV") fieldnames=chomp(cavetabfile.next()).replace('"','').split(",") cavetab = csv.DictReader(cavetabfile, fieldnames) positionfile = file("../all.pos") positionfile.next() positions = {} print "Munging all.pos" for stn in positionfile: t = munge_allposline(stn) positions[t[0]] = (t[1],t[2],t[3]) print "Done" htmlfile = file("../../handbook/prospecting_guide_short.html", "w") htmlfile.write("Prospecting Guide\n") htmlfile.write(""" """) htmlfile.write("

Prospecting Guide: Summary

") htmlfile.write("

Generated " + time.strftime("%x %X") + "

\n") htmlfile.write("

Notes:

  • 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") cachednumber = "" cachedarea = "" cachedname = "" for cave in cavetab: if cave["Link file"]: continue number = find_effective_number(cave) if(cave["Multiple entrances"] not in ["", "yes"]): number = "—" + cachednumber + cave["Entrances"] shortnumber = cachednumber if not cave["Area"]: cave["Area"] = cachedarea #if not cave["Name"]: cave["Name"] = cachedname else: cachednumber = number shortnumber = number cachedname = cave["Name"] or cave["Unofficial Name"] cachedarea = cave["Area"] area = cave["Area"] if area == '1626': continue loctuple = find_location(cave) if(cave["Multiple entrances"] == "yes"): locn = "" elif(loctuple): locn = "" % loctuple else: locn = "" try:#if(not cavelists.has_key(area)): cavelists[area]=[] cavelists[area].append((number, cave, locn)) except: print number, area for area in areas: if area: htmlfile.write("" % areanames[area]) else: htmlfile.write("") htmlfile.write("") for (number, cave, locn) in cavelists[area]: if cave["Autogen file"]: htmlfile.write("" % (cave["Autogen file"], longnumber(cave, number), number.replace("—", ""), cave["Name"] or cave["Unofficial Name"])) else: htmlfile.write("" % (longnumber(cave, number), number.replace("—", ""), cave["Name"] or cave["Unofficial Name"])) htmlfile.write(is_explored(cave)) htmlfile.write(is_underground_surveyed(cave)) htmlfile.write(is_tagged(cave)) htmlfile.write(has_photo(cave)) htmlfile.write(locn) if(cave["Findability"] != "Surveyed" and cave["Multiple entrances"] != "yes"): htmlfile.write("" % (cave["Location"], cave["Bearings"])) htmlfile.write("\n") htmlfile.write("
 %d%d%d" % findability_color(cave) + cave["Findability"] + "

%s

Location unclear

Cave NumberNameFinishedSurveyedMarkedPhotoedENAltLocation
%s%s
%s%s%s %s
\n") htmlfile.write("") htmlfile.close()