@@ -37,6 +37,18 @@ def time(clear_sky_index):
3737 return np .arange (0 , len (clear_sky_index ))
3838
3939
40+ @pytest .fixture
41+ def time_60s (clear_sky_index ):
42+ # Sample time vector 60s resolution
43+ return np .arange (0 , len (clear_sky_index ))* 60
44+
45+
46+ @pytest .fixture
47+ def time_500ms (clear_sky_index ):
48+ # Sample time vector 0.5s resolution
49+ return np .arange (0 , len (clear_sky_index ))* 0.5
50+
51+
4052@pytest .fixture
4153def positions ():
4254 # Sample positions based on the previous lat/lon (calculated manually)
@@ -51,6 +63,18 @@ def expect_tmscale():
5163 return [1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 , 2048 , 4096 ]
5264
5365
66+ @pytest .fixture
67+ def expect_tmscale_1min ():
68+ # Expected timescales for dt = 60
69+ return [60 , 120 , 240 , 480 , 960 , 1920 , 3840 ]
70+
71+
72+ @pytest .fixture
73+ def expect_tmscale_500ms ():
74+ # Expected timescales for dt = 0.5
75+ return [0.5 , 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 , 2048 , 4096 ]
76+
77+
5478@pytest .fixture
5579def expect_wavelet ():
5680 # Expected wavelet for indices 5000:5004 for clear_sky_index above (Matlab)
@@ -109,6 +133,25 @@ def test_compute_wavelet_series_numindex(clear_sky_index, time,
109133 assert_almost_equal (wavelet [:, 5000 :5005 ], expect_wavelet )
110134
111135
136+ def test_compute_wavelet_series_highres (clear_sky_index , time_500ms ,
137+ expect_tmscale_500ms , expect_wavelet ):
138+ dtindex = pd .to_datetime (time_500ms , unit = 's' )
139+ csi_series = pd .Series (clear_sky_index , index = dtindex )
140+ wavelet , tmscale = scaling ._compute_wavelet (csi_series )
141+ assert_almost_equal (tmscale , expect_tmscale_500ms )
142+ assert_almost_equal (wavelet [:, 5000 :5005 ].shape , (14 , 5 ))
143+
144+
145+ def test_compute_wavelet_series_minuteres (clear_sky_index , time_60s ,
146+ expect_tmscale_1min , expect_wavelet ):
147+ dtindex = pd .to_datetime (time_60s , unit = 's' )
148+ csi_series = pd .Series (clear_sky_index , index = dtindex )
149+ wavelet , tmscale = scaling ._compute_wavelet (csi_series )
150+ assert_almost_equal (tmscale , expect_tmscale_1min )
151+ assert_almost_equal (wavelet [:, 5000 :5005 ].shape ,
152+ expect_wavelet [0 :len (tmscale ), :].shape )
153+
154+
112155def test_compute_wavelet_array (clear_sky_index ,
113156 expect_tmscale , expect_wavelet ):
114157 wavelet , tmscale = scaling ._compute_wavelet (clear_sky_index , dt )
0 commit comments