Repository navigation
Conversation
NumPy concatenate discards masks from MaskedArray inputs, allowing hidden cells to alter the covariance modes and unmasking the returned spatial fields. Use masked concatenation when any field is masked. Promote integral masked fields so the downstream NaN representation can preserve their missing cells. Keep ordinary ndarray and Dask concatenation unchanged.
This branch has not been deployed
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.
MultivariateEofdocuments support for masked arrays, butnp.concatenatediscards their masks when merging fields. Changing values underneath a mask then changes the eigenvalues and includes excluded cells in the returned EOFs:Use
np.ma.concatenatewhen a field is masked so the existing solver excludes those cells. Promote masked integral merged arrays to float for the solver's NaN representation. This also preserves masks inprojectField; ordinary array concatenation stays unchanged.Seven regressions cover mixed/both masked fields, weighting, projections and integral inputs. The full suite passes on Python 3.12 with Iris/xarray/Dask and the core suite passes on 3.8. Independent valid-cell SciPy SVD checks on the bundled SST data cover eigenvalues, projections, reconstructions and masks through the standard and Iris interfaces. Previously correct complete outputs remain exact, including additional float32/float64 and Dask controls. A clean installed wheel repeats the results; composition with #166 preserves its covariance workloads.