3131remove_zonal_mean : bool, optional
3232 Remove the zonal mean prior to spectral analysis. This is
3333 commonly done in Wheeler-Kiladis diagnostics to emphasize
34- propagating equatorial wave signals.
34+ propagating equatorial wave signals. Default: True.
3535
3636segment_length : int, optional
3737 Length of each spectral segment [days]. The default value of
38- 180 days is widely used in Wheeler-Kiladis analyses and
38+ 180 days is commonly used in Wheeler-Kiladis analyses and
3939 provides a balance between frequency resolution and statistical
4040 sampling.
4141
4242segment_overlap : int, optional
43- Overlap between consecutive segments [days]. A value of
44- 90 days corresponds to 50% overlap and increases the number
43+ Overlap between consecutive segments [days]. The default value
44+ of 90 days corresponds to 50% overlap and increases the number
4545 of spectra contributing to the ensemble average.
4646
4747sampling_frequency_per_day : float, optional
4848 Sampling frequency of the input data [samples day^-1].
49- Daily data correspond to a value of 1.0.
49+ The default value is 1.0, corresponding to daily data .
5050
5151sigma_freq : float, optional
5252 Gaussian smoothing width in the frequency direction used
5353 for background-spectrum estimation. The default value of
54- 4.0 provides a smoothly varying background spectrum suitable
55- for normalization .
54+ 4.0 provides sufficient smoothing to represent the broad
55+ spectral background while retaining its large-scale structure .
5656
5757sigma_wn : float, optional
5858 Gaussian smoothing width in the zonal-wavenumber direction
5959 used for background-spectrum estimation. The default value
60- of 4.0 provides adequate smoothing while preserving the
61- large-scale spectral envelope.
60+ of 4.0 provides a smoothly varying background spectrum
61+ suitable for normalization while preserving the large-scale
62+ spectral envelope.
6263
6364max_wavenumber : int, optional
64- Maximum zonal wavenumber shown in diagnostic plots.
65+ Maximum zonal wavenumber displayed in diagnostic plots.
66+ Default: 15.
6567
6668max_frequency : float, optional
67- Maximum frequency shown in diagnostic plots [cycles day^-1].
69+ Maximum frequency displayed in diagnostic plots
70+ [cycles day^-1]. Default: 0.5.
6871
6972period_ticks : list of int, optional
70- Period values [days] displayed on the frequency axis of the
71- diagnostic plots .
73+ Periods [days] shown as labels on the frequency axis.
74+ Default: [2, 3, 5, 10, 20, 30, 60, 100] .
7275
7376equivalent_depths : list of float, optional
7477 Equivalent depths [m] used to draw theoretical shallow-water
75- dispersion curves. Typical values are 8, 12, 25 and 50 m,
76- which span the range commonly associated with convectively
77- coupled equatorial waves.
78+ dispersion curves. The default values [ 8, 12, 25, 50] span
79+ the range commonly associated with convectively coupled
80+ equatorial waves.
7881
7982show_dispersion : bool, optional
8083 If True, overlay theoretical Kelvin and equatorial Rossby
81- wave dispersion curves on the normalized WK spectrum.
84+ wave dispersion curves on the normalized Wheeler-Kiladis
85+ spectrum. Default: True.
8286
8387mask_zero_wavenumber : bool, optional
84- Mask the zonal wavenumber zero column in the normalized
85- spectrum plot. This is often useful when the zonal mean
86- has been removed.
88+ If True, mask the zonal- wavenumber- zero column in the
89+ normalized spectrum plot. This is often useful when the
90+ zonal mean has been removed. Default: True .
8791
8892Outputs
8993-------
@@ -169,9 +173,9 @@ def _process_regular_dataset(cfg, attrs):
169173
170174 raw , background , normalized = compute_wk_spectra (
171175 data_anom ,
172- segment_length = cfg [ "segment_length" ] ,
173- segment_overlap = cfg [ "segment_overlap" ] ,
174- samples_per_day = cfg [ "sampling_frequency_per_day" ] ,
176+ segment_length = cfg . get ( "segment_length" , 180 ) ,
177+ segment_overlap = cfg . get ( "segment_overlap" , 90 ) ,
178+ samples_per_day = cfg . get ( "sampling_frequency_per_day" , 1.0 ) ,
175179 sigma_freq = cfg .get ("sigma_freq" , 4.0 ),
176180 sigma_wn = cfg .get ("sigma_wn" , 4.0 ),
177181 )
@@ -198,37 +202,36 @@ def _make_method_caption(cfg, attrs, label):
198202 """Create a method caption describing WK settings."""
199203 dataset = attrs .get ("dataset" , label )
200204
201- start_year = attrs .get (
202- "start_year" ,
203- cfg .get ("start_year" , "unknown" ),
204- )
205+ start_year = attrs .get ("start_year" )
206+ end_year = attrs .get ("end_year" )
205207
206- end_year = attrs . get (
207- "end_year" ,
208- cfg . get ( " end_year" , "unknown" ),
209- )
208+ caption = f"Wheeler-Kiladis spectrum for { dataset } . "
209+
210+ if start_year is not None and end_year is not None :
211+ caption += f"Period: { start_year } - { end_year } . "
210212
211- caption = (
212- f"Wheeler-Kiladis spectrum for { dataset } . "
213- f"Period: { start_year } -{ end_year } . "
213+ caption += (
214214 "Region: 15S-15N, all longitudes. "
215215 "Data are converted to daily means and equatorially averaged. "
216216 f"Anomalies are computed after removing the time mean, linear trend, "
217217 f"and the first { cfg .get ('annual_harmonics' , 3 )} annual harmonics. "
218218 )
219219
220220 if cfg .get ("remove_zonal_mean" , True ):
221- caption += "The zonal mean is removed before the wavenumber-frequency transform. "
221+ caption += (
222+ "The zonal mean is removed before the "
223+ "wavenumber-frequency transform. "
224+ )
222225
223226 caption += (
224- f"Spectra are computed using { cfg ['segment_length' ]} -day windows "
225- f"with { cfg ['segment_overlap' ]} -day overlap. "
226- f"Background normalization uses Gaussian smoothing with "
227+ f"Spectra are computed using "
228+ f"{ cfg .get ('segment_length' , 180 )} -day windows "
229+ f"with { cfg .get ('segment_overlap' , 90 )} -day overlap. "
230+ "Background normalization uses Gaussian smoothing with "
227231 f"sigma_freq={ cfg .get ('sigma_freq' , 4.0 )} and "
228232 f"sigma_wn={ cfg .get ('sigma_wn' , 4.0 )} . "
229233 "Positive zonal wavenumber denotes eastward propagation."
230234 )
231-
232235 return caption
233236
234237
0 commit comments