fix: replace fill-value sentinels in HDF5 compound datasets - #96
Closed
Aman-Cool wants to merge 3 commits into
Closed
fix: replace fill-value sentinels in HDF5 compound datasets#96Aman-Cool wants to merge 3 commits into
Aman-Cool wants to merge 3 commits into
Conversation
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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; checksdtype.kind == "V", calls the existing_collect_fill_valuesmethod, and replaces matched sentinels withNaNon 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 intemperatureacross 4 rows:isna().sum()-> 0, completeness -> 100%isna().sum()-> 1, completeness -> 75%What changes are proposed in this pull request?
Checklist: