You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For intermittent data on a fixed grid, we should really support handling nans.
Since we expect vectorized methods to truly be so much faster, for intermittent gridded data we need to have nan exclusion support.
TBD if this is built in or via extension
Done for gridded input, which is what this issue's dependency on #23 was about. Unstructured NaN is still open — see below.
Gridded. Validity flows through the whole gridded path: field_validity(u, Val(D), cell_mask) combines the grid's own mask (which cells exist) with the field's finiteness (which cells hold a usable datum) — a cell can exist and still be NaN, so the two are separate questions. A pair counts only when both ends hold a datum.
Both gridded algorithms honour it:
the lag sweep selects rather than multiplies (ok ? v : 0), because an empty cell may hold NaN and NaN * 0 is NaN
the transform replaces missing values with zero before transforming, for the same reason — one NaN would otherwise spread across the entire spectrum
Counts are computed two different ways, deliberately. With a complete field the count stays exact integer arithmetic (∏ periodic ? n_d : n_d − |h_d|); with cells missing it is the mask autocorrelation. So the masked-transform-vs-masked-sweep test compares two genuinely different count computations rather than one against itself.
This is also what makes spectra from gappy data work, which is the practical payoff. Recovering a spectrum through the structure function versus zero-filling the gaps and transforming directly, against the complete-field answer:
cells missing
via the structure function
zero-fill and FFT
10 %
0.015
0.191
30 %
0.036
0.543
50 %
0.041
0.769
At half the data gone the structure-function route is within a few percent while the direct transform is off by ~80 %, because D(r) remains an unbiased average over surviving pairs while the field's own transform does not.
Still open: unstructured NaN. On scattered points a NaN datum is simply a point to drop before the sweep, which is cheaper than carrying a mask — but there is currently no entry point that does it for you.
Activity
jbphyswx commentedon Sep 6, 2026
Done for gridded input, which is what this issue's dependency on #23 was about. Unstructured NaN is still open — see below.
Gridded. Validity flows through the whole gridded path:
field_validity(u, Val(D), cell_mask)combines the grid's own mask (which cells exist) with the field's finiteness (which cells hold a usable datum) — a cell can exist and still beNaN, so the two are separate questions. A pair counts only when both ends hold a datum.Both gridded algorithms honour it:
ok ? v : 0), because an empty cell may holdNaNandNaN * 0isNaNNaNwould otherwise spread across the entire spectrumCounts are computed two different ways, deliberately. With a complete field the count stays exact integer arithmetic (
∏ periodic ? n_d : n_d − |h_d|); with cells missing it is the mask autocorrelation. So the masked-transform-vs-masked-sweep test compares two genuinely different count computations rather than one against itself.This is also what makes spectra from gappy data work, which is the practical payoff. Recovering a spectrum through the structure function versus zero-filling the gaps and transforming directly, against the complete-field answer:
At half the data gone the structure-function route is within a few percent while the direct transform is off by ~80 %, because
D(r)remains an unbiased average over surviving pairs while the field's own transform does not.Still open: unstructured NaN. On scattered points a
NaNdatum is simply a point to drop before the sweep, which is cheaper than carrying a mask — but there is currently no entry point that does it for you.jbphyswx commentedon Nov 11, 2026
Closed by #39