Skip to content

Commit 618ded2

Browse files
committed
Update docstrings inconsistencies
1 parent 557da6b commit 618ded2

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

src/nemo_spinup_forecast/pipeline_utils.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,12 @@ def decompose_all(sims: Mapping[str, Simulation]) -> None:
107107
sims : Mapping[str, Simulation]
108108
Simulation objects keyed by term identifier.
109109
110-
Returns
111-
-------
112-
None
113-
Simulations are updated in place.
114-
115110
Notes
116111
-----
117-
Calls :meth:`Simulation.decompose` and prints one progress message per key.
112+
Updates simulations in place.
113+
114+
Calls :meth:`~nemo_spinup_forecast.forecast.Simulation.decompose` and
115+
prints one progress message per key.
118116
"""
119117
for k, s in sims.items():
120118
s.decompose()
@@ -170,7 +168,8 @@ def make_dicos(sims: Mapping[str, Simulation]) -> dict[str, dict[str, Any]]:
170168
Returns
171169
-------
172170
dict[str, dict[str, Any]]
173-
Serialized simulation payloads produced by :meth:`Simulation.make_dico`,
171+
Serialized simulation payloads produced by
172+
:meth:`~nemo_spinup_forecast.forecast.Simulation.make_dico`,
174173
keyed by term.
175174
176175
Notes
@@ -199,7 +198,7 @@ def load_ts_all(
199198
200199
Returns
201200
-------
202-
tuple[dict[str, pandas.DataFrame], dict[str, dict[str, Any]]]
201+
tuple[dict[str, pd.DataFrame], dict[str, dict[str, Any]]]
203202
Tuple ``(dfs, infos)`` keyed by :attr:`TermSpec.key`.
204203
205204
Notes
@@ -229,14 +228,16 @@ def build_predictions(
229228
----------
230229
specs : Sequence[TermSpec]
231230
Term specifications defining output keys and forecasted variables.
232-
dfs : Mapping[str, pandas.DataFrame]
231+
dfs : Mapping[str, pd.DataFrame]
233232
Time-series component DataFrames keyed by :attr:`TermSpec.key`.
234233
infos : Mapping[str, dict[str, Any]]
235234
Metadata dictionaries keyed by :attr:`TermSpec.key`.
236235
forecast_method : Any
237-
Forecasting method instance passed to :class:`Predictions`.
236+
Forecasting method instance passed to
237+
:class:`~nemo_spinup_forecast.forecast.Predictions`.
238238
dr_method : Any
239-
Dimensionality-reduction method passed to :class:`Predictions`.
239+
Dimensionality-reduction method passed to
240+
:class:`~nemo_spinup_forecast.forecast.Predictions`.
240241
241242
Returns
242243
-------
@@ -259,15 +260,15 @@ def forecast_all(
259260
train_len: int,
260261
steps: int,
261262
) -> tuple[dict[str, pd.DataFrame], dict[str, Any], dict[str, Any]]:
262-
"""Run parallel forecasts for all terms and return outputs by key.
263+
"""Forecasts for all terms and return outputs by key.
263264
264265
Parameters
265266
----------
266267
specs : Sequence[TermSpec]
267268
Term specifications defining processing order and output keys.
268269
preds : Mapping[str, Predictions]
269270
Prediction objects keyed by :attr:`TermSpec.key`.
270-
dfs : Mapping[str, pandas.DataFrame]
271+
dfs : Mapping[str, pd.DataFrame]
271272
Original component time-series DataFrames keyed by term.
272273
train_len : int
273274
Number of initial rows used as the training window.
@@ -276,13 +277,14 @@ def forecast_all(
276277
277278
Returns
278279
-------
279-
tuple[dict[str, pandas.DataFrame], dict[str, Any], dict[str, Any]]
280+
tuple[dict[str, pd.DataFrame], dict[str, Any], dict[str, Any]]
280281
Tuple ``(hats, hat_stds, metrics)`` keyed by :attr:`TermSpec.key`.
281282
282283
Notes
283284
-----
284285
For each term, the function prepends ``dfs[key][:train_len]`` to the
285-
forecast output from :meth:`Predictions.parallel_forecast`.
286+
forecast output from
287+
:meth:`~nemo_spinup_forecast.forecast.Predictions.parallel_forecast`.
286288
"""
287289
hats: dict[str, pd.DataFrame] = {}
288290
hat_stds: dict[str, Any] = {}
@@ -309,7 +311,7 @@ def abs_error_stats(
309311
310312
Parameters
311313
----------
312-
err : numpy.ndarray
314+
err : np.ndarray
313315
Absolute-error array, typically ``abs(reference - prediction)``.
314316
pred_steps : int
315317
Number of trailing time steps considered as the prediction window.
@@ -342,20 +344,17 @@ def abs_error_stats(
342344

343345

344346
def normalise_time_series(sim: Simulation) -> None:
345-
"""Normalize a simulation time series in place.
347+
"""Normalise a simulation time series in place.
346348
347349
Parameters
348350
----------
349351
sim : Simulation
350-
Simulation object whose ``simulation`` array will be normalized.
351-
352-
Returns
353-
-------
354-
None
355-
The normalization is applied in place on ``sim.simulation``.
352+
Simulation object whose ``simulation`` array will be normalised.
356353
357354
Notes
358355
-----
356+
Modifies ``sim.simulation`` in place.
357+
359358
Uses ``sim.desc["mean"]`` and ``sim.desc["std"]`` for scaling.
360359
"""
361360
sim.simulation = (sim.simulation - sim.desc["mean"]) / (2 * sim.desc["std"])

0 commit comments

Comments
 (0)