Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reconstructedField #99

Closed
daizhouchiwang opened this issue Aug 9, 2018 · 1 comment
Closed

reconstructedField #99

daizhouchiwang opened this issue Aug 9, 2018 · 1 comment

Comments

@daizhouchiwang
Copy link

daizhouchiwang commented Aug 9, 2018

Hi,

I have used the eofs reconstructedField() function to reconstructing the matrix that decomposed by Eof, but I found that even the neofs is setted as the maximum, I still cannot get the original dataset. I check through out the code, and found that the center value haven't be added back to the reconstruced dataset. Could your help me to make sure that?

# This is the code that I used to do the simple test
import numpy as np
import matplotlib.pyplot as plt
from eofs.standard import Eof

a = np.random.randint(-10,10,(10,20))
solver = Eof(a)
reconstructed_data = solver.reconstructedField(solver.neofs)
plt.scatter(a.reshape(-1),reconstructed_data.reshape(-1))
plt.grid()
plt.show()

plt.scatter(a.reshape(-1),(reconstructed_data+a.mean(axis=0)).reshape(-1))
plt.grid()
plt.show()
@ajdawson
Copy link
Owner

ajdawson commented Aug 9, 2018

I would recommend always removing the mean yourself before passing the array to the solver, the automatic removal is more of a convenience thing. For that reason the subtracted mean is deliberately not stored and added back when reconstructing a field.

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

No branches or pull requests

2 participants