-
Notifications
You must be signed in to change notification settings - Fork 20
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
CCA with nan values #177
Comments
hey did you verify that you only have full-dimensional NaNs within your data? Grid cells representing land in SST data sets are full-dimensional and not a problem. However, there may be some hidden, individual NaNs within your data. Can you post the exact error message? |
File ~/miniconda3/lib/python3.10/site-packages/xeofs/models/cca.py:312, in CCA._fit_algorithm(self, views) ValueError: array must not contain infs or NaNs it show like above. |
Would it be possible for you to share a minimal working example that shows the error? Perhaps you can isolate the error for a small subset of the data that you can share so I can have a look at it? |
two datas have same time steps. |
Thank you for sharing the example. In theory, different spatial resolutions do not matter in the context of CCA. I'm not immediately sure what the underlying issue might be. Could you provide more details about the dataset sizes, specifically the number of samples and grid points for both PRCP and SST? Have you experimented with the I'd be happy to help you identify the issue :) But to assist you more effectively, I would need a fully reproducible example, including the data that demonstrates the error. |
thank you for your caring
at first, i set the variance_fraction to 0.9, but it still return the error 'ValueError: array must not contain infs or NaNs' whenever i set the option to the range of 0.1~0.9. |
Thanks for the info! What are the number of time steps in both data sets ? |
it was 20 same for both |
ok in that case it may be that you're indeed running into one of these edge cases mentioned above. Would you mind testing how many modes you need for each data set to explain at least 90 % of your variance? For this you want to fit an |
this data need at least 13 modes.
SST need at least 12 modes to explain 90% of variance. |
I'm not so sure about this anymore... Setting |
That's okay, thanks for your help in the meantime. |
hey @jiwon-j just in case you're still facing the same problem, you may give the new (xeofs version 3) xe.cross.CCA class a try and see if it solves the issue you had? This implementation of CCA is simpler (only allows 2 sets of data), but it's likely more robust than the one you used in version 2. |
Hello,
now i'm trying to conduct CCA with two datasets, SST(ERA5) and precipitation(GPCP).
i'm following this example(https://xeofs.readthedocs.io/en/latest/auto_examples/2multi/plot_cca.html),
However, I get an error saying that the array should not contain infs or NaNs.
I realize that the SST data used in the example code is a different ERSST than the one I used, but the SST data will naturally have a nan value for land, and that's what the result plot in the example shows.
Do I need to pre-process the nan values before CCA?
The text was updated successfully, but these errors were encountered: