Skip to content

Commit

Permalink
update docs to use new idx instead of y and expand description within…
Browse files Browse the repository at this point in the history
… the section documentation
  • Loading branch information
Andrew Moodie committed Nov 17, 2021
1 parent 44d129a commit 0a8484f
Show file tree
Hide file tree
Showing 20 changed files with 49 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docs/source/guides/10min.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ For a data cube, sections are most easily instantiated by the :obj:`~deltametric

.. doctest::

>>> golfcube.register_section('demo', dm.section.StrikeSection(y=10))
>>> golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

which can then be accessed via the :obj:`~deltametrics.cube.Cube.sections` attribute of the Cube.

Expand Down
10 changes: 5 additions & 5 deletions docs/source/guides/userguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ For a data cube, sections are most easily instantiated by the :obj:`~deltametric

.. doctest::

>>> golfcube.register_section('demo', dm.section.StrikeSection(y=10))
>>> golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

which creates a section across a constant y-value ``==10``.
The path of any `Section` in the ``x-y`` plane can always be accessed via the ``.trace`` attribute.
Expand Down Expand Up @@ -183,7 +183,7 @@ are sliced themselves, similarly to the cube.

.. doctest::

>>> golfcube.register_section('demo', dm.section.StrikeSection(y=10))
>>> golfcube.register_section('demo', dm.section.StrikeSection(idx=10))
>>> golfcube.sections['demo']['velocity']
<xarray.DataArray 'velocity' (z: 101, s: 200)>
array([[0.2 , 0.2 , 0.2 , ..., 0.2 , 0.2 , 0.2 ],
Expand Down Expand Up @@ -220,7 +220,7 @@ You can also create a standalone section, which is not registered to the cube, b

.. doctest::

>>> sass = dm.section.StrikeSection(golfcube, y=10)
>>> sass = dm.section.StrikeSection(golfcube, idx=10)
>>> np.all(sass['velocity'] == golfcube.sections['demo']['velocity']) #doctest: +SKIP
True

Expand Down Expand Up @@ -296,7 +296,7 @@ The following are currently implemented.

.. doctest::

>>> _strike = dm.section.StrikeSection(golfcube, y=18)
>>> _strike = dm.section.StrikeSection(golfcube, idx=18)
>>> _path = dm.section.PathSection(golfcube, path=np.column_stack((np.linspace(50, 150, num=4000, dtype=int),
... np.linspace(10, 90, num=4000, dtype=int))))
>>> _circ = dm.section.CircularSection(golfcube, radius=40)
Expand Down Expand Up @@ -376,7 +376,7 @@ Let’s add a section at the same location as ``golfcube.sections['demo']``.

.. doctest::

>>> stratcube.register_section('demo', dm.section.StrikeSection(y=10))
>>> stratcube.register_section('demo', dm.section.StrikeSection(idx=10))
>>> stratcube.sections
{'demo': <deltametrics.section.StrikeSection object at 0x...>}

Expand Down
2 changes: 1 addition & 1 deletion docs/source/pyplots/examples/preserved_velocities.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def pick_velocities(sect):

# loop through all of the sections defined in _ys
for i, _y in enumerate(_ys):
_s = dm.section.StrikeSection(golfcube, y=_y)
_s = dm.section.StrikeSection(golfcube, idx=_y)
_mall[i], _mstrat[i] = pick_velocities(_s)


Expand Down
2 changes: 1 addition & 1 deletion docs/source/pyplots/guides/10min_all_sections_strat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

golfcube = dm.sample_data.golf()
golfcube.stratigraphy_from('eta', dz=0.05)
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

fig, ax = plt.subplots(5, 1, sharex=True, figsize=(6, 8))
ax = ax.flatten()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
golfcube = dm.sample_data.golf()

stratcube = dm.cube.StratigraphyCube.from_DataCube(golfcube, dz=0.05)
stratcube.register_section('demo', dm.section.StrikeSection(y=10))
stratcube.register_section('demo', dm.section.StrikeSection(idx=10))

fig, ax = plt.subplots(5, 1, sharex=True, sharey=True, figsize=(12, 9))
ax = ax.flatten()
Expand Down
4 changes: 2 additions & 2 deletions docs/source/pyplots/guides/userguide_compare_slices.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import matplotlib.gridspec as gs

golfcube = dm.sample_data.golf()
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))
stratcube = dm.cube.StratigraphyCube.from_DataCube(golfcube, dz=0.05)
stratcube.register_section('demo', dm.section.StrikeSection(y=10))
stratcube.register_section('demo', dm.section.StrikeSection(idx=10))

fig, ax = plt.subplots(1, 2, figsize=(8, 2))
golfcube.sections['demo'].show('velocity', ax=ax[0])
Expand Down
4 changes: 2 additions & 2 deletions docs/source/pyplots/guides/userguide_frozen_stratigraphy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

golfcube = dm.sample_data.golf()
golfcube.stratigraphy_from('eta')
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

stratcube = dm.cube.StratigraphyCube.from_DataCube(golfcube, dz=0.05)
stratcube.register_section('demo', dm.section.StrikeSection(y=10))
stratcube.register_section('demo', dm.section.StrikeSection(idx=10))

fs = stratcube.export_frozen_variable('sandfrac')
fe = stratcube.Z # exported volume does not have coordinate information!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
golfcube = dm.sample_data.golf()
golfcube.stratigraphy_from('eta')
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))


fig, ax = plt.subplots(5, 1, sharex=True, sharey=True, figsize=(12, 12))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
golfcube = dm.sample_data.golf()
golfcube.stratigraphy_from('eta')
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))


fig, ax = plt.subplots(3, 1, sharex=True, figsize=(12, 8))
Expand Down
6 changes: 3 additions & 3 deletions docs/source/pyplots/guides/userguide_section_type_demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

golfcube = dm.sample_data.golf()
golfcube.stratigraphy_from('eta')
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

_strike = dm.section.StrikeSection(golfcube, y=18)
__path = np.column_stack((np.linspace(50, 150, num=4000, dtype=int),
np.linspace(10, 90, num=4000, dtype=int)))
__path = np.column_stack((np.linspace(10, 90, num=4000, dtype=int),
np.linspace(50, 150, num=4000, dtype=int)))
_path = dm.section.PathSection(golfcube, path=__path)
_circular = dm.section.CircularSection(golfcube, radius=40)
_rad = dm.section.RadialSection(golfcube, azimuth=70)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
golfcube = dm.sample_data.golf()

stratcube = dm.cube.StratigraphyCube.from_DataCube(golfcube, dz=0.05)
stratcube.register_section('demo', dm.section.StrikeSection(y=10))
stratcube.register_section('demo', dm.section.StrikeSection(idx=10))

elev_idx = (np.abs(stratcube.z - -2)).argmin() # find nearest idx to -2 m

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
golfcube = dm.sample_data.golf()
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

fig, ax = plt.subplots(figsize=(5, 3))
golfcube.show_plan('eta', t=-1, ax=ax, ticks=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
golfcube = dm.sample_data.golf()
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

fig, ax = plt.subplots(3, 1, sharex=True, figsize=(12, 6))
golfcube.show_section('demo', 'eta', ax=ax[0])
Expand Down
4 changes: 2 additions & 2 deletions docs/source/pyplots/guides/userguide_three_stratigraphy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

golfcube = dm.sample_data.golf()
golfcube.stratigraphy_from('eta')
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

stratcube = dm.cube.StratigraphyCube.from_DataCube(golfcube, dz=0.05)
stratcube.register_section('demo', dm.section.StrikeSection(y=10))
stratcube.register_section('demo', dm.section.StrikeSection(idx=10))

fig, ax = plt.subplots(3, 1, sharex=True, sharey=True, figsize=(12, 6))
golfcube.sections['demo'].show('time', style='lines',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
golfcube = dm.sample_data.golf()
golfcube.stratigraphy_from('eta')
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

fig, ax = plt.subplots(3, 2, sharex=True, figsize=(8, 6))
_v = 'velocity'
Expand Down
2 changes: 1 addition & 1 deletion docs/source/pyplots/section/section_demo_quick_strat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

golfcube = dm.sample_data.golf()
golfcube.stratigraphy_from('eta')
golfcube.register_section('demo', dm.section.StrikeSection(y=5))
golfcube.register_section('demo', dm.section.StrikeSection(idx=5))

fig, ax = plt.subplots(4, 1, sharex=True, figsize=(8, 6))
golfcube.sections['demo'].show('depth', data='spacetime',
Expand Down
2 changes: 1 addition & 1 deletion docs/source/pyplots/section/section_demo_spacetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@


fig, ax = plt.subplots(figsize=(8, 2))
golfcube.register_section('demo', dm.section.StrikeSection(y=5))
golfcube.register_section('demo', dm.section.StrikeSection(idx=5))
golfcube.sections['demo'].show('velocity')
12 changes: 6 additions & 6 deletions docs/source/pyplots/section/section_lexicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

golfcube = dm.sample_data.golf()
golfcube.stratigraphy_from('eta')
golfcube.register_section('demo', dm.section.StrikeSection(y=10))
golfcube.register_section('demo', dm.section.StrikeSection(idx=10))

fig, ax = plt.subplots(2, 1, sharex=True, figsize=(6, 3.5))
fig, ax = plt.subplots(2, 1, sharex=True, figsize=(6, 4))

ax[0].imshow(golfcube.sections['demo']['velocity'],
origin='lower', cmap=golfcube.varset['velocity'].cmap)
golfcube.sections['demo'].show('velocity', ax=ax[0])
ax[0].set_ylabel('$t$ coordinate')

ax[1].imshow(golfcube.sections['demo']['velocity'].strat.as_preserved(),
origin='lower', cmap=golfcube.varset['velocity'].cmap)
golfcube.sections['demo'].show('velocity', data='preserved', ax=ax[1])
ax[1].set_ylabel('$t$ coordinate')

ax[1].set_xlabel('$s$ coordinate')

plt.tight_layout()
plt.show()
20 changes: 10 additions & 10 deletions docs/source/reference/plan/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ Planform types
:toctree: ../../_autosummary

OpeningAnglePlanform
MorphologicalPlanform
MorphologicalPlanform

Functions
=========

.. autosummary::
:toctree: ../../_autosummary

compute_shoreline_roughness
compute_shoreline_length
compute_shoreline_distance
compute_channel_width
compute_channel_depth
shaw_opening_angle_method
morphological_closing_method
:toctree: ../../_autosummary

compute_shoreline_roughness
compute_shoreline_length
compute_shoreline_distance
compute_channel_width
compute_channel_depth
shaw_opening_angle_method
morphological_closing_method
13 changes: 7 additions & 6 deletions docs/source/reference/section/lexicon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

The `Section` module defines some terms that are used throughout the code and rest of the documentation.

Most importantly, a Section is defined by a set of coordinates in the x-y plane of a `Cube`.
Most importantly, a Section is defined by a set of coordinates in the `dim1`-`dim2` plane of a `Cube`.

Therefore, we transform variable definitions when extracting the `Section`, and the coordinate system of the section is defined by the along-section direction :math:`s` and a vertical section coordinate, which is :math:`z` when viewing stratigraphy, and :math:`t` when viewing a spacetime section.

Expand All @@ -12,7 +12,7 @@ The data that make up the section can view the section as a `spacetime` section
.. doctest::

>>> rcm8cube = dm.sample_data.rcm8()
>>> strike = dm.section.StrikeSection(rcm8cube, y=10)
>>> strike = dm.section.StrikeSection(rcm8cube, idx=10)
>>> strike['velocity']
<xarray.DataArray 'velocity' (z: 51, s: 240)>
array([[0., 0., 0., ..., 0., 0., 0.],
Expand Down Expand Up @@ -63,12 +63,13 @@ We can display the arrays using `matplotlib` to examine the spatiotemporal chang
.. code::
>>> fig, ax = plt.subplots(2, 1, sharex=True, figsize=(6, 3.5))
>>> ax[0].imshow(rcm8cube.sections['demo']['velocity'],
... origin='lower', cmap=rcm8cube.varset['velocity'].cmap)
>>> golfcube.sections['demo'].show('velocity', ax=ax[0])
>>> ax[0].set_ylabel('$t$ coordinate')
>>> ax[1].imshow(rcm8cube.sections['demo']['velocity'].as_preserved(),
... origin='lower', cmap=rcm8cube.varset['velocity'].cmap)
>>> golfcube.sections['demo'].show('velocity', data='preserved', ax=ax[1])
>>> ax[1].set_ylabel('$t$ coordinate')
>>> ax[1].set_xlabel('$s$ coordinate')
.. plot:: section/section_lexicon.py

Expand Down

0 comments on commit 0a8484f

Please sign in to comment.