Skip to content

Commit 11e010f

Browse files
committed
docs: fix docstrings formatting
1 parent bfdda1f commit 11e010f

File tree

6 files changed

+43
-20
lines changed

6 files changed

+43
-20
lines changed

stagpy/_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def baredoc(obj: object) -> str:
9292
9393
Args:
9494
obj: any Python object.
95+
9596
Returns:
9697
str: the first line of the docstring of obj.
9798
"""

stagpy/field.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ def valid_field_var(var: str) -> bool:
8080
8181
Args:
8282
var: the variable name to be checked.
83+
8384
Returns:
84-
whether the var is defined in `phyvars.FIELD` or
85-
`phyvars.FIELD_EXTRA`.
85+
whether the var is defined in either [`FIELD`][stagpy.phyvars.FIELD] or
86+
[`FIELD_EXTRA`][stagpy.phyvars.FIELD_EXTRA].
8687
"""
8788
return var in phyvars.FIELD or var in phyvars.FIELD_EXTRA
8889

@@ -99,10 +100,12 @@ def get_meshes_fld(
99100
step: a `Step` of a `StagyyData` instance.
100101
var: scalar field name.
101102
walls: consider the walls as the relevant mesh.
103+
102104
Returns:
103-
tuple (xmesh, ymesh, fld, meta). 2D arrays containing respectively the
104-
x position, y position, the values and the metadata of the requested
105-
field.
105+
xmesh: x position
106+
ymesh: y position
107+
fld: field values
108+
meta: metadata
106109
"""
107110
fld = step.fields[var]
108111
hwalls = (
@@ -139,10 +142,12 @@ def get_meshes_vec(
139142
conf: configuration.
140143
step: a `Step` of a `StagyyData` instance.
141144
var: vector field name.
145+
142146
Returns:
143-
tuple (xmesh, ymesh, fldx, fldy). 2D arrays containing respectively
144-
the x position, y position, x component and y component of the
145-
requested vector field.
147+
xmesh: x position
148+
ymesh: y position
149+
fldx: x component
150+
fldy: y component
146151
"""
147152
if step.geom.threed and step.geom.cartesian:
148153
(xcoord, ycoord), (vec1, vec2) = _threed_extract(conf, step, var)
@@ -189,12 +194,12 @@ def plot_scalar(
189194
created.
190195
conf: configuration.
191196
extra: options that will be passed on to `matplotlib.axes.Axes.pcolormesh`.
197+
192198
Returns:
193-
fig, axis, surf, cbar
194-
handles to various `matplotlib` objects, respectively the
195-
figure, the axis, the surface returned by
196-
`Axes.pcolormesh`, and the colorbar returned
197-
by `matplotlib.pyplot.colorbar`.
199+
fig: matplotlib figure
200+
axes: matplotlib axes
201+
surf: surface returned by `pcolormesh`
202+
cbar: colorbar
198203
"""
199204
if conf is None:
200205
conf = Config.default_()

stagpy/plates.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ def detect_plates(snap: Step, vz_thres_ratio: float = 0) -> tuple[NDArray, NDArr
5050
vertical velocities is performed. Limits detected above a region
5151
where the vertical velocity is below `vz_thres_ratio * mean(vzabs)`
5252
are ignored.
53+
5354
Returns:
54-
tuple (itrenches, iridges). 1D arrays containing phi-index of detected
55-
trenches and ridges.
55+
itrenches: phi-indices of detected trenches
56+
iridges: phi-indices of detected ridges
5657
"""
5758
dvphi = _surf_diag(snap, "dv2").values
5859

stagpy/processing.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def dtime(sdat: StagyyData) -> Tseries:
3131
3232
Args:
3333
sdat: a `StagyyData` instance.
34+
3435
Returns:
3536
dt and time arrays.
3637
"""
@@ -47,6 +48,7 @@ def dt_dt(sdat: StagyyData) -> Tseries:
4748
4849
Args:
4950
sdat: a `StagyyData` instance.
51+
5052
Returns:
5153
derivative of temperature and time arrays.
5254
"""
@@ -65,6 +67,7 @@ def ebalance(sdat: StagyyData) -> Tseries:
6567
6668
Args:
6769
sdat: a `StagyyData` instance.
70+
6871
Returns:
6972
energy balance and time arrays.
7073
"""
@@ -90,6 +93,7 @@ def mobility(sdat: StagyyData) -> Tseries:
9093
9194
Args:
9295
sdat: a `StagyyData` instance.
96+
9397
Returns:
9498
mobility and time arrays.
9599
"""
@@ -108,6 +112,7 @@ def delta_r(step: Step) -> Rprof:
108112
109113
Args:
110114
step: a `Step` of a `StagyyData` instance.
115+
111116
Returns:
112117
the thickness of the cells and radius.
113118
"""
@@ -131,6 +136,7 @@ def diff_prof(step: Step) -> Rprof:
131136
132137
Args:
133138
step: a `Step` of a `StagyyData` instance.
139+
134140
Returns:
135141
the diffusion and radius.
136142
"""
@@ -153,6 +159,7 @@ def diffs_prof(step: Step) -> Rprof:
153159
154160
Args:
155161
step: a `Step` of a `StagyyData` instance.
162+
156163
Returns:
157164
the diffusion and radius.
158165
"""
@@ -168,6 +175,7 @@ def advts_prof(step: Step) -> Rprof:
168175
169176
Args:
170177
step: a `Step` of a `StagyyData` instance.
178+
171179
Returns:
172180
the scaled advection and radius.
173181
"""
@@ -185,6 +193,7 @@ def advds_prof(step: Step) -> Rprof:
185193
186194
Args:
187195
step: a `Step` of a `StagyyData` instance.
196+
188197
Returns:
189198
the scaled downward advection and radius.
190199
"""
@@ -202,6 +211,7 @@ def advas_prof(step: Step) -> Rprof:
202211
203212
Args:
204213
step: a `Step` of a `StagyyData` instance.
214+
205215
Returns:
206216
the scaled upward advection and radius.
207217
"""
@@ -219,6 +229,7 @@ def energy_prof(step: Step) -> Rprof:
219229
220230
Args:
221231
step: a `Step` of a `StagyyData` instance.
232+
222233
Returns:
223234
the energy flux and radius.
224235
"""
@@ -239,6 +250,7 @@ def advth(step: Step) -> Rprof:
239250
240251
Args:
241252
step: a `Step` of a `StagyyData` instance.
253+
242254
Returns:
243255
the theoretical advection and radius.
244256
"""
@@ -263,6 +275,7 @@ def init_c_overturn(step: Step) -> Rprof:
263275
264276
Args:
265277
step: a `Step` of a `StagyyData` instance.
278+
266279
Returns:
267280
the composition and radius.
268281
"""
@@ -299,6 +312,7 @@ def c_overturned(step: Step) -> Rprof:
299312
300313
Args:
301314
step: a `Step` of a `StagyyData` instance.
315+
302316
Returns:
303317
the composition and radius.
304318
"""
@@ -315,6 +329,7 @@ def stream_function(step: Step) -> Field:
315329
316330
Args:
317331
step: a `Step` of a `StagyyData` instance.
332+
318333
Returns:
319334
the stream function field.
320335
"""

stagpy/stagyydata.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
33
Note:
44
The helper classes are not designed to be instantiated on their own, but
5-
only as attributes of StagyyData instances. Users of this module should
6-
only instantiate :class:`StagyyData`.
7-
5+
only as attributes of `StagyyData` instances. Users of this module should
6+
only instantiate [`StagyyData`][stagpy.stagyydata.StagyyData].
87
"""
98

109
from __future__ import annotations
@@ -784,6 +783,7 @@ def filename(
784783
timestep: snapshot number if relevant.
785784
suffix: optional suffix of file name.
786785
force_legacy: force returning the legacy output path.
786+
787787
Returns:
788788
the path of the output file constructed with the provided segments.
789789
"""
@@ -802,6 +802,7 @@ def _binfiles_set(self, isnap: int) -> set[Path]:
802802
803803
Args:
804804
isnap: snapshot index.
805+
805806
Returns:
806807
the set of output files available for this snapshot number.
807808
"""

stagpy/time_series.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ def compstat(
105105
tstart: starting time. Set to None to start at the beginning of
106106
available data.
107107
tend: ending time. Set to None to stop at the end of available data.
108+
108109
Returns:
109-
a `pandas.DataFrame` with statistics. 'mean' and 'rms' as index,
110-
variable names as columns.
110+
statistics. `"mean"` and `"rms"` as index, variable names as columns.
111111
"""
112112
stats = pd.DataFrame(columns=names, index=["mean", "rms"])
113113
for name in names:

0 commit comments

Comments
 (0)