Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/eofs/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ def eofsAsCovariance(self, neofs=None, pcscaling=1):
# the covariance maps.
data = self._data.reshape((self._records,) + self._originalshape)
if self._weights is not None:
data = data.copy()
with warnings.catch_warnings():
warnings.simplefilter('ignore', RuntimeWarning)
data /= self._weights
Expand Down
8 changes: 8 additions & 0 deletions lib/eofs/tests/test_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ def test_eofsAsCovariance(self):
eofs *= sign_adjustments(eofs, reofs)
self.assert_array_almost_equal(eofs, reofs)

@pytest.mark.parametrize('pcscaling', (0, 1, 2))
def test_eofsAsCovariance_repeated(self, pcscaling):
first = self._tomasked(self.solver.eofsAsCovariance(
neofs=self.neofs, pcscaling=pcscaling))
second = self._tomasked(self.solver.eofsAsCovariance(
neofs=self.neofs, pcscaling=pcscaling))
self.assert_array_almost_equal(first, second)

def test_eofsAsCorrelation(self):
# EOFs as correlation between PCs and input field should match the
# reference solution
Expand Down