Diffuser la qualité des dalles dans l'inventaire et la conserver sur la carte légère

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Antoine Jacquin
2026-09-27 15:29:06 +02:00
parent 473097257e
commit 3b4d106cc2
4 changed files with 58 additions and 0 deletions

View File

@ -653,3 +653,15 @@ def test_urls_versioned_by_served_file_mtime(tmp_path):
url_after = tiles05b[0]['viz']['hillshade_multi']['thumb']
assert url_after.split('?')[0] == url_before.split('?')[0]
assert url_after != url_before
def test_inventory_contains_quality_table(tmp_path):
import json
from lidar_pipeline.index import build_index
from lidar_pipeline.quality import write_quality
from lidar_pipeline.tests.test_tiles import _make_dalle
base = _make_dalle(tmp_path, 1054, 6882, ["relief_oriente"])
write_quality(tmp_path, base, {"version": 1, "ground_density": 7.5})
build_index(tmp_path, "webp")
inv = json.loads((tmp_path / "index_tiles.json").read_text(encoding="utf-8"))
assert inv["quality"] == {base: {"version": 1, "ground_density": 7.5}}

View File

@ -712,3 +712,20 @@ def test_webp_subtiles_indexed_and_rendered_nearest(tmp_path):
assert img is not None
grays = {p[0] for p in img.getdata() if p[3] == 255}
assert grays <= {0, 255} # aucun gris intermédiaire inventé
def test_remote_quality_persisted_locally(tmp_path, monkeypatch):
"""La table qualité amont est recopiée en sidecars locaux (Pi autonome)."""
from lidar_pipeline import tiles
from lidar_pipeline.quality import read_quality
payload = _remote_payload()
base = "LHD_FXX_1054_6882_PTS_LAMB93_IGN69"
payload["quality"] = {base: {"version": 1, "ground_density": 3.0},
"../evasion": {"version": 1}}
monkeypatch.setattr(tiles, "REMOTE_SOURCE_URL", "http://amont")
monkeypatch.setattr(tiles, "_remote_payload", lambda force=False: payload)
monkeypatch.setattr(tiles, "_remote_cache", dict(tiles._remote_cache, index=None, built=None))
tiles._remote_index(tmp_path, force=True)
assert read_quality(tmp_path, base) == {"version": 1, "ground_density": 3.0}
assert not (tmp_path / "evasion.json").exists()
assert list((tmp_path / "quality").iterdir()) == [tmp_path / "quality" / f"{base}.json"]