Skip to content

fix: replace fill-value sentinels in HDF5 compound datasets - #96

Closed
Aman-Cool wants to merge 3 commits into
idtlab:developfrom
Aman-Cool:fix/hdf5-compound-fillvalue
Closed

fix: replace fill-value sentinels in HDF5 compound datasets#96
Aman-Cool wants to merge 3 commits into
idtlab:developfrom
Aman-Cool:fix/hdf5-compound-fillvalue

Conversation

@Aman-Cool

Copy link
Copy Markdown
Contributor

Related Issues / Pull Requests

Follow-up to #61, which closed #60.

Description

#61 fixed fill-value replacement for flat numeric HDF5 datasets by checking data.dtype.kind in ("f", "i", "u"). That guard intentionally skipped compound/structured datasets (dtype.kind == "V") — so they never go through _collect_fill_values, and their sentinel values (like -9999.0) land in the DataFrame as real data.

This is the exact same bug from #60, just for compound-typed datasets. The symptom is identical: completeness reports 100% on fields that have missing entries, and outlier detection spikes because the sentinel value is hundreds of standard deviations from the actual data.

The fix runs after pd.DataFrame(data) is built for a compound dataset; checks dtype.kind == "V", calls the existing _collect_fill_values method, and replaces matched sentinels with NaN on each numeric column. No new logic, just extends what #61 already set up to cover this case too.

Quick sanity check with a compound dataset (depth, temperature), _FillValue = -9999.0, one sentinel in temperature across 4 rows:

  • before the fix: isna().sum() -> 0, completeness -> 100%
  • after: isna().sum() -> 1, completeness -> 75%

What changes are proposed in this pull request?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected; for instance, examples in this repository must be updated too)
  • This change requires a documentation update

Checklist:

  • My code modifies existing public API, or introduces new public API, and I updated or wrote documentation
  • I have commented my code
  • My code requires documentation updates, and I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@Aman-Cool
Aman-Cool requested a review from a team as a code owner March 24, 2026 20:30
@Aman-Cool
Aman-Cool requested a review from kaveenh March 24, 2026 20:30
@Aman-Cool

Copy link
Copy Markdown
Contributor Author

@jeanbez @sbyna @kaveenh, Noticed this while stress-testing #61 with some real-world scientific HDF5 files, compound datasets were still coming back 100% complete even when they clearly had missing entries.
Took a bit to track down but the guard in #61 only covered flat numeric arrays, compound types just slipped right through. Reused _collect_fill_values since the logic was already there, just needed to hook it in after the DataFrame gets built.

@Aman-Cool Aman-Cool closed this by deleting the head repository Jun 20, 2026
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.

3:17 AM[Bug] HDF5 fill values silently reported as valid data — completeness score always 100% for fill-value-encoded missing values

1 participant