Skip to content

Commit f608843

Browse files
committed
Improve cross-references in docs
1 parent 912e6f1 commit f608843

File tree

6 files changed

+58
-40
lines changed

6 files changed

+58
-40
lines changed

docs/sources/stagyydata.rst

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,28 +138,49 @@ Geometry information are read from binary files. :attr:`Step.geom
138138
<stagpy._step.Step.geom>` has various attributes defining the geometry of
139139
the problem.
140140

141-
``cartesian``, ``curvilinear``, ``cylindrical``, ``spherical`` and ``yinyang``
142-
booleans define the shape of the domain (``curvilinear`` being the opposite of
143-
``cartesian``, ``True`` if ``cylindrical`` or ``spherical`` is ``True``).
144-
145-
``twod_xz``, ``twod_yz``, ``twod`` and ``threed`` booleans indicate the number
146-
of spatial dimensions in the simulation. Note that fields are always four
141+
:attr:`~stagpy._step._Geometry.cartesian`,
142+
:attr:`~stagpy._step._Geometry.curvilinear`,
143+
:attr:`~stagpy._step._Geometry.cylindrical`,
144+
:attr:`~stagpy._step._Geometry.spherical` and
145+
:attr:`~stagpy._step._Geometry.yinyang` booleans define the shape of the domain
146+
(:attr:`~stagpy._step._Geometry.curvilinear` being the opposite of
147+
:attr:`~stagpy._step._Geometry.cartesian`, ``True`` if
148+
:attr:`~stagpy._step._Geometry.cylindrical` or
149+
:attr:`~stagpy._step._Geometry.spherical` is ``True``).
150+
151+
:attr:`~stagpy._step._Geometry.twod_xz`,
152+
:attr:`~stagpy._step._Geometry.twod_yz`, :attr:`~stagpy._step._Geometry.twod`
153+
and :attr:`~stagpy._step._Geometry.threed` booleans indicate the number of
154+
spatial dimensions in the simulation. Note that fields are always four
147155
dimensional arrays (spatial + blocks) regardless of the actual dimension of the
148156
domain.
149157

150-
``nxtot``, ``nytot``, ``nztot``, ``nbtot``, ``nttot``, ``nptot`` and ``nrtot``
151-
are the total number of points in the various spatial directions. Note that
152-
``nttot``, ``nptot`` and ``nrtot`` are the same as ``nxtot``, ``nytot`` and
153-
``nztot`` regardless of whether the geometry is cartesian or curvilinear.
154-
155-
``x_centers``, ``y_centers``, and ``z_centers`` as well as ``t_centers``,
156-
``p_centers``, and ``r_centers`` are the coordinates of cell centers in the
157-
three directions. As for the total number of points, they are the same
158+
:attr:`~stagpy._step._Geometry.nxtot`, :attr:`~stagpy._step._Geometry.nytot`,
159+
:attr:`~stagpy._step._Geometry.nztot`, :attr:`~stagpy._step._Geometry.nbtot`,
160+
:attr:`~stagpy._step._Geometry.nttot`, :attr:`~stagpy._step._Geometry.nptot`
161+
and :attr:`~stagpy._step._Geometry.nrtot` are the total number of points in the
162+
various spatial directions. Note that :attr:`~stagpy._step._Geometry.nttot`,
163+
:attr:`~stagpy._step._Geometry.nptot` and :attr:`~stagpy._step._Geometry.nrtot`
164+
are the same as :attr:`~stagpy._step._Geometry.nxtot`,
165+
:attr:`~stagpy._step._Geometry.nytot` and :attr:`~stagpy._step._Geometry.nztot`
166+
regardless of whether the geometry is cartesian or curvilinear.
167+
168+
:attr:`~stagpy._step._Geometry.x_centers`,
169+
:attr:`~stagpy._step._Geometry.y_centers`, and
170+
:attr:`~stagpy._step._Geometry.z_centers` as well as
171+
:attr:`~stagpy._step._Geometry.t_centers`,
172+
:attr:`~stagpy._step._Geometry.p_centers`, and
173+
:attr:`~stagpy._step._Geometry.r_centers` are the coordinates of cell centers
174+
in the three directions. As for the total number of points, they are the same
158175
regardless of the actual geometry.
159176

160-
Similarly to ``*_centers`` attributes, ``x_walls``, ``y_walls``, and
161-
``z_walls`` as well as ``t_walls``, ``p_walls``, and ``r_walls`` are the
162-
coordinates of cell walls in the three directions.
177+
Similarly to ``*_centers`` attributes, :attr:`~stagpy._step._Geometry.x_walls`,
178+
:attr:`~stagpy._step._Geometry.y_walls`, and
179+
:attr:`~stagpy._step._Geometry.z_walls` as well as
180+
:attr:`~stagpy._step._Geometry.t_walls`,
181+
:attr:`~stagpy._step._Geometry.p_walls`, and
182+
:attr:`~stagpy._step._Geometry.r_walls` are the coordinates of cell walls in
183+
the three directions.
163184

164185
Scalar and vector fields
165186
------------------------

stagpy/_step.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ def bounds(self):
492492
class Step:
493493
"""Time step data structure.
494494
495-
Elements of :class:`_Steps` and :class:`_Snaps` instances are all
496-
:class:`Step` instances. Note that :class:`Step` objects are not
497-
duplicated.
495+
Elements of :class:`~stagpy.stagyydata._Steps` and
496+
:class:`~stagpy.stagyydata._Snaps` instances are all :class:`Step`
497+
instances. Note that :class:`Step` objects are not duplicated.
498498
499499
Examples:
500500
Here are a few examples illustrating some properties of :class:`Step`

stagpy/field.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def valid_field_var(var):
5757
"""Whether a field variable is defined.
5858
5959
This function checks if a definition of the variable exists in
60-
:data:`phyvars.FIELD` or :data:`phyvars.FIELD_EXTRA`.
60+
:data:`~stagpy.phyvars.FIELD` or :data:`~stagpy.phyvars.FIELD_EXTRA`.
6161
6262
Args:
6363
var (str): the variable name to be checked.
@@ -73,8 +73,7 @@ def get_meshes_fld(step, var, walls=False):
7373
Only works properly in 2D geometry and 3D cartesian.
7474
7575
Args:
76-
step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData
77-
instance.
76+
step (:class:`~stagpy._step.Step`): a step of a StagyyData instance.
7877
var (str): scalar field name.
7978
walls (bool): consider the walls as the relevant mesh.
8079
Returns:
@@ -109,8 +108,7 @@ def get_meshes_vec(step, var):
109108
Only works properly in 2D geometry and 3D cartesian.
110109
111110
Args:
112-
step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData
113-
instance.
111+
step (:class:`~stagpy._step.Step`): a step of a StagyyData instance.
114112
var (str): vector field name.
115113
Returns:
116114
tuple of :class:`numpy.array`: xmesh, ymesh, fldx, fldy
@@ -146,8 +144,7 @@ def plot_scalar(step, var, field=None, axis=None, **extra):
146144
"""Plot scalar field.
147145
148146
Args:
149-
step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData
150-
instance.
147+
step (:class:`~stagpy._step.Step`): a step of a StagyyData instance.
151148
var (str): the scalar field name.
152149
field (:class:`numpy.array`): if not None, it is plotted instead of
153150
step.fields[var]. This is useful to plot a masked or rescaled
@@ -252,8 +249,7 @@ def plot_iso(axis, step, var, **extra):
252249
axis (:class:`matplotlib.axes.Axes`): the axis handler of an
253250
existing matplotlib figure where the isocontours should
254251
be plotted.
255-
step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData
256-
instance.
252+
step (:class:`~stagpy._step.Step`): a step of a StagyyData instance.
257253
var (str): the scalar field name.
258254
extra (dict): options that will be passed on to
259255
:func:`matplotlib.axes.Axes.contour`.
@@ -277,8 +273,7 @@ def plot_vec(axis, step, var):
277273
axis (:class:`matplotlib.axes.Axes`): the axis handler of an
278274
existing matplotlib figure where the vector field should
279275
be plotted.
280-
step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData
281-
instance.
276+
step (:class:`~stagpy._step.Step`): a step of a StagyyData instance.
282277
var (str): the vector field name.
283278
"""
284279
xmesh, ymesh, vec1, vec2 = get_meshes_vec(step, var)

stagpy/misc.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,16 @@ def find_in_sorted_arr(value, array, after=False):
121121
class CachedReadOnlyProperty:
122122
"""Descriptor implementation of read-only cached properties.
123123
124-
Properties are cached as _cropped_{name} instance attribute.
124+
Properties are cached as ``_cropped_{name}`` instance attribute.
125125
126-
This is preferable to using a combination of property and
127-
functools.lru_cache since the cache is bound to instances and therefore get
128-
GCd with the instance when the latter is no longer in use instead of
129-
staying in the cache which would use the instance itself as its key.
126+
This is preferable to using a combination of ``@property`` and
127+
``@functools.lru_cache`` since the cache is bound to instances and
128+
therefore get GCd with the instance when the latter is no longer in use
129+
instead of staying in the cache which would use the instance itself as its
130+
key.
130131
131-
This also has an advantage over @cached_property (Python>3.8): the property
132-
is read-only instead of being writeable.
132+
This also has an advantage over ``@cached_property`` (Python>3.8): the
133+
property is read-only instead of being writeable.
133134
"""
134135

135136
def __init__(self, thunk):

stagpy/refstate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def plot_ref(sdat, var):
1212
1313
Args:
1414
sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance.
15-
var (str): refstate variable, a key of :data:`stagpy.phyvars.REFSTATE`.
15+
var (str): refstate variable, a key of
16+
:data:`~stagpy.phyvars.REFSTATE`.
1617
"""
1718
fig, axis = plt.subplots()
1819
adbts = sdat.refstate.adiabats

stagpy/rprof.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def plot_grid(step):
6565
The figure is call grid_N.pdf where N is replace by the step index.
6666
6767
Args:
68-
step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData
68+
step (:class:`~stagpy._step.Step`): a step of a StagyyData
6969
instance.
7070
"""
7171
drad, rad, _ = step.rprofs['dr']

0 commit comments

Comments
 (0)