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

Why are there different outputs of nicrie / xmca compared with outputs of Yefee's xMCA? #34

Open
zhiweijt opened this issue Apr 5, 2023 · 1 comment

Comments

@zhiweijt
Copy link

zhiweijt commented Apr 5, 2023

Hi, nicrie.
Recently, I perform a svd analysis using nicrie / xmca code, the both shapes of left and right field matrixes were (time, lat, lon), and the value of time axis is (2000, 2001, ..., 2022).
I can get outputs of mca.eofs and mca.pcs, but I wonder that outputs were opposite compared with outputs of mca.expansionCoefs() of Yefee's xMCA.
Finally, I found that the same outputs can be obtained when time axis was reorded in inverse order, that is, (2022,2021,...,2000).
I want to know, which one is right? Is it a bug in code?
Thanks a lot.
the outputs of mca.pcs() using nicrie / xmca code were showed as
image

the outputs of mca.expansionCoefs() using Yefee's xMCA code were showed as
image

@nicrie
Copy link
Owner

nicrie commented May 22, 2023

Hi zhiweijt - sorry for the late reply!
Upon examining the figures, the results do appear to be consistent. The PCs/EOFs are only defined up to a sign, meaning that an equivalent solution can be obtained by flipping the y-axis of both the PC and the corresponding EOF.

However, it is indeed unexpected to see that the x-axis (time) is inverted in xmca for the same input. This discrepancy might be related to how the time coordinate in the input DataArray is defined. Have you considered sorting the time axis of the DataArray before proceeding with the analysis?

Please note that the order of the data doesn't impact the computation of the EOFs. Hence, if the observed difference is solely due to different ordering of the time steps, the EOFs should remain identical in both packages. Can you confirm whether this is the case for your data?

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