From d524f94c478612da93fa6b66cd65e4cb3a26ec0b Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 5 Nov 2023 02:24:37 +0200 Subject: [PATCH] more stations --- core/models/survex.py | 9 ++++-- parsers/locations.py | 69 +++++++++++++++++++++++++++++++++++++++++ templates/stations.html | 10 ++++++ 3 files changed, 86 insertions(+), 2 deletions(-) diff --git a/core/models/survex.py b/core/models/survex.py index 8999810..a27ed45 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -84,12 +84,17 @@ class SurvexStation(models.Model): alt, ref = self.srtm_alt() diff = alt - self.z - if diff >= 0: + if diff >= 0.3: colour = "blue" sign = "+" - else: + elif diff <= -0.3: colour = "red" sign = "" + else: + diff = 0 + colour = "grey" + sign = "" + if abs(diff) > 60: weight = "bold" diff --git a/parsers/locations.py b/parsers/locations.py index 6c079cd..92df13e 100644 --- a/parsers/locations.py +++ b/parsers/locations.py @@ -49,9 +49,73 @@ class MapLocations(object): ("225-96", "BAlm", "Reference", "Bräuning Alm trig point"), ] # 12 fixed points + # Where we have a lot of survey stations which have not been assigned to proper Entrances and Caves yet, but we + # want to see them in the /stations report page: + + + + p = [] def points(self): + nullent = Entrance.objects.all()[0] # hope this doesn't barf + pending = [ + ("1623.p2013-cucc-pit", "no ent", False, nullent), + + ("1626.p2013-cucc-draftyholes", "no ent", False, nullent), + ("1626.p2013-cucc-pitarea", "no ent", False, nullent), + ("1626.p2013-cucc-goodpit", "no ent", False, nullent), + ("1626.p2013-cucc-goodpit-DUP", "no ent", False, nullent), + ("1626.p2023-cucc-22mpit", "no ent", False, nullent), + ("1626.p2013-cucc-lineofpits", "no ent", False, nullent), + ("1626.p2013-cucc-12mpit", "no ent", False, nullent), + ("1626.p2013-cucc-20mpit", "no ent", False, nullent), + ("1626.p2013-cucc-2s-drop", "no ent", False, nullent), + # to add in the rest of the entrances from the 2013 prospecting trip + + # fix p2013-cucc-01 reference 486512 284436 1825 ; 11:02 + # *fix p2013-cucc-01-DUP reference 486519 284448 1823 + + # *fix p2013-cucc-01B reference 486492 284508 1828 ; 11:37 + + # *fix p2013-cucc-01cp reference 486507 284580 1843 ; 11:44 + + # *fix p2013-cucc-rift reference 486410 284622 1835 ; 12:00 + + # *fix p2013-cucc-slope reference 486485 284591 1844 ; 11:51 + + # *fix p2013-cucc-snowplug2 reference 486042 284531 1813 ; 13:03 + + # *fix p2013-cucc-draft4pit reference 486374 284438 1786 ; 13:58 ; * GOOD + # *fix p2013-cucc-draft4pit-DUP reference 486375 284447 1774 + + # *fix p2013-cucc-DraftHole reference 486277 284716 1856 ; 12:28 + + # *fix p2013-cucc-setofsnowholes reference 486060 284584 1848 ; 12:51 + + # *fix p2013-cucc-stotp20 reference 486176 284738 1864 ; 12:37 + + # *fix p2013-cucc-snowplug reference 486349 284666 1833 ; 12:13 + + # *fix p2013-cucc-draft3pit reference 486332 284428 1769 + + # *fix p2013-cucc-shelter1 reference 486533 284546 1831 + + # *fix p2013-cucc-draft2pit reference 486333 284485 1779 + + # ;*fix p2013-cucc-01-DUP ; marked as duplicate + # ;*fix p2013-cucc-draft4pit-DUP ; marked as duplicate + + ("1626.p2014-ms-01", "no ent", False, nullent), + ("1626.p2014-ms-02", "no ent", False, nullent), + ("1626.p2014-ms-03", "no ent", False, nullent), + ("1626.p2014-ms-04", "no ent", False, nullent), + ("1626.p2014-ms-05", "no ent", False, nullent), + ("1626.p2014-ms-06", "no ent", False, nullent), + ("1626.p2014-ms-07", "no ent", False, nullent), + + ] + self.p = pending for ent in Entrance.objects.all(): for st, ent_type in {ent.other_station: "other", ent.tag_station: "tag"}.items(): if st != "": @@ -74,6 +138,8 @@ def validate_entrance_stations(ent=None): def station_lower_case(station): nonlocal url + if not station: + return so = SurvexStation.objects.filter(name=station.lower()) if so.count() == 1: message = f"X - Entrance {ent} station '{station}' should be '{station.lower()}'" @@ -119,6 +185,7 @@ def validate_entrance_stations(ent=None): if so.count() != 0: message =f"{so.count()} found for Entrance {ent} '{ent_type}' station '{st}' {so}" else: + # not found message = f" ! - Entrance {ent} has invalid '{ent_type}' station '{st}'" if st == ent.best_station(): message = message + " - AND THIS IS THE 'BEST' ONE" @@ -296,6 +363,8 @@ def LoadPositions(): for sid in mappoints: + if not sid: # catch None entry + continue if sbid.endswith(sid) or sbid.endswith(sid.lower()): blockpath = "." + sbid[: -len(sid)].strip(".") # only the most recent one that is mappoints if sid in found_points: diff --git a/templates/stations.html b/templates/stations.html index d41f319..f701676 100644 --- a/templates/stations.html +++ b/templates/stations.html @@ -19,8 +19,18 @@ th, td { {{s.name|safe}} {{s.x|floatformat:2}} {{s.y|floatformat:2}} + + +{% if s.lat %} +{{s.lat|floatformat:6}} {% endif %} + +{% if s.lat %} +{{s.long|floatformat:6}} {% endif %} + + {{s.z|floatformat:0}} {{s.srtm_diff.0|safe}} {{s.srtm_diff.1|floatformat:0}}