Skip to content

The OSINT investigator's workbench. One case, one folder, every tool. Local-first: your media and your investigations never leave your machine.

JavaScript

Hold a calm sea to the radar's noise, fix the burn example's surf, and let Compare shapes pan and open the point menu (#86)

OsintMeThat840561611228
diff --git a/.gitignore b/.gitignore
index 0e7535f..e681864 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,6 +55,9 @@ AGENTS.md
.agents/
.cheatsheet
+# Audit reports: working documents, deleted once their items are fixed
+docs/audit*.md
+
# PyInstaller local output
dist-bin/
build-bin/
diff --git a/README.md b/README.md
index 03bd920..94636f5 100644
--- a/README.md
+++ b/README.md
@@ -88,15 +88,21 @@ Detect sweeps an area for what appeared, and the map takes layers made elsewhere
- Radar: five Sentinel-1 analyzers (vessels, any change, razed buildings, new
structures, floods) see through cloud and at night, and Sentinel-1 passes are a
basemap in Satellite, Compare and Detect.
+- Build your own analyzer from rules on bands, indices, ground classes or radar,
+ with checks that turn red when a rule stops holding. Five examples ship with
+ theirs.
- A candidate opens in Compare with one press, and All dates in Compare narrows
down between which two pictures a change appeared.
+- Satellite, Compare and Detect share one camera, and a middle-drag turns any map.
+- Inspect keeps one work per file, saved as you go, and Collage is a tab of its own.
- Open KML, KMZ, GeoJSON and GPX files or a public My Maps as map layers, and add
a GeoConfirmed conflict. A dated layer narrows to a period.
- Proofs turn and crop their images, stamp numbered markers and blur boxes, and
carry a sentence and the date their material was taken.
- To-do lists on Home, one date field across the app, a claim filed from where
you are, and Reverse Search from a Media Library row or an Inspect frame.
-- Existing cases open unchanged, and older bundles still import.
+- Existing cases open as they are, with 0.3.0 Inspect sessions merged into one
+ work per file, and older bundles still import.
## Cases on disk
diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md
index 365f784..d8c6cfe 100644
--- a/docs/RELEASE_NOTES.md
+++ b/docs/RELEASE_NOTES.md
@@ -3,22 +3,33 @@
Azimut is a local OSINT workspace: media, geolocation work, proofs and notes in
one portable case folder, on your own machine.
-This release sweeps an area for what appeared, and puts maps made
-elsewhere on yours.
+This release sweeps an area for what appeared, by day or by radar, and puts
+maps made elsewhere on yours.
## Detect
- **Detect** is a new tab under Map. Draw one or more areas on
Sentinel-2 and it sweeps them at full resolution for vessels, fires and gas
flares, construction, small spots, any surface change, burn scars, vegetation
- loss or new water. You can also copy an analyzer and tune your own.
+ loss or new water.
+- Five radar analyzers read Sentinel-1 through cloud and at night: vessels, any
+ change, damaged or razed buildings, new structures and vehicles, and floods.
+ They use a Sentinel-1 layer you add to your Copernicus configuration, and
+ Settings → Imagery walks you through it.
+- **Build your own analyzer** from up to six rules on a band, an index, a ground
+ class or radar, and watch what each rule keeps on the map as you change it.
+ Checks are places you trust, pinned as "should be found" or "should stay
+ empty", and they turn red when a rule stops holding. Five examples ship with
+ their checks: Lahaina, Grünheide, Kakhovka, Dubai and Fujairah.
- Ask for a small, medium or large target instead of setting thresholds. The
areas are priced in Copernicus requests before anything is fetched.
- **Find passes** lists the dates your areas really have, with how much of them
each pass covered and how cloudy it was. A finished run says how much it read,
so "nothing found" and "never looked" stay apart.
-- Candidates come strongest first, one at a time. **Keep as a pin** files one
- with its own evidence crop; nothing else reaches the case.
+- Candidates come strongest first, one at a time, sized along their footprint.
+ **Keep as a pin** files one with its own evidence crop and a claim dated by the
+ passes that found it; nothing else reaches the case.
+- A candidate opens in Compare on the passes that found it.
- Areas can be saved with the case. A watch keeps an analyzer, its areas and a
date rule together, and **Run again** repeats the sweep.
- Detect needs Copernicus credentials in Settings.
@@ -27,6 +38,12 @@ elsewhere on yours.
- Compare opens on a Wayback release from a year ago against today's World
Imagery, with no key needed. **New** offers the other starting pairs.
+- **All dates** lists every dated picture of the point and narrows down, a
+ question at a time, between which two a change appeared.
+- Sentinel-1 radar passes are a basemap in Satellite, Compare and Detect, named
+ by day, UTC time and direction.
+- A saved comparison stands on the map beside the captures, dated A → B, and
+ reopens in Compare.
- "Change assist" is now **Difference**. Its cloud switch uses the same
Sentinel-2 cloud and shadow mask as Detect instead of guessing from the
picture, so a white roof is no longer taken for a cloud.
@@ -36,7 +53,9 @@ elsewhere on yours.
- Difference is a switch beside the four views rather than a view of its own:
its highlights lie over side by side, swipe, fade or blink, on A, B or both.
They can blink.
-- Right-click the ground for the point menu.
+- Right-click the ground, or a shape drawn on it, for the point menu. A drag
+ inside a box, an ellipse or a polygon moves the map; a shape is picked by its
+ outline.
- Right-click a point on the Satellite map to open Compare on its last two
Wayback pictures or its last two Copernicus passes.
- An export frame sets what an export shows. Numbered markers and blur boxes can
@@ -47,6 +66,15 @@ elsewhere on yours.
- Difference's settings stay put through a read, lie over the highlights, and
close on a click outside them.
+## One camera for the maps
+
+- Satellite, Compare and Detect show the same ground: pan one and the others are
+ there when you switch. A link carries it to other windows. A Detect review and
+ an open saved comparison keep their own view, and Settings → General turns
+ the sharing off.
+- A middle-drag turns any map, or an Inspect frame, about the point you grabbed,
+ in 15° steps with Ctrl. A middle click or Shift+↑ puts north back.
+
## Layers from elsewhere
- Open a KML, KMZ, GeoJSON or GPX file as a map layer, or follow a public Google
@@ -77,6 +105,17 @@ elsewhere on yours.
- Place any point of a proof on a map instead of typing it. Each panel keeps its
own point.
+## Inspect and Collage
+
+- Inspect keeps one work per file, saved as you go, with its frames on a strip.
+ There are no sessions to open or save. **Save to case** is still the only step
+ that files a frame or an adjusted video as media.
+- **Collage** is a tab of its own. It lays out frames and images from any number
+ of files, and the picture it exports is case media.
+- The file name in Inspect's header renames the media itself.
+- The first time a case opens, its 0.3.0 Inspect sessions of one file become one
+ work: the latest is kept, and the others' notes and names are carried into it.
+
## Elsewhere
- **To-do lists** on Home: named lists of tasks with a progress count, saved with
@@ -125,5 +164,6 @@ update it from Settings → Capture extension. Firefox updates the signed add-on
itself; a new install uses `azimut-capture-0.3.1.xpi` attached to this release,
opened from `about:addons` → gear menu → **Install Add-on From File**.
-Your existing cases open as they are. No export, migration or manual step is
-needed, and older case bundles still import.
+Your existing cases open as they are. Apart from Inspect sessions becoming one
+work per file, nothing changes in them, no export or manual step is needed, and
+older case bundles still import.
diff --git a/docs/SPEC.md b/docs/SPEC.md
index 8935278..a791e00 100644
--- a/docs/SPEC.md
+++ b/docs/SPEC.md
@@ -330,6 +330,7 @@ stops making sense.
- **Radar damage from a stack of passes:** the pixel-wise t-test (PWTT) over a year of passes before and weeks after, which two passes cannot match.
- **Oil slicks by radar:** dark patches on the sea near anchorages and lanes, which Sentinel-1 shows through cloud.
- **Map files out of the case:** export pins, claims and Detect findings as KML or GeoJSON, with TimeStamp and TimeSpan so another viewer's time slider reads them.
+- **Update ffmpeg from the app:** download a static build into the workspace and prefer it at runtime, like the scraper update, if the bundled copy ever lags in a way users hit.
- **A deleted case waits before it is gone:** artifacts, entities and bulk deletes are all recoverable, while removing a case is the one act with no way back and only a typed DELETE in front of it. Move the folder aside instead, and empty it later.
## 8. Explicit non-goals
diff --git a/docs/UI.md b/docs/UI.md
index 78f95d4..f00c415 100644
--- a/docs/UI.md
+++ b/docs/UI.md
@@ -1399,7 +1399,9 @@ and keeps the bearing it was drawn at. Any selected shape but a note or a stamp
also shows a round grip above it: drag it to turn the shape about its centre,
with Shift snapping to 15°.
Every mark carries a wide invisible band along its outline, because a four-pixel
-arrow is a target nobody hits twice. The wheel still belongs to the map wherever
+arrow is a target nobody hits twice. That band is how a box, an ellipse or a
+polygon is picked and moved: its middle belongs to the map, filled or not, so a
+drag inside one pans the imagery under it. The wheel still belongs to the map wherever
the pointer is: the marks are drawn over it rather than in it, and a zoom that
stopped on whatever had been drawn read as a map that had frozen. Clicking the ground beside a mark lets it go;
dragging the map is a pan and keeps it. The tool rail packs into two columns, like
@@ -1409,8 +1411,8 @@ and with the button behind them when the selection is dropped. **Pressing the to
already in hand puts it down** and gives the cursor back, on this rail and on Proof
Maker's: the way out of a drawing tool is the button you are already on.
-**Right-click the ground** here too, on either map, for the acts Compare can
-honour: copy the point in every coordinate format, ask what is there, save a
+**Right-click the ground** here too, on either map and on any mark drawn on it,
+for the acts Compare can honour: copy the point in every coordinate format, ask what is there, save a
place there, start a distance measure from it — the annotation of the same
name, anchored on the point and closed by the next click — or open it in
Satellite or Detect. The rows Satellite offers for its own rails are left out
diff --git a/frontend/e2e/compare.spec.js b/frontend/e2e/compare.spec.js
index 3526e8e..5a40c20 100644
--- a/frontend/e2e/compare.spec.js
+++ b/frontend/e2e/compare.spec.js
@@ -328,6 +328,46 @@ test('on a turned map a box runs along the screen, and turns from its grip', asy
expect(errors).toEqual([]);
});
+test('a drag inside a box pans the map, and a right-click on the box opens its point menu', async ({ page }) => {
+ const { errors } = await openCompare(page);
+ const canvas = page.getByLabel('Annotations on imagery A', { exact: true });
+ const box = await canvas.boundingBox();
+ const cx = box.x + box.width / 2;
+ const cy = box.y + box.height / 2;
+ // A marker off to the side stays on the ground, so it tells whether the map moved.
+ await page.getByTitle('Numbered marker (N)', { exact: true }).click();
+ await page.mouse.click(cx + 200, cy + 120);
+ await page.getByTitle('Box (R)', { exact: true }).click();
+ await page.mouse.move(cx - 100, cy - 60);
+ await page.mouse.down();
+ await page.mouse.move(cx + 100, cy + 60, { steps: 6 });
+ await page.mouse.up();
+
+ const outline = canvas.locator('.mark > path.body');
+ const numeral = canvas.locator('.numeral');
+ const markerAt = async () => [Number(await numeral.getAttribute('x')), Number(await numeral.getAttribute('y'))];
+ const boxBefore = cornersOf(await outline.getAttribute('d'));
+ const markerBefore = await markerAt();
+
+ // Well inside the box, away from its outline: the drag is the map's.
+ await page.mouse.move(cx - 20, cy);
+ await page.mouse.down();
+ await page.mouse.move(cx + 40, cy + 30, { steps: 8 });
+ await page.mouse.up();
+ await expect.poll(async () => (await markerAt())[0] - markerBefore[0]).toBeGreaterThan(30);
+ const markerAfter = await markerAt();
+ const boxAfter = cornersOf(await outline.getAttribute('d'));
+ // The box went with the ground and no further: it was not picked up.
+ expect(boxAfter[0][0] - boxBefore[0][0]).toBeCloseTo(markerAfter[0] - markerBefore[0], 0);
+ expect(boxAfter[0][1] - boxBefore[0][1]).toBeCloseTo(markerAfter[1] - markerBefore[1], 0);
+
+ // Its outline answers a right-click with the menu of the point under it.
+ const [left, right] = [boxAfter[0], boxAfter[1]];
+ await page.mouse.click(box.x + (left[0] + right[0]) / 2, box.y + (left[1] + right[1]) / 2, { button: 'right' });
+ await expect(page.getByRole('menu', { name: 'This point' })).toBeVisible();
+ expect(errors).toEqual([]);
+});
+
test('the export frame keeps its shape when the camera turns, and still exports', async ({ page }) => {
// Tall enough for the frame's four corners to stay in view once it is turned.
await page.setViewportSize({ width: 1600, height: 1100 });
diff --git a/frontend/src/tools/Compare.svelte b/frontend/src/tools/Compare.svelte
index 62f2d97..83fc6c0 100644
--- a/frontend/src/tools/Compare.svelte
+++ b/frontend/src/tools/Compare.svelte
@@ -1500,6 +1500,24 @@
};
}
+ /**
+ * A right-click on a mark opens the point menu under it, as on bare ground.
+ *
+ * Marks are drawn beside the map element rather than inside it, so the
+ * engine never hears a press on one, and the browser's own menu opened over
+ * the shape instead.
+ */
+ function onOverlayMenu(side, event) {
+ const { engine, element } = side === 'a' ? a : b;
+ if (!engine || !element || !event.target?.closest?.('.annotation-canvas')) return;
+ event.preventDefault();
+ const box = element.getBoundingClientRect();
+ const x = event.clientX - box.left;
+ const y = event.clientY - box.top;
+ const at = engine.containerPointToLatLng({ x, y });
+ onMapContextMenu(side, { lat: at.lat, lon: ((at.lon + 540) % 360) - 180, x, y });
+ }
+
function closePointMenu() {
pointLookupSeq += 1;
pointMenu = null;
@@ -2102,7 +2120,8 @@
bind:this={stageEl}
>
{#if a.present && home}
- <div class="surface-shell primary">
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
+ <div class="surface-shell primary" oncontextmenu={(event) => onOverlayMenu('a', event)}>
<div class="surface-label"><strong>A</strong></div>
<MapSurface
bind:this={a.surface}
@@ -2193,9 +2212,11 @@
{/if}
{#if b.present && home}
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="surface-shell secondary"
class:blink-hidden={mode === 'blink' && !blinkB}
+ oncontextmenu={(event) => onOverlayMenu('b', event)}
>
<div class="surface-label"><strong>B</strong></div>
<MapSurface
diff --git a/frontend/src/tools/compare/AnnotationCanvas.svelte b/frontend/src/tools/compare/AnnotationCanvas.svelte
index 45b312f..658f00d 100644
--- a/frontend/src/tools/compare/AnnotationCanvas.svelte
+++ b/frontend/src/tools/compare/AnnotationCanvas.svelte
@@ -357,13 +357,13 @@
<rect class="hit" x={box.x} y={box.y} width={box.size} height={box.size} fill="transparent" />
{/if}
{:else if mark.kind !== 'text'}
- <path d={pathOf(shape)} stroke={mark.colour} stroke-width={mark.stroke_width}
+ <path class="body" d={pathOf(shape)} stroke={mark.colour} stroke-width={mark.stroke_width}
fill={shape.closed ? mark.colour : 'none'} fill-opacity={mark.fill_opacity}
stroke-dasharray={mark.kind === 'measure' ? '8 6' : undefined} />
<!-- A band along the outline, wide enough to hit: a 4px arrow is a
- target nobody can reliably click twice. For an area it is the only
- target, its middle belonging to the map so dragging inside one pans
- as it would anywhere else. -->
+ target nobody can reliably click twice. It is a box's, an ellipse's
+ or a polygon's only target: the middle belongs to the map, so
+ dragging inside one pans as it would anywhere else, filled or not. -->
<path class="edge" d={pathOf(shape)} fill="none" stroke="transparent"
stroke-width={Math.max(16, mark.stroke_width * 4)} />
{#if shape.head}<polygon points={shape.head.map((p) => p.join(',')).join(' ')} fill={mark.colour} />{/if}
@@ -410,10 +410,11 @@
.annotation-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 550; pointer-events: none; overflow: hidden; }
.annotation-canvas.drawing { pointer-events: auto; cursor: crosshair; touch-action: none; }
.mark { pointer-events: visiblePainted; cursor: move; }
+ .mark .body { pointer-events: visibleStroke; }
.mark .edge { pointer-events: stroke; cursor: move; }
.mark .hit { pointer-events: all; cursor: move; }
.mark.area { pointer-events: none; }
- .drawing .mark, .drawing .mark .edge { pointer-events: none; }
+ .drawing .mark, .drawing .mark .body, .drawing .mark .edge { pointer-events: none; }
.vertex { pointer-events: auto; cursor: crosshair; }
.vertex .grip { pointer-events: all; }
.turn { pointer-events: auto; cursor: grab; }
diff --git a/src/azimut/engine/analysis_examples.py b/src/azimut/engine/analysis_examples.py
index f330f03..53f3fe0 100644
--- a/src/azimut/engine/analysis_examples.py
+++ b/src/azimut/engine/analysis_examples.py
@@ -8,8 +8,10 @@ of its rules is there to turn away, so removing that rule turns the check red.
Every pass, mark and line here was read on the real scenes (2026-09-24), from
Sentinel-2 Level-2A laid out as Detect's band evalscript returns it, through
-this engine's own `detect_rules.check`. Marks sit at least 64 pixels inside the
-grid tile they fall in, since a check reads each mark on its own tile.
+this engine's own `detect_rules.check`, then every check was run again through
+Copernicus itself, which is what an analyst's run reads. Marks sit at least 64
+pixels inside the grid tile they fall in, since a check reads each mark on its
+own tile.
"""
from __future__ import annotations
@@ -50,15 +52,17 @@ def _example(ident: str, place: str, when: str, size: str, **fields: Any) -> Exa
EXAMPLES: list[Example] = [
# The Lahaina fire of 8 August 2023. A is that morning's pass, before the
# town burned. Without the second rule a cloud the mask missed reads as a
- # burn; without the third the surf on the reef does.
+ # burn; without the third the surf on the reef does. That rule reads near
+ # infrared rather than the scene classification, which Copernicus left
+ # unclassified under the surf that morning.
_example(
"burn", "Lahaina, Maui", "August 2023", "medium",
name="Fresh burn", phenomenon="Fresh burn", colour="#ef4444",
- description="The burn ratio dropped and ended low, on ground that was not water. "
- "A field harvested between the passes can look the same.",
+ description="The burn ratio dropped and ended low, on ground brighter than water in "
+ "near infrared. A field harvested between the passes can look the same.",
rules=[Rule(measure="index", index="nbr", on="change", op="le", value=-0.2),
Rule(measure="index", index="nbr", on="b", op="le", value=0.1),
- Rule(measure="class", classes=["water"], on="a", op="not")],
+ Rule(measure="band", band="B08", on="b", op="ge", value=0.04)],
checks=_checks(
"2023-08-08", "2023-08-13", "SWIR",
("town", "The town and hills that burned", (-156.68747, 20.86409, -156.66278, 20.90174),
diff --git a/src/azimut/engine/analyzers.py b/src/azimut/engine/analyzers.py
index e08f06b..f4cb74b 100644
--- a/src/azimut/engine/analyzers.py
+++ b/src/azimut/engine/analyzers.py
@@ -72,7 +72,7 @@ PAD = 32
# Bumped when a product's layout changes, so a frame kept from an older run is
# never decoded as a newer one.
PRODUCT_VERSION = 2
-ENGINE_VERSION = 3
+ENGINE_VERSION = 4
LOCK = threading.RLock()
KINDS = {"areas": "analysis-area", "zones": "analysis-zones", "followups": "analysis-follow-up", "runs": "analysis-run"}
ACTIVE = {"queued", "running"}
@@ -179,7 +179,7 @@ DARK_ABSENT = frozenset({"nbr"})
# the May 2023 Emilia-Romagna floods, and Gaza City before and after late 2023.
#
# What is sea. Windy sea rose to -11 dB in VV in the North Sea storm, above
-# farmland's -10, so VV alone called it land; cross-pol stayed near -24 dB on
+# farmland's -10, so VV alone called it land; cross-pol stayed below -24 dB on
# every sea and between -12 and -18 on vegetated land. Dry desert is as dark as
# calm sea in both, and at Port Sudan the radar alone put 72 candidates on the
# town and the sand around it. So the sea is first what Sentinel-2's own scene
@@ -196,6 +196,18 @@ SEA_VH_DB = -21.0
# azimuth, the streaks turning blades smear, and sea spikes answer in VV alone.
# In the Singapore anchorage every hull cleared VH by 8 dB, those ghosts 4 to 7.
VH_GAP = 2.0
+# The sea is never measured as quieter than the radar's own noise. Sentinel-1's
+# noise floor in this mode is specified at -22 dB at worst and sits a few dB
+# lower mid-swath. Below it the processing takes the noise out, and calm water,
+# like cross-pol on most seas, reads as low as the product's -35 dB floor.
+# Measured against that, a return at -25 dB, which is noise, cleared the line:
+# off Fujairah, on a calm morning with a hundred tankers at anchor, the faint
+# copies each hull leaves along the track came back as 29 vessels. With the
+# background held at -24 dB they went, as did the pale streaks off Dover,
+# Singapore and Port Sudan's reefs, and no hull was lost there, in the Bandar
+# Abbas anchorage or among the Belgian turbines. At -22 dB small ships began
+# to go; at -26 dB a streak came back.
+SAR_NOISE_DB = -24.0
# A weak return within 400 m of one 6 dB stronger is that one's sidelobe or
# ghost: it cut the Belgian wind farms from 1,043 candidates to about one a
# turbine, and cost the anchorage no hull.
@@ -985,10 +997,11 @@ def _sar_vessels(product: Any, water: Any, inside: Any, metres: float,
"""Hulls: a strong return standing out of the sea around it.
Each pixel is measured against a ring of sea with a hole in the middle, the
- ring the optical detector uses, in decibels above the ring's mean power. It
- has to clear the line in VV and come close in VH, and not sit in the
- shadow of a much stronger return. `water` is Sentinel-2's classification,
- or None where the sweep could not read it.
+ ring the optical detector uses, in decibels above the ring's mean power or
+ the radar's noise floor, whichever is louder. It has to clear the line in VV
+ and come close in VH, and not sit in the shadow of a much stronger return.
+ `water` is Sentinel-2's classification, or None where the sweep could not
+ read it.
"""
import cv2
import numpy as np
@@ -1008,7 +1021,8 @@ def _sar_vessels(product: Any, water: Any, inside: Any, metres: float,
decibels = sentinel.sar_decibels(level.astype(np.float64))
power = np.where(data, 10.0 ** (decibels / 10.0), 0.0)
mean, _, share = ring_statistics(power, sea, VESSEL_RING, VESSEL_GUARD)
- return np.where(share > 0, decibels - 10.0 * np.log10(np.maximum(mean, 1e-9)), 0.0), share
+ background = np.maximum(mean, 10.0 ** (SAR_NOISE_DB / 10.0))
+ return np.where(share > 0, decibels - 10.0 * np.log10(background), 0.0), share
vv, share = contrast(product[:, :, 0])
vh, _ = contrast(product[:, :, 1])
diff --git a/tests/test_detect_rules.py b/tests/test_detect_rules.py
index b8d7147..ca495a9 100644
--- a/tests/test_detect_rules.py
+++ b/tests/test_detect_rules.py
@@ -16,7 +16,7 @@ from PIL import Image
from pydantic import ValidationError
from azimut import config
-from azimut.engine import analysis_geometry, analyzers, detect_rules, sentinel, tilecache, workqueue
+from azimut.engine import analysis_examples, analysis_geometry, analyzers, detect_rules, sentinel, tilecache, workqueue
from azimut.engine.analysis_models import (
BUILTINS,
MAX_BANDS,
@@ -33,7 +33,7 @@ from azimut.engine.analysis_models import (
recipe_products,
)
from azimut.workspace import Case
-from analyzerfixture import BARE, CLOUD, DARK, EDGE, SENTINEL_TILE, VEGETATION, WATER, at, put_picture, zone
+from analyzerfixture import BARE, CLOUD, DARK, EDGE, SENTINEL_TILE, UNSURE, VEGETATION, WATER, at, put_picture, zone
from test_radar_detect import LAYER, TIME, level
DAY_A, DAY_B = "2026-05-04", "2026-05-11"
@@ -742,6 +742,20 @@ def test_the_examples_are_whole_analyzers_whose_marks_sit_well_inside_their_tile
assert len(tiles) * len(recipe_products(built)) * (1 if single else 2) <= 16, example["id"]
+def test_the_burn_example_keeps_the_surf_out_by_its_near_infrared_not_its_class():
+ """Copernicus classed the surf off Lahaina on 8 August 2023 as unclassified,
+ not water, so a rule on pass A's scene class let the reef through. The
+ values here are the ones read at the reef's mark: water ends near-black in
+ near infrared on B, and char does not."""
+ burn = next(example for example in analysis_examples.EXAMPLES if example.id == "burn").recipe
+ before, after = scene(), scene()
+ paint(after, 100, 100, 30, 30, B08=0.12, B12=0.25) # the town, charred
+ paint(before, 300, 300, 30, 30, sky=UNSURE, B08=0.057, B12=0.057) # the reef under surf
+ paint(after, 300, 300, 30, 30, sky=WATER, B08=0.0016, B12=0.0147) # and calm since
+ binary = evaluate(burn, before, after).reading.binary
+ assert binary[115, 115] and not binary[315, 315]
+
+
def test_an_example_copied_into_the_library_keeps_its_checks_and_the_backup_carries_them(client):
example = client.get("/api/compare/analyzers").json()["examples"][0]
saved = client.post("/api/compare/analyzers", json={**example["recipe"], "id": "custom"}).json()
diff --git a/tests/test_radar_detect.py b/tests/test_radar_detect.py
index c07264e..aae30bc 100644
--- a/tests/test_radar_detect.py
+++ b/tests/test_radar_detect.py
@@ -273,6 +273,21 @@ def test_a_storm_sea_is_still_sea():
assert found(reading("radar-vessels", storm, storm)) == 1
+def test_a_sea_quieter_than_the_radar_is_measured_against_its_noise():
+ """Off Fujairah on a calm morning, cross-pol read at the product's -35 dB
+ floor. Measured against that floor, the faint copy a tanker leaves along the
+ track cleared the line as a vessel; measured against the sensor's own noise,
+ it does not, and the hull still does."""
+ hull = ((300, 300, 8, 3), (10.0, -5.0))
+ copy = ((150, 150, 3, 8), (-8.0, -24.0))
+ calm = _sea_with([hull, copy], sea_vv=-27.0, sea_vh=-40.0)
+ assert (calm[..., 1] == 1).mean() > 0.9 # cross-pol sits on the byte floor
+ result = reading("radar-vessels", calm, calm)
+ assert found(result) == 1
+ ys, xs = np.nonzero(result.binary)
+ assert 300 - PAD <= xs.min() and xs.max() < 308 - PAD + 2
+
+
def test_radar_change_gates_bright_loss_bright_gain_and_new_water():
ground = speckled(-10.0, 5), speckled(-16.0, 6)
town = (slice(200, 240), slice(200, 240))