Repository navigation
fix(ExternalTimeSeries): match georeferenced single precision outputs - #1422
francoisbonneau wants to merge 3 commits into
Conversation
The matching tolerance was GLOBAL_EPSILON relative to the largest coordinate: about 7 m on UTM coordinates, wider than the cell size, so apply_to rejected the simulator outputs of georeferenced models as ambiguous. It now bounds the single precision rounding of the points, axis by axis (about 0.28 m on UTM coordinates). Point sets without transferable attribute (e.g. unique vertices when the simulator only writes cell data) are no longer matched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BotellaA
left a comment
There was a problem hiding this comment.
Review: corrections needed before merge
1. Python docstring is out of date (cross-repo consistency / documentation)
bindings/python/src/model/representation/core/external_time_series.cpp, docstring of apply_to (around line 62): it still says the tolerance is "GLOBAL_EPSILON relative to the largest coordinate when larger than 1". This PR changed the rule in the C++ header but not here. Per AGENTS.md, an inaccurate docstring is a bug. Please describe the new rule:
- the tolerance bounds the single precision rounding of the largest absolute coordinates;
- a point set without a transferable attribute is not matched.
2. Barycenter tolerance: misleading comment, possibly too tight (design)
src/geode/model/representation/core/external_time_series.cpp, matching_tolerance. The comment says "GLOBAL_EPSILON is added for the computations made on the rounded coordinates (e.g. barycenters)". At UTM magnitudes, 1e-6 covers none of that error.
Here is a case where a cell barycenter can fail to match:
- the simulator reads the mesh with float coordinates, averages the vertices into a cell center, and writes the center as a float again;
- the error can then reach a full float gap: ½ gap from averaging the rounded vertices, plus ½ gap from writing the result;
- at y ≈ 7e6 the gap is 0.5, so the error can reach 0.5 m, while the tolerance is ½ gap + 1e-6 ≈ 0.25 m.
Real GEOS outputs load, so GEOS probably computes cell centers in double. Still, please either:
- allow one full float gap for the barycenter matching; it stays far below typical cell spacing; or
- at least fix the comment so it does not claim barycenter errors are covered.
3. Missing test cases (tests)
check_georeferenced_model only covers the single-rounding case, which sits exactly at the tolerance limit. Its unique vertices carry no values. Please add:
- a negative case at UTM magnitude: a shift just above the tolerance must still throw
OpenGeodeException; - a case with values on the unique vertices at UTM magnitude, so that vertex matching is tested with data.
|
🤖 claude-cross-repo-review: complete |
…ferenced matching Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review, all three points are addressed in the last commit.
|
…ated Blocks - Several points matched with the same Block element (e.g. a vertex written with slightly different coordinates by several datasets) are accepted with an error log: the closest point is kept. - A Block is represented in a point set when one of its polyhedra is matched (cell barycenters) or one of its matched vertices belongs to no other Block (unique vertices). Every element of a represented Block must be matched, the other Blocks (e.g. outside of the simulated regions) are left untouched, including their vertices shared with simulated Blocks. - Both point sets are matched and checked before any value is written: a rejected time series leaves the model unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
ExternalTimeSeries::apply_tofails on GEOS outputs of a georeferenced model (UTM coordinates):GLOBAL_EPSILON× largest coordinate: 7.27 m in UTM, regardless of the cell size. On this mesh, thousands of vertices and cell barycenters have a neighbor closer than that, so they were always rejected as ambiguous. It is about 17× the actual single precision rounding (≤ 0.28 m).Changes
GLOBAL_EPSILONfor computations on rounded coordinates (e.g. barycenters).Tests
check_georeferenced_model: test_mesh3 scaled ×10 and translated to UTM coordinates, points rounded to float, cell values only.check_unattributed_vertices: duplicated unique vertices without values no longer prevent applying the cell values.🤖 Generated with Claude Code