Skip to content

Commit

Permalink
Merge branch 'master' into mcflugen/prepare-for-v2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed May 12, 2024
2 parents 5055766 + 26d7662 commit 2c900a3
Show file tree
Hide file tree
Showing 53 changed files with 13,153 additions and 834 deletions.
36 changes: 36 additions & 0 deletions docs/source/reference/graph/dual_icosphere.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
landlab.graph.quasi_spherical package
=====================================

Subpackages
-----------

.. toctree::



Submodules
----------

landlab.graph.quasi_spherical.dual_icosphere module
---------------------------------------------------

.. automodule:: landlab.graph.quasi_spherical.dual_icosphere
:members:
:undoc-members:
:show-inheritance:

landlab.graph.quasi_spherical.refinable_icosahedron module
----------------------------------------------------------

.. automodule:: landlab.graph.quasi_spherical.refinable_icosahedron
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: landlab.graph.quasi_spherical
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/source/reference/graph/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Landlab Graph
structured_quad
voronoi
framed_voronoi
dual_icosphere


Extensions
Expand Down
8 changes: 8 additions & 0 deletions docs/source/reference/grid/icosphere.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
API for landlab.grid.icosphere
------------------------------

.. automodule:: landlab.grid.icosphere
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
6 changes: 4 additions & 2 deletions docs/source/reference/grid/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Landlab Grids
Grid types
----------

Landlab presently supports five types of grids. The base class is ``ModelGrid``
with subclasses ``RasterModelGrid`` and ``VoronoiDelaunayGrid``.
Landlab presently supports seven types of grids. The base class is ``ModelGrid``
with subclasses ``RasterModelGrid``, ``VoronoiDelaunayGrid``, and ``IcosphereGlobalGrid``.
``VoronoiDelaunayGrid`` has three further specialized subclasses: ``FramedVoronoiGrid``,
``HexModelGrid`` and ``RadialModelGrid``. A final class is ``NetworkModelGrid``.

Expand All @@ -23,6 +23,7 @@ The following is an introduction to their properties and methods:
hex
radial
network
icosphere


Additional Methods and Properties
Expand Down Expand Up @@ -60,6 +61,7 @@ API for each grid type
hex
radial
network
icosphere

Additional Grid Base Classes
----------------------------
Expand Down
43 changes: 28 additions & 15 deletions docs/source/user_guide/grid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -547,21 +547,23 @@ As noted earlier, Landlab provides several different types of grid. Available gr
classes, with more specialized grids inheriting properties and behavior from more
general types. The class hierarchy is given in the second column, **Inherits from**.

+-------------------------+-------------------------+--------------------+-------------------+
| Grid type | Inherits from | Node arrangement | Cell geometry |
+=========================+=========================+====================+===================+
| ``RasterModelGrid`` | ``ModelGrid`` | raster | squares |
+-------------------------+-------------------------+--------------------+-------------------+
| ``VoronoiDelaunayGrid`` | ``ModelGrid`` | Delaunay triangles | Voronoi polygons |
+-------------------------+-------------------------+--------------------+-------------------+
| ``FramedVoronoiGrid`` | ``VoronoiDelaunayGrid`` | Delaunay triangles | Voronoi polygons |
+-------------------------+-------------------------+--------------------+-------------------+
| ``HexModelGrid`` | ``VoronoiDelaunayGrid`` | triagonal | hexagons |
+-------------------------+-------------------------+--------------------+-------------------+
| ``RadialModelGrid`` | ``VoronoiDelaunayGrid`` | concentric | Voronoi polygons |
+-------------------------+-------------------------+--------------------+-------------------+
| ``NetworkModelGrid`` | ``ModelGrid`` | ad libitum | No cells |
+-------------------------+-------------------------+--------------------+-------------------+
+-------------------------+-------------------------+--------------------+----------------------+
| Grid type | Inherits from | Node arrangement | Cell geometry |
+=========================+=========================+====================+======================+
| ``RasterModelGrid`` | ``ModelGrid`` | raster | squares |
+-------------------------+-------------------------+--------------------+----------------------+
| ``VoronoiDelaunayGrid`` | ``ModelGrid`` | Delaunay triangles | Voronoi polygons |
+-------------------------+-------------------------+--------------------+----------------------+
| ``FramedVoronoiGrid`` | ``VoronoiDelaunayGrid`` | Delaunay triangles | Voronoi polygons |
+-------------------------+-------------------------+--------------------+----------------------+
| ``HexModelGrid`` | ``VoronoiDelaunayGrid`` | triagonal | hexagons |
+-------------------------+-------------------------+--------------------+----------------------+
| ``RadialModelGrid`` | ``VoronoiDelaunayGrid`` | concentric | Voronoi polygons |
+-------------------------+-------------------------+--------------------+----------------------+
| ``NetworkModelGrid`` | ``ModelGrid`` | ad libitum | No cells |
+-------------------------+-------------------------+--------------------+----------------------+
| ``IcosphereGlobalGrid`` | ``ModelGrid`` | spherical | hexagons & pentagons |
+-------------------------+-------------------------+--------------------+----------------------+

:py:class:`landlab.grid.raster.RasterModelGrid <landlab.grid.raster.RasterModelGrid>`
gives a regular (square) grid, initialized
Expand All @@ -579,6 +581,17 @@ regular hexagons.
In a :py:class:`landlab.grid.radial.RadialModelGrid <landlab.grid.radial.RadialModelGrid>`, nodes are created in concentric
circles and then connected to
form a Delaunay triangulation (again with Voronoi polygons as cells).
:py:class:`landlab.grid.network.NetworkModelGrid` represents a branching network of nodes and links,
without cells or patches.
An :py:class:`landlab.grid.icosphere.IcosphereGlobalGrid` represents the surface of a sphere.
The default configuration is a spherical grid of unit radius that
forms the spherical version an icosahedron (20 triangular patches,
12 nodes), with the dual complement representing a dodecahedron
(12 hexagonal cells, 20 corners). The mesh_densification_level
parameter allows you to densify this initial shape by subdividing
each triangular patch into four triangles, with corresponding
addition of nodes (as the triangle vertices), together with
corresponding cells and corners.

.. _importing_a_dem:

Expand Down
46 changes: 24 additions & 22 deletions landlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@
:URL: https://landlab.readthedocs.io/en/release/
:License: MIT
"""
from ._registry import registry
from ._version import __version__
from .core.errors import MissingKeyError
from .core.errors import ParameterValueError
from .core.model_component import Component
from .core.model_parameter_loader import load_params
from .core.utils import ExampleData
from .field import FieldError
from .grid import FramedVoronoiGrid
from .grid import HexModelGrid
from .grid import ModelGrid
from .grid import NetworkModelGrid
from .grid import RadialModelGrid
from .grid import RasterModelGrid
from .grid import VoronoiDelaunayGrid
from .grid import create_grid
from .grid.linkstatus import LinkStatus
from .grid.nodestatus import NodeStatus
from .plot import imshow_grid
from .plot import imshow_grid_at_node
from .plot import imshowhs_grid
from .plot import imshowhs_grid_at_node
from landlab._registry import registry
from landlab._version import __version__
from landlab.core.errors import MissingKeyError
from landlab.core.errors import ParameterValueError
from landlab.core.model_component import Component
from landlab.core.model_parameter_loader import load_params
from landlab.core.utils import ExampleData
from landlab.field.errors import FieldError
from landlab.grid.base import ModelGrid
from landlab.grid.create import create_grid
from landlab.grid.framed_voronoi import FramedVoronoiGrid
from landlab.grid.hex import HexModelGrid
from landlab.grid.icosphere import IcosphereGlobalGrid
from landlab.grid.linkstatus import LinkStatus
from landlab.grid.network import NetworkModelGrid
from landlab.grid.nodestatus import NodeStatus
from landlab.grid.radial import RadialModelGrid
from landlab.grid.raster import RasterModelGrid
from landlab.grid.voronoi import VoronoiDelaunayGrid
from landlab.plot.imshow import imshow_grid
from landlab.plot.imshow import imshow_grid_at_node
from landlab.plot.imshowhs import imshowhs_grid
from landlab.plot.imshowhs import imshowhs_grid_at_node

cite_as = registry.format_citations

Expand All @@ -50,6 +51,7 @@
"FramedVoronoiGrid",
"VoronoiDelaunayGrid",
"NetworkModelGrid",
"IcosphereGlobalGrid",
"LinkStatus",
"NodeStatus",
"create_grid",
Expand Down
2 changes: 1 addition & 1 deletion landlab/field/graph_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def fixed_size(self):
def fixed_size(self, fixed_size):
self._fixed_size = bool(fixed_size)
if self._fixed_size:
self.size = self._ds.dims[self._name]
self.size = self._ds.sizes[self._name]

@property
def units(self):
Expand Down
40 changes: 21 additions & 19 deletions landlab/graph/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
from .dual import DualGraph
from .framed_voronoi import DualFramedVoronoiGraph
from .framed_voronoi import FramedVoronoiGraph
from .graph import Graph
from .graph import NetworkGraph
from .graph_convention import ConventionConverter
from .graph_convention import GraphConvention
from .hex import DualHexGraph
from .hex import TriGraph
from .radial import DualRadialGraph
from .radial import RadialGraph
from .structured_quad import DualRectilinearGraph
from .structured_quad import DualStructuredQuadGraph
from .structured_quad import DualUniformRectilinearGraph
from .structured_quad import RectilinearGraph
from .structured_quad import StructuredQuadGraph
from .structured_quad import UniformRectilinearGraph
from .voronoi import DelaunayGraph
from .voronoi import DualVoronoiGraph
from landlab.graph.dual import DualGraph
from landlab.graph.framed_voronoi.dual_framed_voronoi import DualFramedVoronoiGraph
from landlab.graph.framed_voronoi.framed_voronoi import FramedVoronoiGraph
from landlab.graph.graph import Graph
from landlab.graph.graph import NetworkGraph
from landlab.graph.graph_convention import ConventionConverter
from landlab.graph.graph_convention import GraphConvention
from landlab.graph.hex.dual_hex import DualHexGraph
from landlab.graph.hex.hex import TriGraph
from landlab.graph.radial.dual_radial import DualRadialGraph
from landlab.graph.radial.radial import RadialGraph
from landlab.graph.structured_quad.dual_structured_quad import DualRectilinearGraph
from landlab.graph.structured_quad.dual_structured_quad import DualStructuredQuadGraph
from landlab.graph.structured_quad.dual_structured_quad import (
DualUniformRectilinearGraph,
)
from landlab.graph.structured_quad.structured_quad import RectilinearGraph
from landlab.graph.structured_quad.structured_quad import StructuredQuadGraph
from landlab.graph.structured_quad.structured_quad import UniformRectilinearGraph
from landlab.graph.voronoi.dual_voronoi import DualVoronoiGraph
from landlab.graph.voronoi.voronoi import DelaunayGraph

__all__ = [
"Graph",
Expand Down
6 changes: 3 additions & 3 deletions landlab/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def number_of_nodes(self):
:meta landlab: info-node
"""
return self.ds.dims["node"]
return self.ds.sizes["node"]

@property
def nodes_at_link(self):
Expand Down Expand Up @@ -534,7 +534,7 @@ def number_of_links(self):
True
"""
try:
return self.ds.dims["link"]
return self.ds.sizes["link"]
except KeyError:
return 0

Expand Down Expand Up @@ -982,7 +982,7 @@ def number_of_patches(self):
:meta landlab: info-patch
"""
try:
return self.ds.dims["patch"]
return self.ds.sizes["patch"]
except KeyError:
return 0

Expand Down
Empty file.
Loading

0 comments on commit 2c900a3

Please sign in to comment.