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

Update series.py #485

Merged
merged 5 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions pyleoclim/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3257,11 +3257,15 @@ def wavelet_coherence(self, target_series, method='cwt', settings=None,
if method == 'wwz':
if 'ntau' in settings.keys():
ntau = settings['ntau']
settings.pop('ntau')
else:
ntau = np.min([np.size(ts1.time), np.size(ts2.time), 50])

tau = np.linspace(np.min(self.time), np.max(self.time), ntau)
if 'tau' in settings.keys():
tau = settings['tau']
settings.update({'tau': tau})


args[method].update(settings)

Expand Down
8 changes: 8 additions & 0 deletions pyleoclim/tests/test_core_Series.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,14 @@ def test_xwave_t3(self):
ts3 = pyleo.Series(time=t_unevenly, value=v_unevenly)
ts4 = pyleo.Series(time=t1_unevenly, value=v1_unevenly)
scal = ts3.wavelet_coherence(ts4,method='wwz')

def test_xwave_t5(self):
''' Test Series.wavelet_coherence() with WWZ with specified ntau
'''
nt = 100
ts1 = gen_ts(model='colored_noise', nt=nt)
ts2 = gen_ts(model='colored_noise', nt=nt)
_ = ts1.wavelet_coherence(ts2,method='wwz',settings={'ntau':10})

class TestUISeriesWavelet():
''' Test the wavelet functionalities
Expand Down