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

Some parameter wish to added in wavelet_coherence #623

Closed
thelightonmyway opened this issue Nov 8, 2024 · 4 comments
Closed

Some parameter wish to added in wavelet_coherence #623

thelightonmyway opened this issue Nov 8, 2024 · 4 comments

Comments

@thelightonmyway
Copy link

thelightonmyway commented Nov 8, 2024

I'm learning the method on wavelet_coherence in pyleoclim and I find it very convenient!

However, I'm facing some difficult that I found my plot is a little difference when I reproduce others work. I guess it's due to the resolution. How can I change some parameters to improve the resolution? For example, specify that mother wavelet as morlet wavelet, 2 months as the starting scale, 12 sub-octaves per octave and 84 as the total number of scales.

The left is my reproduction and the right is the result from the paper https://doi.org/10.1029/2023GL103323

image

By the way, the data series pre-processed could be download.
MonthlyAnomSWS_IP.txt
(The data from the paper https://doi.org/10.1029/2023GL103323)
and
pv.txt

Thanks, sincerely!

@CommonClimate
Copy link
Collaborator

Hello @thelightonmyway and glad you are finding the package useful!

Given that the paper you mention seems to use Aslak Grinstead's code, which was based on Torrence & Compo 1998, I believe you can achieve the results you want by playing with the frequency vector.

You can use this function to generate a frequency (scale) vector with the resolution you want and then pass it to Series.wavelet_coherence() as the freq argument. We show something similar in this tutorial though this is not exactly what you want. All you need to do to access the function I mentioned is
from pyleoclim.utils.wavelet import freq_vector_scale

then you'll be on your way. Please let us know what you get!

@CommonClimate
Copy link
Collaborator

PS: I am closing this issue as solved. In the future, questions of this kind are best asked in the discussion forum, as this is not an "issue" with the code, only a matter of usage.

@thelightonmyway
Copy link
Author

thelightonmyway commented Nov 12, 2024

Well, thank you for your kind guidance!@CommonClimate

I utilize the method freq_vector_scale following your teach, and I get the similar result as before. The difference is that, the scales number is decreased, which is what I want.

However, I'm confused that my result is still low-energy and the significant result is less than the result in paper. And when I set the confidence area not to show, I find my arrows is different compared with the paper, expect for the scales 8-16. I wonder if it could be the problem of the parameters from the function or others.

In addition, I find that the COI in my result is not complete. How can I complete it?
Besides, when I set the freq, I find the order is reversed , like this,

138dc3987131253d6b9797591da08d2

and I need change it to order. Otherwise, it appears error when I use coh=pv_series.wavelet_coherence(SWS_series,freq=freq). And the error shows, ValueError: negative dimensions are not allowed.

This is my new result.
cc580bcbfe8008197d4720b1f143ca3

@thelightonmyway thelightonmyway changed the title How to improve resolution of WTC? Some parameter wish to added in wavelet_coherence Nov 13, 2024
@CommonClimate
Copy link
Collaborator

It's not easy reproducing your graph exact, so once PR #635 is incorporated (should be a few minutes), can you please run this again and make sure you are getting the results you should?

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