From 389725312f933727170a4cebc720edee29acdd85 Mon Sep 17 00:00:00 2001 From: ajfriend Date: Sat, 4 May 2024 16:10:23 -0700 Subject: [PATCH] H3Shape -> Shape --- docs/api_quick.md | 2 +- docs/polygon_tutorial.ipynb | 22 +++++++++++----------- src/h3/api/basic_int/__init__.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/api_quick.md b/docs/api_quick.md index 0452a2ef..81e09129 100644 --- a/docs/api_quick.md +++ b/docs/api_quick.md @@ -127,7 +127,7 @@ Note that this is reversed from [``__geo_interface__``](https://gist.github.com/ .. currentmodule:: h3 .. autosummary:: - H3Shape + Shape LatLngPoly LatLngMultiPoly ``` diff --git a/docs/polygon_tutorial.ipynb b/docs/polygon_tutorial.ipynb index 4d363654..59f62f0a 100644 --- a/docs/polygon_tutorial.ipynb +++ b/docs/polygon_tutorial.ipynb @@ -9,9 +9,9 @@ "\n", "`h3-py` can convert between sets of cells and GeoJSON-like polygon and multipolygon shapes.\n", "\n", - "We use the abstract base class `H3Shape` and its concrete child classes `LatLngPoly` and `LatLngMultiPoly`\n", + "We use the abstract base class `Shape` and its concrete child classes `LatLngPoly` and `LatLngMultiPoly`\n", "to represent these shapes. \n", - "Any references or function names that use \"H3Shape\" will apply to both `LatLngPoly` and `LatLngMultiPoly` objects.\n", + "Any references or function names that use \"Shape\" will apply to both `LatLngPoly` and `LatLngMultiPoly` objects.\n", "\n", "`h3-py` is also compatible with Python objects that implement `__geo_interface__` (https://gist.github.com/sgillies/2217756),\n", "making it easy to interface with other Python geospatial libraries.\n", @@ -455,7 +455,7 @@ "source": [ "## MultiPolygon to cells\n", "\n", - "`h3.shape_to_cells()` works on both `LatLngMultiPoly` and `LatLngPoly` objects (both are subclasses of `H3Shape`)." + "`h3.shape_to_cells()` works on both `LatLngMultiPoly` and `LatLngPoly` objects (both are subclasses of `Shape`)." ] }, { @@ -604,37 +604,37 @@ "# API Summary\n", "\n", "```\n", - "\"Geo object\" <-> H3Shape <-> H3 cells\n", + "\"Geo object\" <-> Shape <-> H3 cells\n", "```\n", "\n", "\"Geo objects\" are any Python object that implements `__geo_interface__`. This is a widely used\n", "standard in geospatial Python and is used by libraries like `geopandas` and Shapely.\n", "\n", - "`H3Shape` is an abstract class implemented by `LatLngPoly` and `LatLngMultiPoly`, each of which\n", + "`Shape` is an abstract class implemented by `LatLngPoly` and `LatLngMultiPoly`, each of which\n", "implement `__geo_interface__` and can be created from external \"Geo objects\":\n", "\n", "- `geo_to_shape()`\n", "- `shape_to_geo()`\n", "\n", - "`H3Shape` objects can be converted to and from sets of H3 cells:\n", + "`Shape` objects can be converted to and from sets of H3 cells:\n", "\n", "- `shape_to_cells()`\n", "- `cells_to_shape()`\n", "\n", - "For convience, we provide functions that hide the intermediate `H3Shape` representation:\n", + "For convience, we provide functions that hide the intermediate `Shape` representation:\n", "\n", "- `geo_to_cells()`\n", "- `cells_to_geo()`\n", "\n", "## Equivalance notes\n", "\n", - "Note that if an object `a` is an `H3Shape`\n", + "Note that if an object `a` is an `Shape`\n", "then the following two expressions are equivalent:\n", "\n", "- `shape_to_geo(a)`\n", "- `a.__geo_interface__`\n", "\n", - "Also note that if `a` is an `H3Shape`, then `a` \"passes through\" `geo_to_shape()`:\n", + "Also note that if `a` is an `Shape`, then `a` \"passes through\" `geo_to_shape()`:\n", "\n", "```python\n", "geo_to_shape(a) == a\n", @@ -808,7 +808,7 @@ "## Converting cells to \"geo objects\"\n", "\n", "If we assign `df.geometry = cell_column` we'll get an error because the `geometry` column of a `geopandas.GeoDataFrame` must contain valid geometry objects.\n", - "We can obtain compatible objects by converting the cells to `H3Shape` by applying `h3.cells_to_shape()`.\n", + "We can obtain compatible objects by converting the cells to `Shape` by applying `h3.cells_to_shape()`.\n", "\n", "(Note that, unfortunately, Pandas has some logic to identify iterable members of a series and then renders a tuple of the elements, rather than our preferred `LatLngMultiPoly.__repr__` representation.)" ] @@ -857,7 +857,7 @@ "id": "6ae6afb2-8267-492a-836e-cf371df91e89", "metadata": {}, "source": [ - "Now, if we assign `df.geometry = shape_column`, our `H3Shape` objects will automatically be converted to Shapely Polygon and MultiPolygon objects via `__geo_interface__`." + "Now, if we assign `df.geometry = shape_column`, our `Shape` objects will automatically be converted to Shapely Polygon and MultiPolygon objects via `__geo_interface__`." ] }, { diff --git a/src/h3/api/basic_int/__init__.py b/src/h3/api/basic_int/__init__.py index 358cf3e0..6c777fa9 100644 --- a/src/h3/api/basic_int/__init__.py +++ b/src/h3/api/basic_int/__init__.py @@ -402,7 +402,7 @@ def shape_to_cells(shape, res): Parameters ---------- - shape : ``H3shape`` + shape : ``Shape`` res : int Resolution of the output cells