Repository navigation
fix(engine): Identify gives a pixel's values in full - #3543
Conversation
A raster's values in Identify were written as a legend's numbers are, so 10602 showed as "11K" and 0.004 as "0.00". They are now the shortest text that reads back the same value. Part of opengeos#2761.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| /// A pixel's value in full, as the shortest text that reads back the same `f32`: not a legend's | ||
| /// rounded number, which gave 10602 as "11K" (#2761). One too large or too small to read as plain | ||
| /// digits has an exponent. |
There was a problem hiding this comment.
The doc says the text is the value "in full", and the title says the same. For a 32-bit integer or 64-bit float band the value was already rounded to f32 when the raster was read, so that is the value shown: for example 123456789 on an Int32 band shows as 123456790. The reader already reports that rounding (r.rounded), and the PR body says so, so nothing is lost silently here. The doc should still say "the layer's f32 value in full" so it doesn't promise more. The (#2761) and "11K" references describe the old output, not this code, so they belong in the PR, not in the function's doc.
Category: quality
There was a problem hiding this comment.
Agreed on the wording: "the layer's f32 value in full", without the old output. Left for the release quality pass.
| /// Identify gives each band's value in full, whatever its size (#2761). | ||
| #[test] | ||
| fn identify_gives_pixel_values_in_full() { | ||
| let values = [10_602.0, 65_535.0, 1_234_567.0, 0.1, 273.153, -0.004, 0.0, 1e-30, -3.4e38]; |
There was a problem hiding this comment.
The test covers the exponent form only at 1e-30 and -3.4e38, and the plain form only in the middle of the range. The two thresholds that pick the form, 1e-5 (plain from there up) and 1e16 (exponent from there up), are not pinned. Adding 1e-5 (expected "0.00001") and 1e-6 (expected "1e-6") and 1e16 (expected "1e16") to values would cover both edges cheaply. Category: quality
There was a problem hiding this comment.
Agreed: 1e-5, 1e-6 and 1e16 would pin both edges. Left for the release quality pass.
Code reviewThis PR changes one function, BugsNone found.
SecurityNone found. PerformanceNone found. One small Quality
AGENTS.mdNo rule broken. The change adds no command or parameter (so Earlier review threadsNone on this PR, so I left none alone. Change sizeCompared with
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
Summary
Identify wrote a raster's values the way a legend writes its numbers, so 10602 showed as
11K, 1234.5 as1234and 0.0042 as0.00. It now gives each value in full, as the shortest text that reads back the samef32. A value below 1e-5 or from 1e16 up has an exponent. Legends keep their rounded numbers.Not changed: values are still the ones the layer holds. A 32-bit integer or 64-bit float that
f32rounds is shown rounded, and a raster read in place or from an overview gives the overview's pixel. Those are separate steps of #2761.Surfaces: every one that runs
identify(desktop, browser, phone, command line, Python, Assistant and MCP), as it changes the command's own answer. No parameter, saved format or undo step changes. Nothing in the repository parses this text.Testing
identify_gives_pixel_values_in_full: fails before the change (["11K", "66K", "1.2M", "0.10", "273", "-0.00", …]) and passes after. The other identify tests pass.UI evidence
Related issue
Part of #2761.
Summary by CodeRabbit