Skip to content

docs(investigate): significant-figure and float-noise findings (DIE-403) - #156

Open
jirhiker wants to merge 4 commits into
mainfrom
DIE-403-docs-investigate-inconsistent-significant-figures-across-sources-many-values-show-long-trailing-decimals
Open

jirhiker wants to merge 4 commits into
mainfrom
DIE-403-docs-investigate-inconsistent-significant-figures-across-sources-many-values-show-long-trailing-decimals

Conversation

@jirhiker

@jirhiker jirhiker commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Investigation for DIE-403: why output products show long trailing decimals (70.44800000000001) and inconsistent precision across sources. Adds docs/precision-investigation.md. No code changes; fixes are proposed as follow-up tickets.

Findings

  • Where users saw it: the nm_waterlevels_summary attribute table, in min/mean/max.

  • Root cause: the CLI's CSV writer rounded via BaseRecord.to_row() → _get_sigfig_formatted_value() (backend/record.py:55). That path was deleted with the CLI (e836103). The Dagster/OGC path builds features with getattr(record, k) in ogc_features.py, so nothing rounds anymore.

  • Two effects: binary float noise from multiplying by conversion factors, and false precision (more digits than measured) from both conversions and summary means.

  • Where the digits come from:

    • unit conversion (converter.py:125)
    • m↔ft length conversion (transformer.py:107-110)
    • the CABQ stickup double conversion
    • the summary mean (source.py:136)

    Summary min/max inherit the conversion artifacts.

  • Affected: NMBGMR and ST2 site elevations (reported in m), any analyte with a non-1.0 conversion factor, and summary means. Derived products already round.

Recommendation (agreed in review)

  1. Count the source value's decimal places at ingest.
  2. Shift that count by the conversion factor's order of magnitude: max(0, decimals_in - floor(log10(factor))).
  3. Carry the count on the record.
  4. Round once, when the output features are built, after all calculations.

Conversion factors are treated as exact, which has to be documented. The doc has a comparison table against the CLI's 2 decimals and against source significant figures.

Proposed follow-ups (not created in Jira)

  1. Round outputs to shifted source decimal places, with regression tests; remove the dead CLI rounding path.
  2. Data services unit-conversion precision policy doc (should land before or with 1).
  3. Optional: keep raw source value strings so trailing zeros survive.
  4. Fix the CABQ stickup elevation double conversion.

Testing

Docs only. The example values in the doc were checked numerically against the current conversion code. tests/test_product_docs.py has 3 failures that also happen on main without this change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RzW3G3NuggiZgMwKDeKLab

…gs (DIE-403)

Trace the long trailing decimals in OGC products to the CLI retirement:
the CLI's CSV path rounded via BaseRecord._get_sigfig_formatted_value, the
Dagster path reads raw attributes. Lists affected sources/fields, where the
digits are introduced (unit conversion, length conversion, CABQ stickup,
summary mean), and recommends a data-level rounding policy plus follow-ups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RzW3G3NuggiZgMwKDeKLab
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Your pull request is automatically being deployed to Dagster Cloud.

Location Status Link Updated
die-orchestration View in Cloud Nov 20, 2026 at 10:17 PM (UTC)

…cimals (DIE-403)

Fixed decimals would zero out low analyte concentrations after ug/L to
mg/L conversion. The converter already receives the raw source value, so
sig-fig rounding can be centralized there without connector changes.
Separate float noise from repeating-decimal means in the findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RzW3G3NuggiZgMwKDeKLab
@jirhiker
jirhiker marked this pull request as ready for review November 18, 2026 23:04

@chasetmartin chasetmartin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good, answered a couple outstanding questions in order to help refine the recommendations.

Comment thread docs/precision-investigation.md Resolved
Comment thread docs/precision-investigation.md Resolved
Comment thread docs/precision-investigation.md Resolved
… examples (DIE-403)

Water levels summary min/mean/max is where users saw the issue; explain
why mean is always affected and min/max only for meter-reporting sources.
Drop the optional 2-decimal cap per review and fix the mean example.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RzW3G3NuggiZgMwKDeKLab
Comment thread docs/precision-investigation.md Resolved
…tput (DIE-403)

Replace the significant-figures recommendation with the rule agreed in
review: count source decimals at ingest, shift by the conversion factor's
order of magnitude, carry them on records and round once when output
features are built. Add a comparison table and update follow-ups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RzW3G3NuggiZgMwKDeKLab

@chasetmartin chasetmartin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, I will added the necessary tickets to Jira after merge

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.

4 participants