Skip to content

feat(imagery): spectral profile: chart and compare a multiband raster's bands at points (#1622) - #1645

Merged
giswqs merged 29 commits into
opengeos:mainfrom
elpidioassinaturas:feat/spectral-profile
Nov 9, 2026
Merged

giswqs merged 29 commits into
opengeos:mainfrom
elpidioassinaturas:feat/spectral-profile

Conversation

@elpidioassinaturas

@elpidioassinaturas elpidioassinaturas commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Workflows pane's Spectral Analysis section, which showed raster.spectral's answer as JSON, becomes a spectral profile, after GeoLibre's (opengeos/GeoLibre#1818, cog-spectral-profile.ts). It is in three parts, as proposed in #1622.

Where it comes from. I read GeoLibre's TypeScript while writing this: packages/plugins/src/plugins/cog-spectral-profile.ts, and for the chart apps/geolibre-desktop/src/lib/netcdf-band-axis.ts, netcdf-profile-series.ts and components/panels/NetcdfProfileChart.tsx. I followed what they do: a clicked pixel's band values charted, against wavelength when the file gives one for every band and band number otherwise; wavelengths read from the GDAL_METADATA tag's wavelength and central_wavelength items, a dataset-level item being for no band; and a CSV of the profiles. The Rust is written new, with no code copied: the values come from RustGIS's own raster.spectral, the wavelengths go into its band metadata reader (pam.rs, sidecars too), and the chart is egui. GeoLibre is MIT (LICENSE, Copyright (c) 2026 Qiusheng Wu).

Wavelengths on bands (data). Band gains wavelength: Option<f64>, in nanometres, read from the GeoTIFF's GDAL metadata tag (42112) and from the .aux.xml sidecar:

  • GDAL ≥ 3.10's CENTRAL_WAVELENGTH_UM (IMAGERY domain, micrometres);
  • the per-band wavelength and central_wavelength items, in the unit a wavelength_units item gives (the band's, else the dataset's).

Items read are no longer counted in "band metadata item(s) not read"; an item that isn't a length from 1 nm to 1 m is said ({n} wavelength(s) that aren't a length from 1 nm to 1 m in nanometres or micrometres, or for no band, left out), as is one for a band the raster doesn't have. A band takes the first item that is a length, in the order above, in the tag and the sidecar alike; another length for the same band is said and left out (1 other wavelength item(s) for a band that has one left out (the first is kept)), while the same length under two names is one wavelength. The GeoTIFF writers write the wavelengths of the bands they write back as CENTRAL_WAVELENGTH_UM, and the commands that copy band names copy them too: georeference (rebuild), mosaic, clip, resample, the pixel editor and raster.project (warp.rs); a mosaic says an input whose wavelengths differ from the first's, as it says other band or class names. Build Mosaic (imagery.mosaic, a workspace's) gives a band the images' wavelength when they all give the same one, and says how many bands they disagree on. A wavelength item of the dataset's own, for no band, is said and left out.

raster.spectral takes points (engine). "points": [[lon, lat], …], up to 1000, gives "profiles": [{lon, lat, pixel, values}, …], one per point. A point off the raster keeps its place with "pixel": null and null values, and is said (scene: 1 of 3 points fall outside the raster: their values are null); when every point is off, it is an error. Every answer (one point, points, zone) now carries "wavelengths" (nm, null for a band without one) and "wavelengthUnit": "nm" when the file gives any. A zone is read before points and points before lon/lat; what isn't read is said (scene: lon and lat left out: points are read, scene: points, lon and lat left out: the zone's mean is read). The old answers are unchanged otherwise.

The profile (app), in crates/ui-egui/src/spectralui.rs:

  • A combo of the rasters of two bands or more, and Pick Points, which stays on until it is turned off: each click on the map adds a point.
  • One line per point, up to six, each in the colour of a numbered marker on the map while the section is shown. The x axis is wavelength in nm when every band has one, the bands in wavelength order, and band number otherwise.
  • Hovering the chart shows the band's number, name and wavelength, and each point's value (every band there, when several share a wavelength).
  • A point is taken off with its ×; Clear empties the chart; Export CSV… (desktop) writes a row a band and a column a point.
  • Identify's pop-up on a pixel of a raster of two bands or more gets a Spectral Profile button (a chart icon in its header) that adds that pixel and opens the section.
  • The ribbon's Spectral Analysis tooltip and the user guide (analysis.md, data.md) say what it does.

Choices and limits

  • raster.spectral extended, not a new command, so scripts, the MCP server and plugins get signatures from the one command that already read every band at a point.
  • The Workflows section, not a new pane: the ribbon button and command search already lead there. The layout follows the Time Series pane ([Feature]: A Zarr variable's time series at a clicked point, as a chart #555).
  • Wavelength axis only when every band has one; the answer still lists those there are.
  • Units without wavelength_units: a value under 100 is micrometres, anything else nanometres. Imaging sensors run from about 0.3 to 15 µm, so the two ranges don't meet. The docs say this.
  • Wavelengths from 1 nm to 1 m: a tiny one would round to 0 when written in micrometres, and a huge one stretches the chart's axis; no sensor's band lies outside.
  • Colours keyed to the point, so taking one off doesn't recolour the others; a new point takes a colour no point kept has.
  • CSV cells guarded against spreadsheet formulas (=, +, -, @), as the table export does.
  • Six points in the chart; a seventh takes the oldest off, and the section says so (Up to 6 points are compared: the oldest one was taken off.). Another raster, the same one's bands changed, a raster of its name added again or on another map, or another project, starts the chart again. The command reads up to 1000.
  • Limits:
    • RustGIS's GeoTIFF writers write one band or RGB, as before, so only those bands' wavelengths reach a written file.
    • Commands find a raster by its name, so a raster that shares its name with an earlier layer can't be charted: Identify's button says so and reads nothing, and the section's list leaves it out and says how many it left out, rather than chart the other's pixels.
    • A click with Explore over a raster under a polygon still identifies the polygon (Identify's current behaviour), so the pop-up button shows on rasters with nothing over them.
  • Not here: PNG export of the chart (Export Map captures the view), mean signatures of polygons in the chart (the command already has zone), and wavelengths for STAC cubes (eo:bands).
  • Size: 1,652 lines added in 16 files, 846 of them the new spectralui.rs with its tests. It could be split into the data and engine part and the UI; it is one PR because the UI is what the wavelengths are for.

Testing

New tests:

  • rustgis-data: reads_wavelengths_from_gdal_metadata (µm, nm, wavelength_units per band and per dataset, a value and a unit that aren't lengths, a band past the most a raster has), wavelengths_written_are_read_back, reads_wavelengths_from_a_sidecar.
  • Engine: spectral_profiles_at_points_with_wavelengths: an RGB GeoTIFF with wavelengths written and read back through layer.addDataBytes; profiles, the off-raster notice, the lon/lat left out, wavelengths in every answer and none for a file without them, and seven malformed points.
  • UI (egui_kittest): the_spectral_profile_charts_points_picked (two points picked, the chart's lines, the CSV, taking one off, Clear), the_profile_keeps_six_points_and_says_what_it_leaves_out, identify_offers_the_profile_on_multiband_pixels.

On main 0fd8302 (merged in), with RUSTGIS_LANGUAGE=en on Windows: cargo fmt --all --check and cargo clippy --workspace --all-targets -- -D warnings pass; rustgis-analysis 443 passed, rustgis-data 789 passed, rustgis-engine 1,110 passed and 1 failed, rustgis-tiles COG tests and the spectral UI tests pass. cargo check -p rustgis-web --target wasm32-unknown-unknown can't run on this PC now (zstd-sys needs clang, not installed), so the wasm build is left to CI. The last full cargo test --workspace --no-fail-fast, on main 02006f3, gave 4,966 passed, 2 failed, 21 ignored. Both failures come from this PC's setup and touch nothing here:

  • gdal_formats_open_when_gdal_is_installed needs GDAL 3.8 for .geojsonl, and this PC's GDAL is 3.7.1.
  • geolibre_tools_run_on_layers_and_add_their_outputs runs only where a GeoLibre runner is installed (it is skipped in CI), and this PC's runner refuses the .geojson input.

UI evidence

A Sentinel-2 scene of the São Francisco valley (B02, B03, B04, B08, B11, B12) with the S2A central wavelengths in its .aux.xml, taken with ui_shot. Water, irrigated crops, Caatinga, bare soil and a solar farm compared.

Before (main): Spectral Analysis shows JSON, and the status bar says the wavelengths weren't read.

Before: Spectral Analysis shows JSON Before: Identify on the scene

After: the profile, the hover tooltip, and Identify's pop-up with its Spectral Profile button.

After: the spectral profile After: the chart's hover tooltip After: Identify on the scene After: the Spectral Profile button in the pop-up

Related issue

Closes #1622.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added spectral profile charts for comparing band values at up to six map points or identified raster pixels. Charts use wavelength labels when all bands have wavelength metadata, and desktop users can export samples as CSV.
    • Analysis requests can return profiles for up to 1,000 map points, including null results for points outside the raster.
  • Improvements
    • Raster band wavelengths are read from metadata and preserved across raster operations and exports. Mosaic mismatch notices now include wavelength differences.
  • Documentation
    • Updated guides with details on spectral profiles, wavelength metadata, and multi-point analysis.

…'s bands at points

The Workflows pane's Spectral Analysis section becomes a spectral profile:
pick a raster of two bands or more, turn on Pick Points and click. Each
click adds a point until it is turned off. Up to six points are drawn as
lines, each in the colour of a numbered marker on the map. The x axis is
wavelength (nm) when the file gives one for every band, in wavelength
order, and band number otherwise. Hovering shows a band's name,
wavelength and each point's value; a point can be taken off; Clear and
Export CSV... (desktop, a row a band, a column a point; names guarded
against spreadsheet formulas). Identify's pop-up on a pixel of two bands
or more gets a Spectral Profile button that adds that pixel and opens
the section. After GeoLibre's spectral profile (opengeos/GeoLibre#1818).

Bands gain `wavelength` (nm), read from GDAL's metadata tag and the
.aux.xml sidecar: CENTRAL_WAVELENGTH_UM (GDAL's IMAGERY domain), or
`wavelength` / `central_wavelength` in the unit `wavelength_units` gives
(with none, a value under 100 is micrometres). Items that aren't a length
are said; read ones are no longer counted as band items not read. The
GeoTIFF writers write them back, and the commands that copy band names
(georeference, mosaic, clip, pixel editor, project) copy them too.

`raster.spectral` takes `points` ([[lon, lat], ...], up to 1000) for a
profile each; a point off the raster keeps its place with null values
and is said. Every answer carries `wavelengths` when the file gives any.
A zone is read before points, and points before lon/lat: what isn't read
is said.

Closes opengeos#1622.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

Raster bands now retain optional wavelength metadata. Spectral queries accept multiple map points, and raster operations preserve wavelength information. The Workflows pane adds a spectral profile chart with map sampling, Identify integration, sample controls, and desktop CSV export.

Changes: Spectral Profiles

Layer / File(s) Summary
Wavelength metadata and raster propagation
crates/data/src/raster/*, crates/analysis/src/warp.rs, docs/user-guide/data.md
Raster bands and PAM metadata carry optional wavelengths in nanometres. Parsing recognizes wavelength items and units, reports invalid or conflicting metadata, and writes wavelengths to GDAL metadata. Raster construction and metadata application transfer wavelength values to bands.
Spectral queries and raster operations
crates/engine/src/cmd/imagery.rs, crates/engine/src/tests.rs
raster.spectral accepts point lists and returns per-point pixel and band values. Off-raster points receive null entries. Raster operations preserve wavelengths, and mosaic mismatch notices include wavelength differences. Tests cover point profiles and wavelength handling.
Spectral profile workflow
crates/ui-egui/src/*, docs/user-guide/analysis.md
The Workflows pane charts samples from map picks and eligible Identify results. It supports sample removal and clearing, map markers, and desktop CSV export. The guide documents the UI and script inputs.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant IdentifyPopup
  participant spectralui
  participant WorkflowsChart
  User->>IdentifyPopup: Select spectral profile at raster pixel
  IdentifyPopup->>spectralui: Pass layer and map coordinate
  spectralui->>WorkflowsChart: Read point and add sample
Loading

Possibly related issues

  • Issue 1638: The PR adds mosaic notices for band-name and wavelength differences on a GeoTIFF write path, but does not cover the other lossy-export notes requested.
  • Issue 1562: The PR extends raster.spectral with point-list processing, but does not indicate that zone processing moves off the UI thread.

Possibly related PRs

  • opengeos/RustGIS#890: Both changes modify GDAL metadata parsing in pam.rs and the per-band PAM metadata path.
  • opengeos/RustGIS#1210: Both changes modify the gdal_metadata function contract and serialized GDAL metadata.

Suggested reviewers: giswqs, deniial00

Merge Risk: Low · previous review 70184

The spectral workflow is mergeable with owner awareness of narrow sample-retention and notice issues. Renaming a raster can clear samples, and duplicating then deleting maps can associate retained samples with the copy.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Inconclusive Not evaluated: no title check was configured for this run, so no assessment is made. Provide a title check requirement to evaluate the pull request title.
Passed Passed checks: 4 passed

Check name Status Explanation
Linked Issues check Passed Scope: #1622 is the only direct linked issue. It has no parent or contextual issue. Evidence is the whole-PR summary (merge base 02006f3 to head 7018460). The incremental changes since the previous r…
Out of Scope Changes check Passed Each changed area maps to #1622 or gives direct support to it:
- crates/data/src/raster/mod.rs and pam.rs: wavelength field, parsing, GDAL metadata writing, and loss reporting.
- crates/analysis/src/w…
Docstring Coverage Passed Docstring coverage is 83.72% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Description check Passed The description is thorough and covers the template's required areas. The Summary explains the change and its motivation: a Workflows spectral profile replaces the JSON readout, with data, engine, and…
Full details: Linked Issues check

Explanation

Scope: #1622 is the only direct linked issue. It has no parent or contextual issue. Evidence is the whole-PR summary (merge base 02006f3 to head 7018460). The incremental changes since the previous reviewed head (3b1779f) were not read as a separate diff. The summary covers the whole-PR state, so the verdict uses it.

Requirements, grouped by objective:

(a) Wavelength data [#1622]: Band gains wavelength: Option<f64> in nm (crates/data/src/raster/mod.rs). pam.rs reads CENTRAL_WAVELENGTH_UM (IMAGERY domain, micrometres), the per-band wavelength and central_wavelength items, and wavelength_units, from the GDAL metadata tag and the .aux.xml sidecar. Units fall back to micrometres below 100 and nanometres otherwise. Out-of-range or invalid values are reported and not counted as unread. Data-crate tests are listed.

(b) Writing and preservation [#1622]: gdal_metadata writes CENTRAL_WAVELENGTH_UM for the written bands. warp.rs Canvas::finish copies band wavelengths to output bands (project). imagery.rs preserves or derives wavelengths for rebuild (georeference), resample, mosaic, clip and pixel edit. Workspace mosaic keeps a wavelength only when all images agree. Mosaic reports wavelength mismatches. The GeoTIFF writers write only one band or RGB; the author discloses this limit. The issue does not require more.

(c) raster.spectral [#1622]: accepts points (up to 1000) and returns profiles with {lon, lat, pixel, values}. Off-raster points keep their place with pixel null and a notice. All-off-raster input is an error. Every answer carries wavelengths (nm, null per band without one) and wavelengthUnit. Zone, points and lon/lat precedence is reported. Test spectral_profiles_at_points_with_wavelengths is listed.

(d) Spectral profile view [#1622]: spectralui.rs implements the Workflows section. It offers rasters of two or more bands and Pick Points until turned off. It keeps up to six colour-keyed samples, removes the oldest with a notice, and draws numbered map markers. The axis is wavelength only when every band has one, and band number otherwise. Hover shows band and point values. Points can be removed, Clear empties the chart, and desktop CSV export guards formula-like text. egui_kittest tests are listed.

(e) Identify [#1622]: a Spectral Profile button appears in the Identify pop-up for rasters with two or more bands. It adds the pixel and opens the section.

Excluded items in the issue (chart PNG export, polygon mean signatures in the chart, STAC eo:bands wavelengths) are not implemented, which matches the issue.

Disclosed limit: a raster that shares its name with an earlier layer cannot be charted. Identify reports this, and the section lists it as left out. The issue sets no requirement for same-name rasters.

No unmet coding requirement is found in the available evidence. Remaining uncertainty: the incremental changes since 3b1779f were not read separately.

Full details: Out of Scope Changes check

Explanation

Each changed area maps to #1622 or gives direct support to it:

  • crates/data/src/raster/mod.rs and pam.rs: wavelength field, parsing, GDAL metadata writing, and loss reporting.
  • crates/analysis/src/warp.rs: copies band wavelengths in Canvas::finish. This supports the issue requirement that project keeps wavelengths.
  • crates/engine/src/cmd/imagery.rs and tests.rs: points extension, wavelengths in answers, mosaic mismatch notice (extends the existing band-name notice to wavelengths), and round-trip and spectral tests.
  • crates/ui-egui/src/spectralui.rs (new), analysispane.rs, lib.rs, panes.rs: the profile section, its wiring, project-reset cleanup, and pick cleanup when the Workflows pane is not selected.
  • mapview.rs: map markers, the Identify button, and a comment change that clarifies raster pixel identity for the Identify hook.
  • ribbon.rs: the Spectral Analysis tooltip text.
  • docs/user-guide/analysis.md and data.md: documentation of the new behaviour, which the issue scope lists.

No change is found that is unrelated to #1622. The check rests on the whole-PR summary, not on a full diff read. Incremental changes since 3b1779f were not read separately.

Full details: Docstring Coverage

Explanation

Docstring coverage is 83.72% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 43 functions across 10 files.

Full details: Description check

Explanation

The description is thorough and covers the template's required areas. The Summary explains the change and its motivation: a Workflows spectral profile replaces the JSON readout, with data, engine, and app parts, and it links issue #1622. The Testing section lists new tests, the commands run, and the failing tests with their causes. The UI evidence section is filled in with before and after screenshots, which the template requires for visible UI changes. The Related issue section says 'Closes #1622'. The description is long and includes implementation detail, but every template section is present with real content.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit plots a curve of green,
Then adds a point beside the scene.
Each band finds its wavelength place,
Six samples hop across the space.
A CSV follows, neat and bright,
The chart keeps every mark in sight.

Comment thread crates/data/src/raster/pam.rs Resolved
Comment thread crates/data/src/raster/pam.rs Resolved
Comment thread crates/engine/src/cmd/imagery.rs Resolved
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • Silent drop of a second wavelength for the same band (crates/data/src/raster/pam.rs:500, confidence high). get_or_insert keeps the first value with no notice, and the PR body admits this. The sidecar path (pam.rs:242) also resolves duplicates differently from the GDAL-tag path. Inline comment posted.
  • Non-finite or zero wavelengths accepted (pam.rs:134, plus the same pattern at pam.rs:125, confidence medium-high). The finite check runs on the input, not the result. Micrometres can overflow to inf and subnormals can round to 0.0. Inline comment with a one-line suggestion posted.
  • zone with lon/lat drops them silently (crates/engine/src/cmd/imagery.rs:871, confidence high). This breaks the PR's own "what isn't read is said" rule. Inline comment posted.

Security

  • None found. The CSV formula guard is present, and the new points input is bounded (1000 points) and validated.

Performance

  • None significant. Per-frame work in the chart and popup is cheap for at most six points.

Quality

  • crates/data/src/raster/mod.rs:799: the "names for N band(s) it doesn't have" notice now also counts wavelengths, so the wording is misleading. Consider "names or wavelengths for N band(s)".
  • docs/user-guide/data.md: "The GeoTIFF exports write the wavelengths back" overstates the behaviour. Only the bands a write keeps get their wavelengths, as the PR body says. The user guide should say so.
  • docs/user-guide/analysis.md: the rewrapped "Change Detection" bullet runs about 135 columns, against about 100 elsewhere.
  • engine/cmd/imagery.rs spectral() has grown to about 150 lines. The points branch could move into its own helper.
  • spectralui.rs chart() is about 85 lines and could be split (layout, runs, hover).

AGENTS.md

  • Screenshots missing. The PR body says "(screenshots to be attached)" twice. AGENTS.md requires before and after screenshots for changed UI, and after-only for new UI. The PR needs both attached.
  • Silent loss, already stated by the PR. Its own limits list says a repeated wavelength item is kept without a notice. That contradicts the "Never silent" rule (see the first bug above).
  • Translations, the Session::notify path and the wasm gating look correct on reading.

Not raised. Earlier concerns: none (no prior review threads).

Confidence. The bugs are from reading the diff against the surrounding code. I did not build or run the tests.

Change size

Compared: the whole PR against main (merge base 02006f3 to PR head 1520b88).

Measure Value
Files changed 13 (1 added, 12 modified, 0 removed, 0 renamed)
Size before 3.84 MB
Size after 3.88 MB
Total size change +44.1 KB
Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 22.9 KB +22.9 KB
crates/data/src/raster/pam.rs 36.5 KB 47.2 KB +10.7 KB
crates/engine/src/tests.rs 2.00 MB 2.00 MB +4.0 KB
crates/engine/src/cmd/imagery.rs 95.7 KB 99.1 KB +3.4 KB
docs/user-guide/analysis.md 128.0 KB 129.4 KB +1.3 KB
crates/ui-egui/src/mapview.rs 256.5 KB 257.6 KB +1.1 KB
docs/user-guide/data.md 94.9 KB 95.6 KB +0.8 KB
crates/data/src/raster/mod.rs 92.1 KB 92.7 KB +0.6 KB
crates/ui-egui/src/panes.rs 409.5 KB 409.8 KB +0.3 KB
crates/ui-egui/src/ribbon.rs 239.7 KB 239.9 KB +0.2 KB
crates/ui-egui/src/analysispane.rs 116.6 KB 116.5 KB −0.1 KB
crates/analysis/src/warp.rs 79.9 KB 80.0 KB +0.1 KB
crates/ui-egui/src/lib.rs 376.9 KB 376.9 KB +0.0 KB

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-1645/
Web app https://preview.rustgis.app/pr-1645/app/
Commit 29677ce

GitHub Pages takes a minute or two to publish a new commit.

…w round 1)

- A wavelength whose nanometres overflow or round to zero isn't a
  length: the result is checked, not only the value read.
- Another length for a band that has one is said and left out, in the
  metadata tag and the sidecar; the same length under two names is one
  wavelength. A sidecar band now takes its first item that is a length,
  as the tag does, instead of stopping at the first item there is.
- raster.spectral says lon and lat left out when a zone is read too.
  Its points are read in their own function.
- The notice for bands a raster doesn't have says "names or
  wavelengths"; the user guide says an export writes the wavelengths of
  the bands it writes, and a long line is wrapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elpidioassinaturas

Copy link
Copy Markdown
Contributor Author

Review round 1 (9889e1b), the summary's other points:

  • Done: the notice for bands a raster doesn't have now says "names or wavelengths"; data.md says an export writes the wavelengths of the bands it writes (one band, or RGB); the long Change Detection line is wrapped; the points branch of spectral() is its own spectral_points.
  • Left as is: chart() in spectralui.rs (about 85 lines) reads top to bottom as layout, lines, then hover, and each part uses the same scale closures. Splitting it would pass those around without making it shorter.
  • Screenshots: to be attached by hand before this leaves draft.

🤖 Addressed by Claude Code

Comment thread crates/data/src/raster/pam.rs Resolved
Comment thread crates/data/src/raster/mod.rs Resolved
Comment thread crates/engine/src/cmd/imagery.rs Resolved
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Code review

Earlier reviews: 3 threads already on this PR, all marked outdated. The code now addresses each one: the silent second wavelength (now noticed), the finite check on the result (now positive(...)), and the zone plus lon/lat case (now noticed and tested). I left all three alone. The PR body still says a repeated wavelength is kept "without a notice", which the code no longer does.

Bugs

  • Mosaic overrides input wavelengths silently: the first input's wavelength is copied, and the mosaic notice compares only names and classes. (crates/engine/src/cmd/imagery.rs:1362, filter at 1369) Confidence: medium.
  • Dataset-level wavelength items (no sample) are neither read nor counted, so they are dropped without a notice. The test at around pam.rs:391 locks in the silence. (crates/data/src/raster/pam.rs:521) Confidence: medium.
  • A sidecar wavelength silently overwrites a different GDAL-tag wavelength for the same band, since both reads apply in turn. (crates/data/src/raster/mod.rs:853) Confidence: low-medium.

Security

  • Nothing found. The points input is bounded to 1000, non-finite values are rejected, and CSV cells are formula-guarded.

Performance

  • Nothing material. The chart and multiband do trivial per-frame work.

Quality

  • spectral() emits the "left out" notice before a later error can return, so a failed call can still show a notice.
  • The chart forces hi = lo + 1.0 when all values are equal, so the top axis label shows a value that appears in no data. Confidence: high, low severity.
  • format!("{path}: {e}") in the CSV export is a user-visible message that isn't routed through i18n::fmt. Confidence: high, low severity.
  • Left for the release quality pass: the format! message above and the constant-value axis label.

AGENTS.md

  • Screenshots are missing. The PR body has placeholders ("(screenshots to be attached)") for both the before and after UI. AGENTS.md requires screenshots for visible changes. Confidence: high.
  • The PR body says a repeated wavelength item is kept "without a notice", but the code now reports it. Confidence: high.
  • Checked and fine: the ROADMAP does not list spectral as underway; the GeoLibre origin is named; tl! and i18n::fmt are used for the interface text; the wasm gating is in place; ui.pane.workflows accepts section.

I did not compile or run the tests (no shell here). The findings come from reading the diff and the surrounding code.

Change size

Compared: the whole PR against main (merge base 02006f3 to PR head 9889e1b).

Files changed Added Modified Removed Renamed
13 1 12 0 0
Size before Size after Total change
3.84 MB 3.89 MB +51.1 KB
Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 22.9 KB +22.9 KB
crates/data/src/raster/pam.rs 36.5 KB 51.5 KB +15.0 KB
crates/engine/src/tests.rs 2.01 MB 2.01 MB +5.1 KB
crates/engine/src/cmd/imagery.rs 95.7 KB 99.5 KB +3.8 KB
docs/user-guide/analysis.md 128.1 KB 129.4 KB +1.3 KB
crates/ui-egui/src/mapview.rs 256.5 KB 257.6 KB +1.1 KB
docs/user-guide/data.md 94.9 KB 95.7 KB +0.9 KB
crates/data/src/raster/mod.rs 92.1 KB 92.8 KB +0.6 KB
crates/ui-egui/src/panes.rs 409.5 KB 409.8 KB +0.3 KB
crates/ui-egui/src/ribbon.rs 239.8 KB 240.0 KB +0.2 KB
crates/ui-egui/src/analysispane.rs 116.6 KB 116.5 KB −0.1 KB
crates/analysis/src/warp.rs 79.9 KB 80.0 KB +0.1 KB
crates/ui-egui/src/lib.rs 376.9 KB 377.0 KB +0.0 KB

…eview round 2)

- raster.mosaic says an input whose bands have other wavelengths than
  the first's, as it says other band or class names: "band names,
  classes or wavelengths other than west's, which the mosaic keeps".
- A wavelength item of the dataset's own (no band) is for no band: it
  is counted in the wavelengths left out, in GDAL's metadata tag and in
  the .aux.xml sidecar, instead of passed over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread crates/data/src/raster/pam.rs Resolved
Comment thread crates/data/src/raster/pam.rs Resolved
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the prior review threads and the code they touch. I found two inline issues in the wavelength reader, plus some minor nits below. Nothing I found is a crash or a wasm break. I did not compile or run the tests here, since this environment has no build tools.

Bugs

  • None confirmed. The one area I could not check is roxmltree's text() behaviour on empty elements, which I took from memory (no crate source is on disk).

Security

  • None found. Input is bounded: points is capped at 1000, band numbers at MAX_BANDS, CSV cells are guarded against formula injection, and the new code has no unwrap/expect/indexing in non-test paths.

Performance

  • None significant. Per-frame work is small: multiband iterates layers, and chart measures two labels.

Quality (per AGENTS.md these may wait for the release quality pass)

  • crates/ui-egui/src/spectralui.rs:208: format!("{path}: {e}") is a user-visible message. AGENTS asks for i18n::fmt there.
  • add_point reads a missing pixel as unwrap_or(0), so a sample with a null pixel would show as pixel (0,0). The UI's single-point path never produces that today, so it is latent only.
  • spectral() in crates/engine/src/cmd/imagery.rs emits the "left out" notice before the command can still fail (for example a zone that reads nothing), so an error can follow a notice that says the zone's mean is read.
  • The RGB test helper in spectralui.rs duplicates the engine test's tiff closure.

AGENTS.md

  • The "Never silent" points are covered by the two inline comments below. Everything else I checked follows the rules: no new dependencies, no new assets, the GeoLibre source is named, and the layering holds.

Confidence

  • Empty sidecar wavelength items dropped without a notice: medium-high (pam.rs:157, inline).
  • Relative 1e-6 "same length" tolerance merging different lengths: low-medium (pam.rs:147, inline).

Left alone (already raised in prior threads): sidecar overriding the embedded tag without a notice (answered by the author, left for a maintainer); the mosaic notice, the wavelength overflow and rounding checks, the zone lon/lat notice, and dataset-level wavelength items were all fixed in 0d6320e/9889e1b, so I did not re-raise them. That is 6 earlier concerns left alone.

Change size

Compared with main (merge base 02006f3 to PR head 0d6320e).

Measure Value
Files changed 13 (1 added, 12 modified, 0 removed, 0 renamed)
Size before 3.84 MB
Size after 3.82 MB
Total size change +52.2 KB

Largest changes:

Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 22.9 KB +22.9 KB
crates/data/src/raster/pam.rs 36.5 KB 51.7 KB +15.2 KB
crates/engine/src/tests.rs 2.01 MB 2.02 MB +5.9 KB
crates/engine/src/cmd/imagery.rs 95.7 KB 99.6 KB +3.9 KB
docs/user-guide/analysis.md 128.0 KB 129.4 KB +1.3 KB
crates/ui-egui/src/mapview.rs 256.5 KB 257.6 KB +1.1 KB
docs/user-guide/data.md 94.9 KB 95.7 KB +0.9 KB
crates/data/src/raster/mod.rs 92.1 KB 92.8 KB +0.6 KB
crates/ui-egui/src/panes.rs 409.5 KB 409.8 KB +0.3 KB
crates/ui-egui/src/ribbon.rs 239.8 KB 240.0 KB +0.2 KB
crates/ui-egui/src/analysispane.rs 116.6 KB 116.5 KB −0.1 KB
crates/analysis/src/warp.rs 79.9 KB 80.0 KB +0.1 KB
crates/ui-egui/src/lib.rs 376.9 KB 376.9 KB +0.0 KB

…lionth differ (review round 3)

- A sidecar's empty wavelength item is counted as not a length, as the
  metadata tag's already was.
- Two wavelengths for one band are the same only within a millionth of
  a nanometre (what micrometres are read to), not a millionth of their
  length: 665 and 665.0005 nm are two, and the second is said.
- raster.spectral says what it left out only once the run has read
  what it does: a run that fails says only its error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elpidioassinaturas

Copy link
Copy Markdown
Contributor Author

Review round 3 (4b987ce), the summary's other points:

  • Done: raster.spectral now says what it left out only after the run has read what it does, so a run that fails says only its error (tested).
  • Left as is: format!("{path}: {e}") holds no words to translate (the path and the system's error). add_point reads one point through lon/lat, which errors off the raster, so its pixel is never null. The two test helpers build their rasters for different crates' tests.

🤖 Addressed by Claude Code

Comment thread crates/data/src/raster/pam.rs Resolved
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the eight earlier threads, and the code they point at. The PR is well covered by tests and most earlier concerns are fixed in 4b987ce and 9889e1b1. I found one low-confidence item, posted inline, and a few nits.

Bugs

  • None found. I checked the zone/points/lon-lat notice matrix in spectral(), the pick lifecycle (the section combo clears workflow.pick, and map clicks are consumed once per frame), the Band struct literal (only mod.rs:747, already updated), and the Identify layerId/raster keys that offered() depends on. All hold.

Security

  • None found. raster.spectral adds no file or network access, and the points input is bounded (1000 points) and checked for shape and finiteness.

Performance

  • None significant. Each click costs one raster.spectral call. Chart and hover work scale with points × bands, and the per-frame multiband and offered scans are cheap.

Quality

  • Low: pam.rs:520, a wavelength_units item with a sample that isn't a band in range is silently ignored. Posted inline. Confidence low, since it changes no band's value.
  • Low: mapview.rs:3541, the comment says a raster pixel has neither layerId nor fid. Raster identify now returns layerId, so the comment is stale. Nit.
  • Low: spectralui.rs, add_point uses unwrap_or(0) for a missing pixel, which would silently place a point at (0,0). The current answer always includes pixel, so this is defensive only. Nit.
  • Low: spectral() calls spectral_zone(p) twice (in spectral and in spectral_read). Nit.

AGENTS.md

  • Medium: the PR body's screenshots are hosted on the author's fork (raw.githubusercontent.com/elpidioassinaturas/...), not in opengeos/rustgis-assets at assets.rustgis.app. AGENTS.md says screenshots live in that repo. Please move them there and link by URL.
  • Low: spectralui.rs:208, format!("{path}: {e}") is shown to the user as a message. AGENTS.md asks for i18n::fmt. The same pattern is used throughout the codebase (e.g. workspacepanes.rs:701), so this is a pre-existing pattern and I left it out of the required fixes.

Already raised (left alone)

  • 8 earlier threads were left alone: the sidecar overriding the GeoTIFF tag (mod.rs:853, answered as GDAL precedence) and seven threads that the author marked fixed in 4b987ce and 9889e1b1. I checked each fix in the diff and none needed re-raising.

Change size

Compared: the whole PR against main (merge base 02006f3 to PR head 4b987ce).

Measure Value
Files changed 13 (1 added, 12 modified, 0 removed, 0 renamed)
Size before 3.84 MB
Size after 3.89 MB
Total size change +52.5 KB
Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 22.9 KB +22.9 KB
crates/data/src/raster/pam.rs 36.5 KB 52.6 KB +16.1 KB
crates/engine/src/tests.rs 2.00 MB 2.01 MB +6.3 KB
crates/engine/src/cmd/imagery.rs 95.7 KB 99.9 KB +4.1 KB
docs/user-guide/analysis.md 128.1 KB 129.4 KB +1.3 KB
crates/ui-egui/src/mapview.rs 256.5 KB 257.6 KB +1.1 KB
docs/user-guide/data.md 94.9 KB 95.7 KB +0.9 KB
crates/data/src/raster/mod.rs 92.1 KB 92.8 KB +0.6 KB
crates/ui-egui/src/panes.rs 409.5 KB 409.8 KB +0.3 KB
crates/ui-egui/src/ribbon.rs 239.8 KB 240.0 KB +0.2 KB
crates/ui-egui/src/analysispane.rs 116.6 KB 116.5 KB −0.1 KB
crates/analysis/src/warp.rs 79.9 KB 80.0 KB +0.1 KB
crates/ui-egui/src/lib.rs 376.9 KB 377.0 KB +0.0 KB

- A wavelength_units item in GDAL's metadata tag for a band past the
  most a raster has is counted in the wavelength items left out, as a
  wavelength for no band already is.
- raster.spectral reads its zone parameter once; a stale comment in the
  Identify pop-up is corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elpidioassinaturas

Copy link
Copy Markdown
Contributor Author

Review round 4 (0b8ba0f), the summary's other points:

  • Done: spectral() reads zone once and passes it on; the Identify comment now says a raster pixel has no feature id.
  • Screenshots: AGENTS.md's rustgis-assets rule is for images the docs link to. For PR screenshots, docs/contributing.md says web attachments are fine, and none are committed to this repository.
  • unwrap_or(0) in add_point and format!("{path}: {e}"): as answered in round 3.

🤖 Addressed by Claude Code

Comment thread crates/data/src/raster/pam.rs Resolved
Comment thread crates/ui-egui/src/spectralui.rs Resolved
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • No confirmed bugs. The wavelength parsing, the raster.spectral points and zone paths, and the chart math all check out against their tests.

Security

  • Nothing found. Points are validated (finite, at most 1000), CSV cells are guarded against formula injection, and no unwrap, expect or unsafe appears in non-test code.

Performance

  • Nothing that matters. multiband() allocates a name list each frame the section is open; it is cheap, so I left it alone.

Quality

  • Nits, left for the release quality pass: the hover tooltip picks the nearest band even when the pointer is far from the plot; csv and the export button are native-only, which is correct but worth a comment.

AGENTS.md

  • Never silent, medium (inline): a second wavelength_units item for a band is silently dropped, in both the tag and the sidecar reader (pam.rs:525, pam.rs:268). Its wavelengths are reported, but the conflicting unit is not.
  • Name-based lookup, low (inline): from_identify passes the layer name, and raster.spectral resolves it case-insensitively to the first match (spectralui.rs:107). I have not confirmed that duplicate names can occur, since unique_name in layer.rs may prevent it.
  • i18n, low (nit): spectralui.rs builds a user-visible message with format!("{path}: {e}") where AGENTS asks for i18n::fmt. The string has no literal text, so the practical impact is small.

Earlier concerns not repeated (already raised in prior threads): the cross-source sidecar-over-tag wavelength conflict (open, the author declined it), and the threads on the mosaic notice, the invalid CENTRAL_WAVELENGTH_UM fallthrough, the zone/lon/lat notice, dataset-level items, empty MDI items, the tolerance, and the overflow checks. All of those are fixed or answered. That is 6 threads left alone that were already answered or fixed, plus 1 open thread left alone.

Change size

Compared: the whole PR against main (merge base 02006f3 to PR head 0b8ba0f).

Measure Value
Files changed 13 (1 added, 12 modified, 0 removed, 0 renamed)
Size before 3.84 MB
Size after 3.89 MB
Total size change +52.7 KB
Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 22.9 KB +22.9 KB
crates/data/src/raster/pam.rs 36.5 KB 52.8 KB +16.3 KB
crates/engine/src/tests.rs 2.01 MB 2.01 MB +6.3 KB
crates/engine/src/cmd/imagery.rs 95.7 KB 99.9 KB +4.2 KB
docs/user-guide/analysis.md 128.1 KB 129.4 KB +1.3 KB
crates/ui-egui/src/mapview.rs 256.5 KB 257.6 KB +1.1 KB
docs/user-guide/data.md 94.9 KB 95.7 KB +872 B
crates/data/src/raster/mod.rs 92.1 KB 92.8 KB +647 B
crates/ui-egui/src/panes.rs 409.5 KB 409.8 KB +267 B
crates/ui-egui/src/ribbon.rs 239.7 KB 239.8 KB +169 B
crates/ui-egui/src/analysispane.rs 116.6 KB 116.5 KB −109 B
crates/analysis/src/warp.rs 79.9 KB 80.0 KB +73 B
crates/ui-egui/src/lib.rs 376.9 KB 377.0 KB +16 B

… in Identify (review round 5)

- A band's or the dataset's wavelength unit given again otherwise is
  said and left out (the first is read), in GDAL's metadata tag and in
  the .aux.xml sidecar; the same unit again is nothing.
- Identify's Spectral Profile button on a raster another layer shares
  its name with (case aside) says so instead of charting the other
  one's pixels, since commands find a raster by its name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread crates/data/src/raster/pam.rs Resolved
Comment thread crates/ui-egui/src/spectralui.rs Resolved
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the staged AGENTS.md and the 11 earlier threads, and checked the surrounding code: the map click intake, the Identify pop-up, ui.pane.workflows, the GeoTIFF export note, and apply_pam. I found two new issues and posted them inline. Nothing else survived checking. I did not run the test suite.

Bugs

  • Wavelength unit read differently by the two readers when an empty wavelength_units item comes first (pam.rs:277). The sidecar and tag readers give different wavelengths for the same input, and the "first is kept" notice is misleading. Low severity. Confidence medium-high. Posted inline. This is new: it follows from the earlier empty-item fix.
  • Spectral pick uses needed: 1, so a second map click in the same frame is not taken by the pick and is neither added nor said (spectralui.rs:204). Low severity. Confidence medium. Posted inline.

Security

  • None found.

Performance

  • None found. The point cap (1000) and the per-frame work are bounded.

Quality (grouped nits, not posted inline)

  • The GeoTIFF test fixture is duplicated in spectralui.rs (rgb_tiff_b64) and tests.rs (the tiff closure).
  • format! for user-visible text in spectralui.rs:217; the content is only a path and an error, so this is minor.
  • No upper bound on a nanometre value, so 1e300 with unit nm is accepted and charted.

AGENTS.md

  • No violations found. Unwrap, panic and indexing are absent from non-test code. Lossy input is said with counts. Wasm gating is correct. Translatable strings use tl!/i18n::fmt. The GeoLibre source is named in the PR body. The screenshots are hosted on a personal fork rather than rustgis-assets; the attachment rule permits GitHub attachments, so this is noted, not flagged.

Earlier concerns

  • I left 11 earlier threads alone. One is still open: the sidecar overriding the embedded tag across sources. The author declined and a maintainer should decide. The other 10 are answered or outdated and not re-raised.

Change size

Compared with main (merge base 02006f3 to PR head 14477c8): the whole PR, not the latest push.

Measure Value
Files changed 13 (1 added, 12 modified, 0 removed, 0 renamed)
Size before 3.84 MB
Size after 3.90 MB
Total size change +58.1 KB
File Before After Change
crates/ui-egui/src/spectralui.rs 0 B 24.5 KB +24.5 KB
crates/data/src/raster/pam.rs 36.5 KB 55.3 KB +18.8 KB
crates/engine/src/tests.rs 2006.2 KB 2012.5 KB +6.3 KB
crates/engine/src/cmd/imagery.rs 95.7 KB 99.9 KB +4.2 KB
docs/user-guide/analysis.md 128.1 KB 129.4 KB +1.3 KB
crates/ui-egui/src/mapview.rs 256.5 KB 257.6 KB +1.1 KB
docs/user-guide/data.md 94.9 KB 95.7 KB +0.9 KB
crates/data/src/raster/mod.rs 92.1 KB 92.8 KB +0.6 KB
crates/ui-egui/src/panes.rs 409.5 KB 409.8 KB +267 B
crates/ui-egui/src/ribbon.rs 239.7 KB 239.9 KB +169 B
crates/analysis/src/warp.rs 79.9 KB 80.0 KB +73 B
crates/ui-egui/src/lib.rs 377.0 KB 377.0 KB +16 B
crates/ui-egui/src/analysispane.rs 116.7 KB 116.6 KB -109 B

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no new bugs that the existing threads don't already cover. Most of the substantive concerns on this PR were raised earlier and answered or fixed, so I left those alone. I checked the new points path in raster.spectral against pixel_at and value, which bounds-check every index, so there is no panic route. I also checked every Band and PamBand struct literal for the new field, and found none missed.

Bugs

  • spectralui.rs:73: an empty restart overwrites the message from an earlier one, so the "points taken off" notice disappears when the first point is added after a raster change. Low severity, confidence low-medium. Posted inline.

Security

  • None found. The CSV export guards formula cells, and the new points input is bounded to 1000 entries and checked for finiteness.

Performance

  • multiband(), fresh() and data_of() run every frame while the spectral section or the map paint is active. Each does a linear layer_by_name, so the cost is roughly O(layers²) per frame. Low severity, confidence medium. Not worth fixing unless projects get large.

Quality (left for the release quality pass)

  • crates/data/src/raster/pam.rs:115-118: the doc comment for wavelength_nm sits on enum Unit, and wavelength_nm itself has a second, separate doc block. Confidence high.

AGENTS.md

  • The PR body hosts its screenshots on the author's fork (raw.githubusercontent.com/elpidioassinaturas/RustGIS/capturas-prs/…). AGENTS.md says screenshots live in opengeos/rustgis-assets. This is in the PR description, not the diff, and confidence is medium.

Prior concerns left alone: 22 threads on this PR were already raised, and I did not re-raise any of them. Many were resolved in code. The open ones were answered and left for a maintainer.

Change size

Compared: the whole PR against main (merge base 0fd8302 to PR head 9734f95).

Measure Value
Files changed 13 (added 1, modified 12, removed 0, renamed 0)
Size before 3.91 MB
Size after 3.99 MB
Total size change +82.7 KB
Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 40.4 KB +40.4 KB
crates/data/src/raster/pam.rs 36.5 KB 59.1 KB +22.6 KB
crates/engine/src/tests.rs 2.01 MB 2.02 MB +9.5 KB
crates/engine/src/cmd/imagery.rs 97.0 KB 102.4 KB +5.4 KB
docs/user-guide/analysis.md 130.4 KB 131.7 KB +1.3 KB
crates/ui-egui/src/mapview.rs 259.4 KB 260.6 KB +1.2 KB
docs/user-guide/data.md 95.9 KB 96.8 KB +0.9 KB
crates/data/src/raster/mod.rs 92.1 KB 92.7 KB +0.6 KB
crates/ui-egui/src/lib.rs 378.3 KB 378.5 KB +0.3 KB
crates/ui-egui/src/panes.rs 409.5 KB 409.8 KB +0.3 KB
crates/ui-egui/src/ribbon.rs 245.5 KB 245.7 KB +0.2 KB
crates/ui-egui/src/analysispane.rs 116.7 KB 116.6 KB −0.1 KB
crates/analysis/src/warp.rs 81.9 KB 82.0 KB +0.1 KB

The first paragraph of wavelength_nm's doc had stayed above the new Unit
enum, where rustdoc gave it to Unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elpidioassinaturas

Copy link
Copy Markdown
Contributor Author

On the github-actions review's quality point: wavelength_nm's doc comment is whole again in 4e7a4da; its first paragraph had stayed above the new Unit enum.

🤖 Addressed by Claude Code

Comment thread crates/data/src/raster/mod.rs Resolved
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the full diff (about 2,100 lines) and all 60-plus prior review threads, then checked the claims that matter against the source. Most concerns already raised in earlier threads are left alone (about 40 of them). The one new finding is posted inline.

Bugs

  • None confirmed. Checked the non-test additions for unwrap, expect and panics, indexing, the Weak identity check (in-place Arc::make_mut only runs before a layer is inserted), CRS handling in pixel_at (it reprojects from lon/lat), and the reader paths that call apply_pam. All look sound.

Security

  • None. The new raster.spectral points input is validated (count capped at 1000, shape checked, non-finite rejected), and it is a read-only command.

Performance

  • Low: section() calls multiband(), which does a layer_by_name lookup for every layer, so the cost is O(layers²) per frame while the section is shown. Only matters on maps with hundreds of layers. Confidence: medium.

Quality

  • Low: spectralui::section() is about 130 lines and could be split (points list, chart, pick controls). Left for the release quality pass.
  • Low: wavelengths are rounded to a millionth of a nanometre on read, and the writer keeps full precision. The rounding is silent but far below any sensor's precision. Confidence: low.

Never silent (AGENTS.md)

  • Posted inline (crates/data/src/raster/mod.rs:796, confidence high on the mechanism, low on severity): the notices for an unreadable sidecar or GDAL tag (pam.rs, geotiff.rs, cog.rs) still say only "band and class names", although wavelengths are now lost there too. The comment lists the sites and the tests that pin the old wording.

AGENTS.md

  • Low: the screenshots in the PR body are hosted on the author's fork (elpidioassinaturas/RustGIS, branch capturas-prs). AGENTS.md says images belong in opengeos/rustgis-assets and docs link to them there. Confidence: medium.
  • Low: the PR body reports the wasm check as passing "before the last rebase", and the workspace tests as 2 failing locally. Please re-run cargo xtask ci and the wasm build on the final head, or let CI on Linux cover it. Confidence: medium.
  • Checked and fine: the GeoLibre attribution (MIT, named in the PR), tl!/i18n::fmt use in the new UI text, the chart icon (exists in icons.rs), no new dependencies (base64 is already a dependency of the affected crates), and no new asset files.

Prior threads

About 40 earlier concerns were left alone because they were already raised and answered, or resolved. I posted nothing again.

Change size

Compared: the whole PR against main (merge base 0fd8302 to PR head 4e7a4da).

Files changed Added Modified Removed Renamed Size before Size after Total change
13 1 12 0 0 4.0 MB 4.1 MB +82.7 KB

Largest changes:

Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 40.4 KB +40.4 KB
crates/data/src/raster/pam.rs 36.5 KB 59.1 KB +22.6 KB
crates/engine/src/tests.rs 2.0 MB 2.1 MB +9.5 KB
crates/engine/src/cmd/imagery.rs 97.0 KB 102.4 KB +5.4 KB
docs/user-guide/analysis.md 130.4 KB 131.7 KB +1.3 KB
crates/ui-egui/src/mapview.rs 259.4 KB 260.6 KB +1.2 KB
docs/user-guide/data.md 95.9 KB 96.8 KB +0.9 KB
crates/data/src/raster/mod.rs 92.1 KB 92.7 KB +0.6 KB
crates/ui-egui/src/lib.rs 378.3 KB 378.5 KB +0.3 KB
crates/ui-egui/src/panes.rs 411.5 KB 411.7 KB +0.3 KB
crates/ui-egui/src/ribbon.rs 245.5 KB 245.7 KB +0.2 KB
crates/ui-egui/src/analysispane.rs 116.6 KB 116.5 KB −0.1 KB
crates/analysis/src/warp.rs 81.9 KB 81.9 KB +0.1 KB

The notices for a sidecar or metadata tag that can't be read (pam.rs,
geotiff.rs, both COG readers' tests) named only band and class names, or
statistics, no-data and band names; wavelengths come from the same
metadata and go with them, so they are named too. A broken tag with a
wavelength in it is tested.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread crates/ui-egui/src/spectralui.rs Resolved
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the 44 earlier review threads, and the surrounding code for the changed paths. I found one new low-severity issue (posted inline) and a few notes. I did not re-raise the 8 open threads (sidecar-over-tag precedence, duplicate-map identity, export band loss, the two-clicks-per-frame case, the restart-notice overwrite), which the author answered or left for a maintainer. The other 36 are resolved.

Bugs

  • Clicking Identify's Spectral Profile button clears Pick Points, because ui.pane.workflows resets workflow.pick unconditionally (lib.rs:2738). The PR says picking stays on until turned off. It loses no data. Inline comment posted on spectralui.rs:194. Confidence: medium. Severity: low.

I checked these and found no defect: the band wavelength readers in pam.rs (unit handling, duplicate and conflicting items, overflow and zero-rounding); the raster.spectral points, zone and lon/lat notices; the mosaic and workspace wavelength handling; the Weak-based staleness check against in-place edits; and the chart and CSV code.

Security

  • None found. The new points parameter is capped at 1000 and checked for shape, and the CSV export guards formula-leading cells.

Performance

  • None material. Per-frame work is a few linear layer lookups on a small layer list.

Quality

  • The new "band and class names and wavelengths are left out" wording is repeated in six or more places across pam.rs, geotiff.rs and cog.rs. A shared constant would stop the strings drifting. Left for the release quality pass.
  • docs/user-guide/data.md has one long line in the new paragraph, out of step with the paragraph's wrapping. Nit.
  • The PR body's size claim ("902 lines, 496 of them the new spectralui.rs") is out of date. The diff adds 1,638 lines, and spectralui.rs alone adds 832.

AGENTS.md

  • The screenshots are hosted on the contributor's fork (raw.githubusercontent.com/elpidioassinaturas/RustGIS/capturas-prs/...). AGENTS.md says images live in opengeos/rustgis-assets and are linked by assets.rustgis.app URLs. Confidence: medium-high. This is in the PR body, so it could not be posted inline.
  • Everything else I checked follows AGENTS.md: tl! and i18n::fmt for interface text, no unwrap or expect in new non-test code, the new raster.spectral params registered as a command, GeoLibre named as the source of the idea, and no new dependencies.

Change size

Compared with main (merge base 0fd8302 to PR head b31cc86).

Measure Value
Files changed 16 (added 1, modified 15, removed 0, renamed 0)
Size before 4.22 MB
Size after 4.30 MB
Total size change +83.3 KB
File Before After Change
crates/ui-egui/src/spectralui.rs 0 B 40.4 KB +40.4 KB
crates/data/src/raster/pam.rs 36.5 KB 59.6 KB +23.1 KB
crates/engine/src/tests.rs 2.01 MB 2.02 MB +9.5 KB
crates/engine/src/cmd/imagery.rs 97.0 KB 102.4 KB +5.4 KB
docs/user-guide/analysis.md 130.4 KB 131.7 KB +1.3 KB
crates/ui-egui/src/mapview.rs 259.4 KB 260.6 KB +1.2 KB
docs/user-guide/data.md 95.9 KB 96.8 KB +0.9 KB
crates/data/src/raster/mod.rs 92.1 KB 92.7 KB +647 B
crates/ui-egui/src/lib.rs 378.3 KB 378.5 KB +272 B
crates/ui-egui/src/panes.rs 409.5 KB 409.8 KB +267 B
crates/ui-egui/src/ribbon.rs 245.5 KB 245.7 KB +169 B
crates/ui-egui/src/analysispane.rs 116.6 KB 116.5 KB −109 B
crates/analysis/src/warp.rs 81.9 KB 82.0 KB +73 B
crates/data/src/raster/cog.rs 53.3 KB 53.4 KB +48 B
crates/data/src/raster/geotiff.rs 174.3 KB 174.3 KB +32 B
crates/tiles/src/cog.rs 89.4 KB 89.5 KB +16 B

elpidiofilho and others added 2 commits November 9, 2026 11:10
from_identify opens the section only when it isn't shown: ui.pane.workflows
ends any map pick, so running it with the section already open turned Pick
Points off. Switching section still ends it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Code review

I found nothing new worth raising at high or medium confidence. I read the full diff, the surrounding code (the GDAL tag and sidecar readers in pam.rs, the raster.spectral and mosaic commands, spectralui.rs, the Identify pop-up and pane hooks), and the 45 existing threads. I did not build or run the tests, and the wasm build was not checked.

Bugs: none found. I traced the wavelength range and overflow checks, the first-kept and same-length merge rules, unit spellings, every raster.spectral lon/lat, points and zone combination with its left-out notice, the restart and rename paths in add_point, and the Identify shadowing check.

Security: none found. points is capped at 1,000 and each entry is validated. CSV names are formula-guarded. I found no unwrap, expect or unchecked indexing on the new non-test paths.

Performance: nothing significant. While the section is shown, each frame does layer_by_name scans that are linear in the number of layers. That is fine at normal project sizes.

Quality: nothing to act on now.

AGENTS.md

  • Medium confidence on the fact, low on whether it blocks: the screenshots in the PR body are hosted on the author's fork (elpidioassinaturas/RustGIS, branch capturas-prs). AGENTS.md says images live in opengeos/rustgis-assets, and these links break if that branch is removed.
  • GeoLibre (MIT) is named in the PR body and the file header, as CONTRIBUTING asks. No vendor assets or new dependencies are added.

Earlier concerns: 45 threads exist (8 open, 37 resolved). I did not repost any. The open ones I agree with as the author left them: sidecar precedence over the embedded tag, duplicated-map identity, the export notice for dropped bands, and the restart notice erased on the next click.

Change size

Compared: the whole PR against main (merge base 0fd8302 to PR head 0396600).

Measure Value
Files changed 16 (1 added, 15 modified, 0 removed, 0 renamed)
Size before 4.2 MB
Size after 4.3 MB
Total size change +84.2 KB
File Before After Change
crates/ui-egui/src/spectralui.rs 0 B 41.4 KB +41.4 KB
crates/data/src/raster/pam.rs 36.5 KB 59.6 KB +23.1 KB
crates/engine/src/tests.rs 2.01 MB 2.02 MB +9.5 KB
crates/engine/src/cmd/imagery.rs 97.0 KB 102.4 KB +5.4 KB
docs/user-guide/analysis.md 130.4 KB 131.7 KB +1.3 KB
crates/ui-egui/src/mapview.rs 259.4 KB 260.6 KB +1.2 KB
docs/user-guide/data.md 95.9 KB 96.8 KB +0.9 KB
crates/data/src/raster/mod.rs 92.1 KB 92.7 KB +0.6 KB
crates/ui-egui/src/lib.rs 378.3 KB 378.5 KB +272 B
crates/ui-egui/src/panes.rs 409.5 KB 409.8 KB +267 B
crates/ui-egui/src/ribbon.rs 245.5 KB 245.7 KB +169 B
crates/ui-egui/src/analysispane.rs 116.7 KB 116.6 KB −109 B
crates/analysis/src/warp.rs 81.9 KB 82.0 KB +73 B
crates/data/src/raster/cog.rs 53.3 KB 53.4 KB +48 B
crates/data/src/raster/geotiff.rs 174.3 KB 174.3 KB +32 B
crates/tiles/src/cog.rs 89.4 KB 89.5 KB +16 B

@elpidioassinaturas

Copy link
Copy Markdown
Contributor Author

Screenshots: the PR body now uses GitHub attachments (github.com/user-attachments/assets/…), as docs/contributing.md allows for PR screenshots, instead of links to a branch on my fork. Nothing depends on that branch any more, and no image is committed to this repository.

🤖 Addressed by Claude Code

elpidiofilho and others added 2 commits November 9, 2026 14:04
Keeps both sides in crates/engine/src/tests.rs: the spectral profile tests and main's reload streamed-geometry test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread crates/ui-egui/src/spectralui.rs Resolved
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the 45 prior review threads (19 outdated), and the surrounding source. The new code is careful about hostile input: no unwrap/expect/unsafe in non-test code, sizes are capped, and the Never-silent notices are present for the cases I traced. I found one new concern, and I left the 45 earlier threads alone because they were already raised (or answered by the author and accepted by a maintainer). Nothing was approved, merged, or changed.

Bugs

  • None confirmed. I traced the points path (raster.spectral points/lon/lat/zone precedence and notices), the wavelength readers (tag and sidecar: units, dedup, range), the mosaic comparisons, and the spectral section's restart and stale-point logic. I found no concrete wrong output.

Security

  • None found. Command inputs are bounded (1000 points, string/array checks, XML node limits), and CSV cells are formula-guarded.

Performance

  • None worth raising. Per-frame work in the section is linear in the layer count, and the points path is O(points × bands).

Quality

  • Unreadable multiband rasters are dropped without a word (confidence medium-low). multiband and offered skip layers with data == None, including layers whose load failed (RasterLayer::error). The section then reads "Add a raster of two or more bands first," which misleads a user whose six-band scene failed to open. Posted inline at crates/ui-egui/src/spectralui.rs:162, with a suggested count-and-say fix.

AGENTS.md

  • The rules I checked are met: translatable strings use tl!/i18n::fmt, the CSV export is gated off wasm, the new Band field is set at its only literal, and the command-side writers that copy band names now copy wavelengths too (rebuild, process/resample, mosaic, clip, edit, warp).
  • The Pick Points loop runs raster.spectral on the UI thread for each click. Its cost is O(1) per point, so I did not raise it under "Never hold the window."

Earlier concerns left alone: 45 threads, of which 19 are marked outdated. Of the open or accepted ones, the sidecar-overrides-tag precedence, the GeoTIFF writer's band loss, and duplicate-map identity were answered and accepted by maintainers.

Change size

Compared with the base branch (merge base f62c795 to PR head 2fffea2). The stats are not truncated.

Measure Value
Files changed 16 (1 added, 15 modified, 0 removed, 0 renamed)
Size before 4.33 MB (4,540,291 B)
Size after 4.41 MB (4,626,528 B)
Total size change +84.2 KB (+86,237 B)
Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 41.4 KB +41.4 KB
crates/data/src/raster/pam.rs 36.5 KB 59.6 KB +23.1 KB
crates/engine/src/tests.rs 2.11 MB 2.12 MB +9.5 KB
crates/engine/src/cmd/imagery.rs 97.4 KB 102.8 KB +5.4 KB
docs/user-guide/analysis.md 132.6 KB 133.9 KB +1.3 KB
crates/ui-egui/src/mapview.rs 267.0 KB 268.2 KB +1.2 KB
docs/user-guide/data.md 98.7 KB 99.6 KB +0.9 KB
crates/data/src/raster/mod.rs 92.6 KB 93.2 KB +0.6 KB
crates/ui-egui/src/lib.rs 379.0 KB 379.3 KB +0.3 KB
crates/ui-egui/src/panes.rs 409.8 KB 410.1 KB +0.3 KB
crates/ui-egui/src/ribbon.rs 245.8 KB 245.9 KB +169 B
crates/ui-egui/src/analysispane.rs 116.7 KB 116.6 KB −109 B
crates/analysis/src/warp.rs 81.9 KB 82.0 KB +73 B
crates/data/src/raster/cog.rs 53.3 KB 53.4 KB +48 B
crates/data/src/raster/geotiff.rs 174.3 KB 174.3 KB +32 B
crates/tiles/src/cog.rs 89.5 KB 89.5 KB +16 B

A raster whose pixels failed to load was left out of the section's list without a word, so a
failed six-band scene read as "Add a raster of two or more bands first".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread docs/user-guide/analysis.md Resolved
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security issues, or performance problems in the changed lines. I read the whole diff, the 46 earlier review threads, and the code they point at, and checked the cross-crate callers. I could not compile or run the tests here (no shell in this session), so the checks below are by reading only.

Bugs: none found.

Security: none found. CSV cells are guarded against formula injection, and the new points input is capped at 1000 and checked for shape.

Performance: none worth raising. raster() returns an Arc, so each point read is cheap. multiband() runs per frame while the section is open, but layer_by_name is a plain scan with no allocation.

Quality:

  • Nit, posted inline (docs/user-guide/analysis.md:1460): "gives a profile a point" is garbled and should read "gives one profile per point". Low confidence that it matters, high confidence it is unclear.
  • Nit, not posted: the test a_sidecar_band_takes_its_first_wavelength_that_is_a_length also holds the keep_first_wavelength tolerance checks, which belong in their own test. Confidence high, impact low.

AGENTS.md: I checked the never-crash, never-silent, background-work, wasm-gating, translation (i18n::fmt in the UI), layering, attribution (GeoLibre is named in the PR and the file header), and screenshot rules. The ribbon guidelines apply to new controls only, and this PR only changes an existing tooltip. No violations found.

Checked and ruled out:

  • All band-name copy sites now carry wavelengths.
  • Every Band and PamBand literal either uses ..Default or is the one the diff updated.
  • Every new helper and icon the UI calls exists.
  • The "left out" notice logic covers every combination of zone, points, lon, and lat.
  • The Pick Points clear on a section change is accurate: analysispane.rs:463 clears the pick, and lib.rs:2750 clears it in ui.pane.workflows.
  • Raster data is reassigned only on explicit reload paths, so the profile's "changed or gone" notice is not triggered by normal use.

Earlier concerns left alone: 46 review threads are in prior-reviews.json, and I did not re-raise any of them. Four remain open by maintainer decision: the sidecar overriding the embedded tag, the GeoTIFF writers' band-loss notice, stable map identity, and the wording of the restart message. The author's answers to those are sound.

Change size

Compared with main (merge base f62c795 to PR head 4045368).

Measure Value
Files changed 16 (1 added, 15 modified, 0 removed, 0 renamed)
Size before 4.33 MB (4,540,291 B)
Size after 4.41 MB (4,628,007 B)
Total size change +83.7 KB
Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 42.8 KB +42.8 KB
crates/data/src/raster/pam.rs 36.5 KB 59.6 KB +23.1 KB
crates/engine/src/tests.rs 2.11 MB 2.12 MB +9.5 KB
crates/engine/src/cmd/imagery.rs 97.3 KB 102.8 KB +5.4 KB
docs/user-guide/analysis.md 132.6 KB 133.9 KB +1.3 KB
crates/ui-egui/src/mapview.rs 267.0 KB 268.2 KB +1.2 KB
docs/user-guide/data.md 98.7 KB 99.6 KB +0.9 KB
crates/data/src/raster/mod.rs 92.6 KB 93.2 KB +0.6 KB
crates/ui-egui/src/lib.rs 378.8 KB 379.1 KB +0.3 KB
crates/ui-egui/src/panes.rs 409.8 KB 410.1 KB +0.3 KB
crates/ui-egui/src/ribbon.rs 245.8 KB 246.0 KB +0.2 KB
crates/ui-egui/src/analysispane.rs 116.6 KB 116.5 KB −0.1 KB
crates/analysis/src/warp.rs 81.9 KB 81.9 KB +0.1 KB
crates/data/src/raster/cog.rs 53.3 KB 53.4 KB +0.0 KB
crates/data/src/raster/geotiff.rs 174.3 KB 174.3 KB +0.0 KB
crates/tiles/src/cog.rs 89.5 KB 89.5 KB +0.0 KB

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Code review

Bugs: No defects found in the changed lines. I traced the wavelength readers, wavelength_nm, the sidecar and tag merge, the raster.spectral points and zone paths, add_point/fresh/follow_rename, the mosaic notices and the chart index math. The new pixel_at/value calls bounds-check, so hostile coordinates take the "outside" path. Not compiled or run here; I checked by reading only.

Security: None found. The CSV export guards names against formula injection and writes only to a user-chosen path. raster.spectral stays Effects::NONE with no file access.

Performance: Negligible. The popup and section paths do a few layer_by_name scans per frame, which is fine for normal layer counts. raster() returns an Arc clone.

Quality: Nothing new beyond the earlier threads.

Never silent / AGENTS.md (1 finding, outside the diff, confidence medium-high on the mechanism, low severity): crates/engine/src/cmd/layer.rs:3820-3824 decides whether to warn that a cloud-optimised GeoTIFF drawn in place lost band metadata. It checks only descriptions and class names. A header that carries only wavelengths, which this PR now reads into Band::wavelength, gets no notice, so those wavelengths are dropped silently. Suggested fix: add || b.wavelength.is_some() to that named check, change the message to "band, class or wavelength metadata", and add a test for a wavelength-only COG drawn in place. I could not post this inline because layer.rs is not in the PR's changed files, so the comment is anchored nowhere in the diff.

Earlier concerns: I left 47 existing review threads alone. They were already raised, answered or resolved, and I did not see new evidence against any of the answers.

Change size

Compared: the whole PR against main (merge base f62c795 to PR head ea39667).

Measure Value
Files changed 16 (1 added, 15 modified, 0 removed, 0 renamed)
Size before 4.33 MB
Size after 4.41 MB
Total size change +85.7 KB
Path Before After Change
crates/ui-egui/src/spectralui.rs 0 B 42.8 KB +42.8 KB
crates/data/src/raster/pam.rs 36.5 KB 59.6 KB +23.1 KB
crates/engine/src/tests.rs 2.11 MB 2.12 MB +9.5 KB
crates/engine/src/cmd/imagery.rs 97.4 KB 102.8 KB +5.4 KB
docs/user-guide/analysis.md 132.6 KB 133.9 KB +1.3 KB
crates/ui-egui/src/mapview.rs 267.0 KB 268.2 KB +1.2 KB
docs/user-guide/data.md 98.7 KB 99.6 KB +0.9 KB
crates/data/src/raster/mod.rs 92.6 KB 93.2 KB +0.6 KB
crates/ui-egui/src/lib.rs 379.0 KB 379.3 KB +0.3 KB
crates/ui-egui/src/panes.rs 409.8 KB 410.1 KB +267 B
crates/ui-egui/src/ribbon.rs 245.8 KB 245.9 KB +169 B
crates/ui-egui/src/analysispane.rs 116.7 KB 116.5 KB −109 B
crates/analysis/src/warp.rs 81.9 KB 82.0 KB +73 B
crates/data/src/raster/cog.rs 53.3 KB 53.4 KB +48 B
crates/data/src/raster/geotiff.rs 174.3 KB 174.3 KB +32 B
crates/tiles/src/cog.rs 89.5 KB 89.5 KB +16 B

A cloud-optimised GeoTIFF drawn in place said only band and class names were left for a window;
a header with only wavelengths, which this PR now reads, lost them without a word.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elpidioassinaturas

Copy link
Copy Markdown
Contributor Author

Re the review summary: fixed in 29677ce. The tile-layer notice in crates/engine/src/cmd/layer.rs now also counts a band's wavelength, and says "drawn in place without its band names, class names or wavelengths: a window ("bbox") reads them". New test: a_tile_layer_says_its_wavelengths_need_a_window, with a wavelength-only COG built by cog::example_with (new wavelengths option).

🤖 Addressed by Claude Code

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no new defects in the changed code, so there are no inline comments. I read the full diff, the 47 existing review threads, and the surrounding code for each changed path. I could not build or run the tests here, so compile, clippy and test results come from the CI run, not from this review.

Bugs: none new.

  • The spectral() notice matrix (zone, points, lon/lat) covers every combination of inputs, including zone with lon/lat, which an earlier thread raised and the author fixed.
  • Stale-point detection uses Weak::ptr_eq against the raster's Arc. Arc::make_mut disassociates weak references, so in-place edits are detected. A Weak also keeps its allocation, so the address cannot be reused.
  • add_point's restart paths (other raster, other map, changed raster) and the eviction message are consistent.
  • Mosaic wavelength handling for missing versus differing values is consistent in raster_mosaic and mosaic_work.

Security: none. The new points input is bounded to 1000 entries, non-finite and non-array values are rejected, and CSV cells are formula-guarded.

Performance: none worth raising. Each Pick Points click reads one point, and the 1000-point path is bounded and cheap per point.

Quality (non-blocking, for the release quality pass): read_wavelengths in pam.rs and the sidecar loop in parse_sidecar repeat the same unit and wavelength rules. A shared helper would remove that duplication. Confidence: medium.

AGENTS.md:

  • No unwrap, expect or panic in non-test code, and indexing uses get.
  • Every new loss is reported: wavelengths, units, and out-of-range values produce counted notices with tests both ways.
  • Every name-copy site in imagery.rs also copies the wavelength (rebuild, process_work, raster_mosaic, clip_window, edit_pixels, mosaic_work).
  • New interface strings use tl! or i18n::fmt. Engine notices use format!, as their neighbours do.
  • The wasm-only gaps are covered: csv and the export button are cfg(not(wasm32)), and the profile uses std::sync::Weak.
  • No dependencies or assets were added.
  • Not verified offline: the GeoLibre MIT licence claim, and whether egui_kittest and base64 are available to the new tests (both are listed in the Cargo.toml files I checked).

Prior reviews: 47 threads, all resolved. I left all 47 alone and re-raised none. Several were settled by maintainer decision: sidecar precedence over the embedded tag, export notices for other writers, duplicated-map identity, and the empty-restart message.

Change size

Compared: the whole PR against main (merge base f62c795 to PR head 29677ce).

Measure Value
Files changed 17 (1 added, 16 modified, 0 removed, 0 renamed)
Size before 4.6 MB
Size after 4.7 MB
Total size change +87.1 KB
File Before After Change
crates/ui-egui/src/spectralui.rs 0 B 42.8 KB +42.8 KB
crates/data/src/raster/pam.rs 36.5 KB 59.6 KB +23.1 KB
crates/engine/src/tests.rs 2.1 MB 2.1 MB +10.4 KB
crates/engine/src/cmd/imagery.rs 97.4 KB 102.8 KB +5.4 KB
docs/user-guide/analysis.md 132.6 KB 133.9 KB +1.3 KB
crates/ui-egui/src/mapview.rs 266.9 KB 268.2 KB +1.2 KB
docs/user-guide/data.md 98.7 KB 99.6 KB +889 B
crates/data/src/raster/mod.rs 92.6 KB 93.2 KB +647 B
crates/data/src/raster/cog.rs 53.3 KB 53.8 KB +526 B
crates/ui-egui/src/lib.rs 379.0 KB 379.3 KB +272 B
crates/ui-egui/src/panes.rs 409.8 KB 410.1 KB +267 B
crates/ui-egui/src/ribbon.rs 245.8 KB 245.9 KB +169 B
crates/ui-egui/src/analysispane.rs 116.7 KB 116.6 KB -109 B
crates/engine/src/cmd/layer.rs 262.1 KB 262.2 KB +97 B
crates/analysis/src/warp.rs 81.9 KB 82.0 KB +73 B
crates/data/src/raster/geotiff.rs 174.3 KB 174.3 KB +32 B
crates/tiles/src/cog.rs 89.5 KB 89.5 KB +16 B

@giswqs

giswqs commented Nov 9, 2026

Copy link
Copy Markdown
Member

Screenshots from ui_shot on the PR head merged with main: a 6-band GeoTIFF over the Ebro delta, Spain, with Sentinel-2 central wavelengths in its GDAL metadata tag. Pick Points on, four points clicked (1 water, 2 rice paddy, 3 bare soil, 4 built-up), charted against wavelength with matching numbered markers on the map. The signatures come out as expected (water falling off in the NIR, vegetation's red edge peak at B08, soil rising into the SWIR).

Light theme

Spectral profile with four points, light theme

Dark theme

Spectral profile with four points, dark theme

@giswqs

giswqs commented Nov 9, 2026

Copy link
Copy Markdown
Member

@coderabbitai approve

@giswqs giswqs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @elpidioassinaturas, this is a careful, well-tested piece of work and does what #1622 asked: wavelengths read from the GDAL tag and the sidecar (and written back), raster.spectral taking points, and the profile in the Workflows section with Identify's button.

Review notes:

  • Read the full diff against AGENTS.md: no panics in non-test code, every left-out wavelength, unit or point is said with a count, the per-click read is one pixel so it stays on the UI thread, strings go through tl!/i18n::fmt, and the wasm build passes.
  • Ran clippy (-D warnings) and the data, engine and ui-egui tests locally on the PR merged with main, all green, plus the spectral UI tests.
  • Rendered it with ui_shot on a 6-band scene with Sentinel-2 wavelengths (light and dark, in the comment above): markers, line colours and the wavelength axis line up, and the signatures look right.
  • Merged main into the branch (clean). Your three later commits (unread rasters counted, the tile-layer COG wavelength notice) look good.
  • Resolved the open bot threads with maintainer replies: the sidecar-over-tag precedence follows GDAL, the once-per-frame click and section-change pick claims check out, Export Raster already says which bands it drops, and stable map ids are out of scope here.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor
Action performed

Comments resolved and changes approved.

@giswqs
giswqs merged commit 6cb3302 into opengeos:main Nov 9, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Spectral profile: chart and compare a multiband raster's bands at points clicked on the map

3 participants