From 5739d145f60c9db306d8dbd801946078f01b83a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Rodr=C3=ADguez?= <36035218+grojeda@users.noreply.github.com> Date: Mon, 23 Nov 2026 10:05:19 +1100 Subject: [PATCH 1/2] fix: publish Gliders annual plot selection areas --- scripts/cron/gliders/GLIDERS_GENERATORS.md | 5 +- scripts/cron/gliders/gliders_yearmaps.py | 52 ++- .../cron/gliders/publish_gliders_yearmaps.py | 12 +- scripts/cron/test_gliders_yearmaps.py | 31 +- .../generators/gliders_yearmaps/expected.json | 430 ++++++++++++++++-- 5 files changed, 453 insertions(+), 77 deletions(-) diff --git a/scripts/cron/gliders/GLIDERS_GENERATORS.md b/scripts/cron/gliders/GLIDERS_GENERATORS.md index 679c7c7..fe1a608 100644 --- a/scripts/cron/gliders/GLIDERS_GENERATORS.md +++ b/scripts/cron/gliders/GLIDERS_GENERATORS.md @@ -311,9 +311,10 @@ resource proxy. Schema version 1 contains `maps`, each with `id`, `year`, `platform`, `variable`, `window`, `is_nrt`, `image_url`, and `deployments`. The image URL is read from the original GIF attached to the HTML image map and is null when the association cannot be verified. Each deployment -contains only `mission_name`, `pixel_rect`, `bbox`, and the original mission +contains `mission_name`, `pixel_rect`, `bbox`, optional `plot_pixel_rects`, and the original mission `url`. Pixel coordinates use `[x1,y1,x2,y2]` on the original GIF and identify -the first mission rectangle in the map. WGS84 bounds use `[west,south,east,north]`. +the first mission rectangle on the map and any subsequent mission rectangles on +the time plots. WGS84 bounds use `[west,south,east,north]` and apply to the map rectangle. The figure and mission paths are website-root-relative. Prepend `/resource` when opening them through the resource proxy. diff --git a/scripts/cron/gliders/gliders_yearmaps.py b/scripts/cron/gliders/gliders_yearmaps.py index 8a32f7a..731975e 100644 --- a/scripts/cron/gliders/gliders_yearmaps.py +++ b/scripts/cron/gliders/gliders_yearmaps.py @@ -54,13 +54,26 @@ def valid_mission_path(name, path, metadata): path in {"/gliders/" + folder + "/latest.html" for folder in folders}) -def parse_yearmap(html, filename): - """Read the first mission-labelled rectangle; later links are not geometry. +def _mission_area(attrs, name, filename, metadata): + if attrs.get("shape", "").lower() != "rect": + raise ValueError("Unsupported mission area shape: " + name) + parts = re.split(r"[\s,]+", attrs.get("coords", "").strip()) + if len(parts) != 4 or any(not re.fullmatch(r"[+-]?[0-9]+", p) for p in parts): + raise ValueError("Malformed mission rectangle: " + name) + x1, y1, x2, y2 = rect = list(map(int, parts)) + if x1 >= x2 or y1 >= y2: + raise ValueError("Reversed or empty mission rectangle: " + name) + href = attrs.get("href", "") + if not re.fullmatch(r"(?:\.\./|/gliders/)[A-Za-z0-9_-]+/latest\.html", href): + raise ValueError("Unexpected mission link: " + name) + path = urljoin("/gliders/yearmaps/" + filename, href) + if not valid_mission_path(name, path, metadata): + raise ValueError("Unexpected mission link: " + name) + return rect, path - In the saved CSIRO sources the geographic rectangle precedes other links for - that mission. Mission labels (title or alt) and URL must agree. Panel - position is geographic eligibility, checked per mission when generating. SL*/SG* text links are excluded. No GIF or calendar data is read. - """ + +def parse_yearmap(html, filename): + """Read the geographic rectangle followed by plot rectangles for each mission.""" metadata = map_metadata(filename) if not re.search(r"\s*$", html, re.I): raise ValueError("Incomplete year-map HTML: " + filename) @@ -84,23 +97,18 @@ def parse_yearmap(html, filename): if len(labels) != 1: raise ValueError("Conflicting mission labels") name = labels.pop() - if name in deployments: + deployment = deployments.get(name) + try: + rect, path = _mission_area(attrs, name, filename, metadata) + except ValueError as error: + if deployment is None: + raise + LOG.warning("Skipping invalid plot area map=%s: %s", metadata["id"], error) continue - if attrs.get("shape", "").lower() != "rect": - raise ValueError("Unsupported mission area shape: " + name) - parts = re.split(r"[\s,]+", attrs.get("coords", "").strip()) - if len(parts) != 4 or any(not re.fullmatch(r"[+-]?[0-9]+", p) for p in parts): - raise ValueError("Malformed mission rectangle: " + name) - x1, y1, x2, y2 = rect = list(map(int, parts)) - if x1 >= x2 or y1 >= y2: - raise ValueError("Reversed or empty mission rectangle: " + name) - href = attrs.get("href", "") - if not re.fullmatch(r"(?:\.\./|/gliders/)[A-Za-z0-9_-]+/latest\.html", href): - raise ValueError("Unexpected mission link: " + name) - path = urljoin("/gliders/yearmaps/" + filename, href) - if not valid_mission_path(name, path, metadata): - raise ValueError("Unexpected mission link: " + name) - deployments[name] = dict(mission_name=name, pixel_rect=rect, bbox=None, url=path) + if deployment is None: + deployments[name] = dict(mission_name=name, pixel_rect=rect, bbox=None, url=path) + elif rect != deployment["pixel_rect"] and rect not in deployment.get("plot_pixel_rects", []): + deployment.setdefault("plot_pixel_rects", []).append(rect) return metadata, [deployments[name] for name in sorted(deployments)] diff --git a/scripts/cron/gliders/publish_gliders_yearmaps.py b/scripts/cron/gliders/publish_gliders_yearmaps.py index c145617..ce566a2 100644 --- a/scripts/cron/gliders/publish_gliders_yearmaps.py +++ b/scripts/cron/gliders/publish_gliders_yearmaps.py @@ -22,6 +22,10 @@ def require(condition, message): if not condition: raise ValueError(message) + def validate_rect(rect, field): + require(isinstance(rect, list) and len(rect) == 4 and all(type(v) is int for v in rect), "Invalid " + field) + require(rect[0] < rect[2] and rect[1] < rect[3], "Invalid rectangle extent") + require(isinstance(document, dict) and type(document.get("schema_version")) is int and document["schema_version"] == 1, "Expected schema_version == 1") maps = document.get("maps") @@ -42,9 +46,11 @@ def require(condition, message): name = deployment.get("mission_name") require(isinstance(name, str) and MISSION.fullmatch(name), "Invalid mission name") names.append(name) - rect = deployment.get("pixel_rect") - require(isinstance(rect, list) and len(rect) == 4 and all(type(v) is int for v in rect), "Invalid pixel_rect") - require(rect[0] < rect[2] and rect[1] < rect[3], "Invalid rectangle extent") + validate_rect(deployment.get("pixel_rect"), "pixel_rect") + plots = deployment.get("plot_pixel_rects", []) + require(isinstance(plots, list), "Invalid plot_pixel_rects") + for rect in plots: + validate_rect(rect, "plot_pixel_rects") require(valid_mission_path(name, deployment.get("url"), metadata), "Invalid deployment URL") require("bbox" in deployment, "Missing bbox") bbox = deployment["bbox"] diff --git a/scripts/cron/test_gliders_yearmaps.py b/scripts/cron/test_gliders_yearmaps.py index 5319de4..efe470a 100644 --- a/scripts/cron/test_gliders_yearmaps.py +++ b/scripts/cron/test_gliders_yearmaps.py @@ -34,6 +34,7 @@ def test_signed_legacy_rectangle_keeps_first_mission_area(self): self.assertEqual(len(deployments), 1) self.assertEqual(deployments[0]['pixel_rect'], list(map(int, re.split(r'[\s,]+', coords)))) + self.assertEqual(deployments[0]['plot_pixel_rects'], [[1231, 70, 1245, 95]]) self.assertEqual(deployments[0]['url'], '/gliders/TimorSea20181017a_4d/latest.html') self.assertIsNone(deployments[0]['bbox']) @@ -76,6 +77,7 @@ def test_saved_maps_separate_geography_calendar_and_labels(self): _, deployments = generator.parse_yearmap((FIXTURES / NAME).read_text(), NAME) esperance = next(d for d in deployments if d['mission_name'] == 'Esperance20260526_nrt') self.assertEqual(esperance['pixel_rect'], [204, 368, 232, 393]) + self.assertEqual(esperance['plot_pixel_rects'], [[997, 455, 1051, 486]]) self.assertEqual(esperance['url'], '/gliders/Esperance20260526_nrt_4d/latest.html') def test_malformed_incomplete_and_mismatched_html(self): @@ -98,16 +100,27 @@ def test_metadata_and_comma_separated_rectangles(self): with self.assertRaises(ValueError): generator.map_metadata(name) - def test_title_only_legacy_labels_and_ignored_non_geographic_areas(self): + def test_title_only_legacy_labels(self): for name in ['2018_sg_temp_04d.html', NAME]: html = (FIXTURES / name).read_text() expected = generator.parse_yearmap(html, name)[1] title_only = re.sub(r' alt="[^"]*"', '', html) self.assertEqual(generator.parse_yearmap(title_only, name)[1], expected) - # Neither non-geographic coordinates nor the displayed GIF participates in geometry. - html = html.replace('997 455 1051 486', 'not geographic coordinates') - html = html.replace('2026_sl_temp_nrt.gif', 'missing.gif') - self.assertEqual(generator.parse_yearmap(html, NAME)[1], expected) + + def test_invalid_plot_area_preserves_map_rectangle(self): + html = (FIXTURES / NAME).read_text() + plot_coords = '997 455 1051 486' + plot_link = f'{plot_coords}" href="../Esperance20260526_nrt_4d/latest.html"' + for original, replacement in ( + (plot_coords, 'not plot coordinates'), + (plot_link, plot_link.replace('Esperance20260526_nrt', 'other')), + ): + with self.subTest(replacement=replacement): + with self.assertLogs(generator.LOG, level='WARNING'): + _, deployments = generator.parse_yearmap(html.replace(original, replacement), NAME) + esperance = next(d for d in deployments if d['mission_name'] == 'Esperance20260526_nrt') + self.assertEqual(esperance['pixel_rect'], [204, 368, 232, 393]) + self.assertNotIn('plot_pixel_rects', esperance) class GeographyTests(unittest.TestCase): @@ -317,7 +330,8 @@ def test_publish_signed_legacy_rectangle_without_fabricated_bounds(self): legacy = next(m for m in result['maps'] if m['id'] == LEGACY_NAME[:-5]) self.assertEqual(legacy['deployments'], [dict( mission_name='TimorSea20181017a', pixel_rect=[268, -40, 289, -22], - bbox=None, url='/gliders/TimorSea20181017a_4d/latest.html')]) + bbox=None, url='/gliders/TimorSea20181017a_4d/latest.html', + plot_pixel_rects=[[1231, 70, 1245, 95]])]) self.assertIsNone(legacy['image_url']) self.assertEqual(json.loads(self.output.read_text()), result) # The signed rectangle is also accepted when validating the published baseline. @@ -336,7 +350,8 @@ def test_deterministic_unchanged_and_reference_json(self): expected_file = FIXTURES / 'expected.json' baseline = json.loads(expected_file.read_bytes()) for entry in baseline['maps']: - del entry['image_url'] + for deployment in entry['deployments']: + del deployment['plot_pixel_rects'] self.output.write_text(json.dumps(baseline)) self.publish() # The reference covers the additive image URLs, map/deployment order, links, and bounds. @@ -458,6 +473,8 @@ def test_configuration_and_schema_validation(self): lambda d: d['maps'].append(d['maps'][0]), lambda d: d['maps'][0].update(image_url='/gliders/yearmaps/2000_sg_temp.gif'), lambda d: d['maps'][0]['deployments'][0].update(pixel_rect=[1, 2, 0, 3]), + lambda d: d['maps'][0]['deployments'][0].update(plot_pixel_rects=[1, 2, 3, 4]), + lambda d: d['maps'][0]['deployments'][0].update(plot_pixel_rects=[[1, 2, 0, 3]]), lambda d: d['maps'][0]['deployments'][0].update(url='https://other/'), lambda d: d['maps'][0]['deployments'][0].update(bbox=[-200, -40, 120, -30])] for change in changes: diff --git a/scripts/cron/tests/mnt/oceancurrent/website/gliders/generators/gliders_yearmaps/expected.json b/scripts/cron/tests/mnt/oceancurrent/website/gliders/generators/gliders_yearmaps/expected.json index ede8ebf..def0a0e 100644 --- a/scripts/cron/tests/mnt/oceancurrent/website/gliders/generators/gliders_yearmaps/expected.json +++ b/scripts/cron/tests/mnt/oceancurrent/website/gliders/generators/gliders_yearmaps/expected.json @@ -24,7 +24,15 @@ 154.903689, -26.755541 ], - "url": "/gliders/Brisbane20180306A_4d/latest.html" + "url": "/gliders/Brisbane20180306A_4d/latest.html", + "plot_pixel_rects": [ + [ + 155, + 798, + 168, + 861 + ] + ] }, { "mission_name": "Brisbane20180306D", @@ -40,7 +48,15 @@ 156.019109, -26.225174 ], - "url": "/gliders/Brisbane20180306D_4d/latest.html" + "url": "/gliders/Brisbane20180306D_4d/latest.html", + "plot_pixel_rects": [ + [ + 155, + 693, + 234, + 757 + ] + ] }, { "mission_name": "Brisbane20180320A", @@ -56,7 +72,15 @@ 156.019109, -26.13678 ], - "url": "/gliders/Brisbane20180320A_4d/latest.html" + "url": "/gliders/Brisbane20180320A_4d/latest.html", + "plot_pixel_rects": [ + [ + 176, + 589, + 317, + 652 + ] + ] }, { "mission_name": "Brisbane20180320B", @@ -72,7 +96,15 @@ 156.120511, -26.225174 ], - "url": "/gliders/Brisbane20180320B_4d/latest.html" + "url": "/gliders/Brisbane20180320B_4d/latest.html", + "plot_pixel_rects": [ + [ + 176, + 484, + 285, + 547 + ] + ] } ] }, @@ -99,7 +131,15 @@ 138.81102, -34.539567 ], - "url": "/gliders/Adelaide20251128_4d/latest.html" + "url": "/gliders/Adelaide20251128_4d/latest.html", + "plot_pixel_rects": [ + [ + 1299, + 367, + 1328, + 377 + ] + ] }, { "mission_name": "BassStrait20250501", @@ -115,7 +155,15 @@ 147.305875, -38.889919 ], - "url": "/gliders/BassStrait20250501_4d/latest.html" + "url": "/gliders/BassStrait20250501_4d/latest.html", + "plot_pixel_rects": [ + [ + 957, + 482, + 992, + 500 + ] + ] }, { "mission_name": "BassStrait20250819", @@ -131,7 +179,15 @@ 147.383101, -39.079064 ], - "url": "/gliders/BassStrait20250819_4d/latest.html" + "url": "/gliders/BassStrait20250819_4d/latest.html", + "plot_pixel_rects": [ + [ + 1135, + 482, + 1177, + 501 + ] + ] }, { "mission_name": "Coffs20250717", @@ -147,7 +203,15 @@ 153.715629, -29.873972 ], - "url": "/gliders/Coffs20250717_4d/latest.html" + "url": "/gliders/Coffs20250717_4d/latest.html", + "plot_pixel_rects": [ + [ + 1081, + 214, + 1119, + 232 + ] + ] }, { "mission_name": "Esperance20250327", @@ -163,7 +227,15 @@ 123.983637, -33.719935 ], - "url": "/gliders/Esperance20250327_4d/latest.html" + "url": "/gliders/Esperance20250327_4d/latest.html", + "plot_pixel_rects": [ + [ + 900, + 329, + 929, + 340 + ] + ] }, { "mission_name": "Esperance20250924", @@ -179,7 +251,15 @@ 122.516344, -33.467741 ], - "url": "/gliders/Esperance20250924_4d/latest.html" + "url": "/gliders/Esperance20250924_4d/latest.html", + "plot_pixel_rects": [ + [ + 1194, + 329, + 1234, + 348 + ] + ] }, { "mission_name": "Forster20250225", @@ -195,7 +275,15 @@ 153.175048, -31.702381 ], - "url": "/gliders/Forster20250225_4d/latest.html" + "url": "/gliders/Forster20250225_4d/latest.html", + "plot_pixel_rects": [ + [ + 851, + 291, + 877, + 308 + ] + ] }, { "mission_name": "Forster20250507", @@ -211,7 +299,15 @@ 153.3295, -31.639332 ], - "url": "/gliders/Forster20250507_4d/latest.html" + "url": "/gliders/Forster20250507_4d/latest.html", + "plot_pixel_rects": [ + [ + 966, + 291, + 1015, + 303 + ] + ] }, { "mission_name": "Forster20250806", @@ -227,7 +323,15 @@ 153.175048, -31.639332 ], - "url": "/gliders/Forster20250806_4d/latest.html" + "url": "/gliders/Forster20250806_4d/latest.html", + "plot_pixel_rects": [ + [ + 1114, + 291, + 1156, + 305 + ] + ] }, { "mission_name": "MissionBeach20250110", @@ -243,7 +347,15 @@ 147.305875, -15.940237 ], - "url": "/gliders/MissionBeach20250110_4d/latest.html" + "url": "/gliders/MissionBeach20250110_4d/latest.html", + "plot_pixel_rects": [ + [ + 777, + 61, + 835, + 78 + ] + ] }, { "mission_name": "MissionBeach20250910", @@ -259,7 +371,15 @@ 147.151423, -17.13816 ], - "url": "/gliders/MissionBeach20250910_4d/latest.html" + "url": "/gliders/MissionBeach20250910_4d/latest.html", + "plot_pixel_rects": [ + [ + 1171, + 61, + 1208, + 75 + ] + ] }, { "mission_name": "MissionBeach20251121", @@ -275,7 +395,15 @@ 147.228649, -16.570723 ], - "url": "/gliders/MissionBeach20251121_4d/latest.html" + "url": "/gliders/MissionBeach20251121_4d/latest.html", + "plot_pixel_rects": [ + [ + 1288, + 61, + 1323, + 83 + ] + ] }, { "mission_name": "Ningaloo20250129", @@ -291,7 +419,15 @@ 115.33433, -20.858026 ], - "url": "/gliders/Ningaloo20250129_4d/latest.html" + "url": "/gliders/Ningaloo20250129_4d/latest.html", + "plot_pixel_rects": [ + [ + 808, + 138, + 826, + 158 + ] + ] }, { "mission_name": "Ningaloo20250402", @@ -307,7 +443,15 @@ 114.716522, -21.236317 ], - "url": "/gliders/Ningaloo20250402_4d/latest.html" + "url": "/gliders/Ningaloo20250402_4d/latest.html", + "plot_pixel_rects": [ + [ + 910, + 138, + 939, + 160 + ] + ] }, { "mission_name": "Onslow20250129", @@ -323,7 +467,15 @@ 115.33433, -20.794977 ], - "url": "/gliders/Onslow20250129_4d/latest.html" + "url": "/gliders/Onslow20250129_4d/latest.html", + "plot_pixel_rects": [ + [ + 808, + 100, + 817, + 122 + ] + ] }, { "mission_name": "Onslow20250225", @@ -339,7 +491,15 @@ 115.411556, -20.542783 ], - "url": "/gliders/Onslow20250225_4d/latest.html" + "url": "/gliders/Onslow20250225_4d/latest.html", + "plot_pixel_rects": [ + [ + 851, + 100, + 894, + 122 + ] + ] }, { "mission_name": "PortLincoln20250529", @@ -355,7 +515,15 @@ 137.498179, -34.350421 ], - "url": "/gliders/PortLincoln20250529_4d/latest.html" + "url": "/gliders/PortLincoln20250529_4d/latest.html", + "plot_pixel_rects": [ + [ + 1002, + 406, + 1039, + 420 + ] + ] }, { "mission_name": "PortLincoln20250924", @@ -371,7 +539,15 @@ 137.112049, -34.224324 ], - "url": "/gliders/PortLincoln20250924_4d/latest.html" + "url": "/gliders/PortLincoln20250924_4d/latest.html", + "plot_pixel_rects": [ + [ + 1194, + 406, + 1235, + 418 + ] + ] }, { "mission_name": "Portland20250312", @@ -387,7 +563,15 @@ 142.131736, -37.565899 ], - "url": "/gliders/Portland20250312_4d/latest.html" + "url": "/gliders/Portland20250312_4d/latest.html", + "plot_pixel_rects": [ + [ + 875, + 444, + 916, + 466 + ] + ] }, { "mission_name": "TasEastCoast20251022", @@ -403,7 +587,15 @@ 149.159298, -40.718327 ], - "url": "/gliders/TasEastCoast20251022_4d/latest.html" + "url": "/gliders/TasEastCoast20251022_4d/latest.html", + "plot_pixel_rects": [ + [ + 1239, + 520, + 1276, + 543 + ] + ] }, { "mission_name": "TwoRocks20250123", @@ -419,7 +611,15 @@ 116.10659, -30.126167 ], - "url": "/gliders/TwoRocks20250123_4d/latest.html" + "url": "/gliders/TwoRocks20250123_4d/latest.html", + "plot_pixel_rects": [ + [ + 798, + 253, + 848, + 275 + ] + ] }, { "mission_name": "TwoRocks20250219", @@ -435,7 +635,15 @@ 116.10659, -30.630555 ], - "url": "/gliders/TwoRocks20250219_4d/latest.html" + "url": "/gliders/TwoRocks20250219_4d/latest.html", + "plot_pixel_rects": [ + [ + 842, + 253, + 887, + 267 + ] + ] }, { "mission_name": "TwoRocks20250515", @@ -451,7 +659,15 @@ 116.10659, -31.071895 ], - "url": "/gliders/TwoRocks20250515_4d/latest.html" + "url": "/gliders/TwoRocks20250515_4d/latest.html", + "plot_pixel_rects": [ + [ + 980, + 254, + 991, + 263 + ] + ] }, { "mission_name": "TwoRocks20250812", @@ -467,7 +683,15 @@ 116.10659, -31.071895 ], - "url": "/gliders/TwoRocks20250812_4d/latest.html" + "url": "/gliders/TwoRocks20250812_4d/latest.html", + "plot_pixel_rects": [ + [ + 1124, + 253, + 1147, + 265 + ] + ] }, { "mission_name": "TwoRocks20251028", @@ -483,7 +707,15 @@ 116.10659, -31.008847 ], - "url": "/gliders/TwoRocks20251028_4d/latest.html" + "url": "/gliders/TwoRocks20251028_4d/latest.html", + "plot_pixel_rects": [ + [ + 1249, + 253, + 1278, + 275 + ] + ] }, { "mission_name": "Weipa20251024", @@ -499,7 +731,15 @@ 142.05451, -12.157322 ], - "url": "/gliders/Weipa20251024_4d/latest.html" + "url": "/gliders/Weipa20251024_4d/latest.html", + "plot_pixel_rects": [ + [ + 1242, + 23, + 1279, + 38 + ] + ] }, { "mission_name": "Yamba20251113", @@ -515,7 +755,15 @@ 154.024533, -28.928244 ], - "url": "/gliders/Yamba20251113_4d/latest.html" + "url": "/gliders/Yamba20251113_4d/latest.html", + "plot_pixel_rects": [ + [ + 1275, + 176, + 1315, + 188 + ] + ] } ] }, @@ -542,7 +790,15 @@ 153.169572, -21.864914 ], - "url": "/gliders/CapricornChannel20260723_nrt_4d/latest.html" + "url": "/gliders/CapricornChannel20260723_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1091, + 134, + 1127, + 166 + ] + ] }, { "mission_name": "Ceduna20260924_nrt", @@ -558,7 +814,15 @@ 133.095015, -31.446512 ], - "url": "/gliders/Ceduna20260924_nrt_4d/latest.html" + "url": "/gliders/Ceduna20260924_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1194, + 348, + 1234, + 371 + ] + ] }, { "mission_name": "Esperance20260526_nrt", @@ -574,7 +838,15 @@ 123.212157, -33.463691 ], - "url": "/gliders/Esperance20260526_nrt_4d/latest.html" + "url": "/gliders/Esperance20260526_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 997, + 455, + 1051, + 486 + ] + ] }, { "mission_name": "Forster20260909_nrt", @@ -590,7 +862,15 @@ 153.246782, -31.69866 ], - "url": "/gliders/Forster20260909_nrt_4d/latest.html" + "url": "/gliders/Forster20260909_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1169, + 295, + 1177, + 324 + ] + ] }, { "mission_name": "ForsterA20260909_nrt", @@ -606,7 +886,15 @@ 153.246782, -31.69866 ], - "url": "/gliders/ForsterA20260909_nrt_4d/latest.html" + "url": "/gliders/ForsterA20260909_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1169, + 402, + 1208, + 426 + ] + ] }, { "mission_name": "Groote_Eylandt20261027_nrt", @@ -622,7 +910,15 @@ 137.804815, -13.228868 ], - "url": "/gliders/Groote_Eylandt20261027_nrt_4d/latest.html" + "url": "/gliders/Groote_Eylandt20261027_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1247, + 28, + 1257, + 43 + ] + ] }, { "mission_name": "MissionBeach20261022_nrt", @@ -638,7 +934,15 @@ 147.069995, -17.137151 ], - "url": "/gliders/MissionBeach20261022_nrt_4d/latest.html" + "url": "/gliders/MissionBeach20261022_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1239, + 81, + 1257, + 99 + ] + ] }, { "mission_name": "TasEastCoast20260811_nrt", @@ -654,7 +958,15 @@ 149.154661, -40.775964 ], - "url": "/gliders/TasEastCoast20260811_nrt_4d/latest.html" + "url": "/gliders/TasEastCoast20260811_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1122, + 508, + 1164, + 539 + ] + ] }, { "mission_name": "TasEastCoast20260922_nrt", @@ -670,7 +982,15 @@ 149.077451, -40.712927 ], - "url": "/gliders/TasEastCoast20260922_nrt_4d/latest.html" + "url": "/gliders/TasEastCoast20260922_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1190, + 508, + 1234, + 528 + ] + ] }, { "mission_name": "TwoRocks20260730_nrt", @@ -686,7 +1006,15 @@ 116.108852, -31.068291 ], - "url": "/gliders/TwoRocks20260730_nrt_4d/latest.html" + "url": "/gliders/TwoRocks20260730_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1103, + 241, + 1134, + 259 + ] + ] }, { "mission_name": "TwoRocks20261028_nrt", @@ -702,7 +1030,15 @@ 116.108852, -31.194365 ], - "url": "/gliders/TwoRocks20261028_nrt_4d/latest.html" + "url": "/gliders/TwoRocks20261028_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1249, + 242, + 1257, + 252 + ] + ] }, { "mission_name": "TwoRocksA20260910_nrt", @@ -718,7 +1054,15 @@ 116.108852, -31.068291 ], - "url": "/gliders/TwoRocksA20260910_nrt_4d/latest.html" + "url": "/gliders/TwoRocksA20260910_nrt_4d/latest.html", + "plot_pixel_rects": [ + [ + 1171, + 188, + 1187, + 201 + ] + ] } ] } From 29033a4033c0db664ac9f40ae832897d5d36fef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Rodr=C3=ADguez?= <36035218+grojeda@users.noreply.github.com> Date: Mon, 23 Nov 2026 10:18:04 +1100 Subject: [PATCH 2/2] test: cover older Gliders yearmap publications --- scripts/cron/test_gliders_yearmaps.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/cron/test_gliders_yearmaps.py b/scripts/cron/test_gliders_yearmaps.py index efe470a..94f31eb 100644 --- a/scripts/cron/test_gliders_yearmaps.py +++ b/scripts/cron/test_gliders_yearmaps.py @@ -347,16 +347,19 @@ def test_publish_signed_legacy_rectangle_without_fabricated_bounds(self): def test_deterministic_unchanged_and_reference_json(self): (self.source / 'index.html').write_text('Directory listing') - expected_file = FIXTURES / 'expected.json' - baseline = json.loads(expected_file.read_bytes()) - for entry in baseline['maps']: - for deployment in entry['deployments']: - del deployment['plot_pixel_rects'] - self.output.write_text(json.dumps(baseline)) - self.publish() - # The reference covers the additive image URLs, map/deployment order, links, and bounds. - expected = expected_file.read_bytes() - self.assertEqual(self.output.read_bytes(), expected) + expected = (FIXTURES / 'expected.json').read_bytes() + for has_image_url in (False, True): + with self.subTest(has_image_url=has_image_url): + baseline = json.loads(expected) + for entry in baseline['maps']: + if not has_image_url: + del entry['image_url'] + for deployment in entry['deployments']: + del deployment['plot_pixel_rects'] + self.output.write_text(json.dumps(baseline)) + self.publish() + self.assertEqual(self.output.read_bytes(), expected) + previous = self.output.stat() self.publish() self.assertEqual(self.output.read_bytes(), expected)