Skip to content

Summarise the values a field actually has - #124

Merged
rajeeja merged 1 commit into
mainfrom
rajeeja/nan-summary
Sep 6, 2026
Merged

Summarise the values a field actually has#124
rajeeja merged 1 commit into
mainfrom
rajeeja/nan-summary

Conversation

@rajeeja

@rajeeja rajeeja commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

summarize_array used plain min/max/mean, which propagate NaN, so a field masked over half its faces reported min, max and mean all NaN while three faces held finite values. The same payload was also not valid JSON, since json.dumps writes NaN as a bare NaN token that a strict client rejects. Statistics now skip non-finite entries, report None when nothing is finite, and add n_finite/n_total only when they differ; 880 passed, 18 skipped locally with pre-commit green.

summarize_array called plain min/max/mean, which propagate NaN, so one
missing value emptied all three statistics. Measured on a temporal mean
of a field masked over half its faces: three faces held finite means and
the summary reported min, max and mean all NaN. Land masks are ordinary
here, so that was most fields.

The same payloads were not valid JSON either. json.dumps writes NaN as
the bare token NaN, which no parser is required to accept, so a strict
client rejected the whole result rather than the one number.

Statistics now skip non-finite entries, report None when nothing is
finite, and carry n_finite/n_total only when the two differ, so a
complete field costs no extra bytes.
@rajeeja
rajeeja merged commit a6b4f80 into main Sep 6, 2026
12 checks passed
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.

1 participant