Skip to content

Commit

Permalink
deploy: 233712d
Browse files Browse the repository at this point in the history
  • Loading branch information
Huite committed Aug 4, 2023
1 parent b72594b commit 5ed7f0d
Show file tree
Hide file tree
Showing 65 changed files with 478 additions and 346 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 61a9ea2d2d65b3270ba2662df8d746e4
config: 50a0ddf5282098ceba6fbdc22ecf30c8
tags: 645f666f9bcd5a90fca523b33c5a78b7
28 changes: 28 additions & 0 deletions _downloads/714f83d87afaca41fed5d7f2c5f887d4/vector_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,31 @@
# result will essentially be one polygon per face. In such cases, it is more
# efficient to use ``xugrid.UgridDataArray.to_geodataframe``, which directly
# converts every face to a polygon.
#
# Snap to grid
# ------------
#
# The examples above deal with data on the faces of the grid. However, data can
# also be associated with the nodes or edges of the grid. For example, we can
# snap line data to exactly follow the edges (the face boundaries):

linestrings = gpd.GeoDataFrame(geometry=utrecht.exterior)
snapped_uds, snapped_gdf = xu.snap_to_grid(linestrings, uda, max_snap_distance=1.0)

fig, ax = plt.subplots()
snapped_gdf.plot(ax=ax)
snapped_uds.ugrid.grid.plot(ax=ax, edgecolor="gray", linewidth=0.5)
utrecht.plot(ax=ax, edgecolor="red", facecolor="none", linewidth=0.75)
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin, ymax)

# %%
# There are (arguably) many ways in which a linestring could be snapped to
# edges. The function above uses the criterion the following criterion: if a
# part of the linestring is located between the centroid of a face and the
# centroid of an edge, it is snapped to that edge.
#
# This sometimes result in less (visually) pleasing results, such as the two
# triangles in the lower left corner which are surrounded by the snapped edges.
# In general, results are best when the line segments are relatively large
# compare to the grid faces.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,25 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We see that the results consists of two large polygons, in which the\ntriangles of the triangular grid have been merged to form a single polygon,\nand many smaller polygons, some of which correspond one to one to the\ntriangles of the grid.\n\n<div class=\"alert alert-info\"><h4>Note</h4><p>The produced polygon edges will follow exactly the face boundaries. When\n the data consists of many unique values (e.g. unbinned elevation data), the\n result will essentially be one polygon per face. In such cases, it is more\n efficient to use ``xugrid.UgridDataArray.to_geodataframe``, which directly\n converts every face to a polygon.</p></div>\n\n"
"We see that the results consists of two large polygons, in which the\ntriangles of the triangular grid have been merged to form a single polygon,\nand many smaller polygons, some of which correspond one to one to the\ntriangles of the grid.\n\n<div class=\"alert alert-info\"><h4>Note</h4><p>The produced polygon edges will follow exactly the face boundaries. When\n the data consists of many unique values (e.g. unbinned elevation data), the\n result will essentially be one polygon per face. In such cases, it is more\n efficient to use ``xugrid.UgridDataArray.to_geodataframe``, which directly\n converts every face to a polygon.</p></div>\n\n## Snap to grid\n\nThe examples above deal with data on the faces of the grid. However, data can\nalso be associated with the nodes or edges of the grid. For example, we can\nsnap line data to exactly follow the edges (the face boundaries):\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"linestrings = gpd.GeoDataFrame(geometry=utrecht.exterior)\nsnapped_uds, snapped_gdf = xu.snap_to_grid(linestrings, uda, max_snap_distance=1.0)\n\nfig, ax = plt.subplots()\nsnapped_gdf.plot(ax=ax)\nsnapped_uds.ugrid.grid.plot(ax=ax, edgecolor=\"gray\", linewidth=0.5)\nutrecht.plot(ax=ax, edgecolor=\"red\", facecolor=\"none\", linewidth=0.75)\nax.set_xlim(xmin, xmax)\nax.set_ylim(ymin, ymax)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There are (arguably) many ways in which a linestring could be snapped to\nedges. The function above uses the criterion the following criterion: if a\npart of the linestring is located between the centroid of a face and the\ncentroid of an edge, it is snapped to that edge.\n\nThis sometimes result in less (visually) pleasing results, such as the two\ntriangles in the lower left corner which are surrounded by the snapped edges.\nIn general, results are best when the line segments are relatively large\ncompare to the grid faces.\n\n"
]
}
],
Expand Down
Binary file modified _images/sphx_glr_connectivity_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_connectivity_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_connectivity_003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_connectivity_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_disk_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_disk_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_plotting_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_plotting_003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_plotting_004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_plotting_005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_plotting_006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_plotting_007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_plotting_008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_plotting_009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_plotting_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_quick_overview_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/sphx_glr_vector_conversion_011.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_voronoi_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_voronoi_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_voronoi_003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_voronoi_004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_voronoi_005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_voronoi_006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_voronoi_007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_voronoi_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 24 additions & 20 deletions _modules/xugrid/ugrid/snapping.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions _sources/examples-dev/sg_execution_times.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

Computation times
=================
**00:02.310** total execution time for **examples-dev** files:
**00:01.578** total execution time for **examples-dev** files:

+----------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_examples-dev_voronoi.py` (``voronoi.py``) | 00:02.310 | 0.0 MB |
| :ref:`sphx_glr_examples-dev_voronoi.py` (``voronoi.py``) | 00:01.578 | 0.0 MB |
+----------------------------------------------------------+-----------+--------+
2 changes: 1 addition & 1 deletion _sources/examples-dev/voronoi.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ The figure shows:
.. rst-class:: sphx-glr-timing

**Total running time of the script:** ( 0 minutes 2.310 seconds)
**Total running time of the script:** ( 0 minutes 1.578 seconds)


.. _sphx_glr_download_examples-dev_voronoi.py:
Expand Down
24 changes: 12 additions & 12 deletions _sources/examples/connectivity.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ By default, the border value for binary erosion is set to ``False`` (equal to
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f0db519faf0>
<matplotlib.collections.PolyCollection object at 0x7f868be4ac40>
Expand Down Expand Up @@ -165,7 +165,7 @@ start by setting a single value in the center of the grid to ``True``.
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f0db4823a00>
<matplotlib.collections.PolyCollection object at 0x7f868b882b80>
Expand Down Expand Up @@ -200,7 +200,7 @@ alternative border value:
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f0db4550fa0>
<matplotlib.collections.PolyCollection object at 0x7f868b45c100>
Expand Down Expand Up @@ -238,7 +238,7 @@ analyse connected parts of the mesh.
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f0db43b2910>
<matplotlib.collections.PolyCollection object at 0x7f8699d5ea30>
Expand Down Expand Up @@ -272,7 +272,7 @@ Tesselation.
.. code-block:: none
<matplotlib.collections.LineCollection object at 0x7f0db43d3dc0>
<matplotlib.collections.LineCollection object at 0x7f868a8bbf10>
Expand Down Expand Up @@ -316,7 +316,7 @@ the original.
.. code-block:: none
<matplotlib.collections.LineCollection object at 0x7f0da7b92280>
<matplotlib.collections.LineCollection object at 0x7f868b9073a0>
Expand Down Expand Up @@ -355,7 +355,7 @@ We can break down one of the Voronoi tesselations from above into triangles:
.. code-block:: none
<matplotlib.collections.LineCollection object at 0x7f0db66cc4f0>
<matplotlib.collections.LineCollection object at 0x7f8699cad610>
Expand Down Expand Up @@ -409,7 +409,7 @@ the upper and lower parts:
.. code-block:: none
<matplotlib.collections.LineCollection object at 0x7f0da7cdc550>
<matplotlib.collections.LineCollection object at 0x7f868a938670>
Expand Down Expand Up @@ -439,7 +439,7 @@ We can now use Laplace interpolation to fill the gaps in the grid.
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f0db671ed00>
<matplotlib.collections.PolyCollection object at 0x7f869a01de20>
Expand Down Expand Up @@ -480,7 +480,7 @@ To illustrate, let's take a look at the connectivity matrix of the Xoxo grid.
.. code-block:: none
<matplotlib.image.AxesImage object at 0x7f0db46a44f0>
<matplotlib.image.AxesImage object at 0x7f868bfd3610>
Expand Down Expand Up @@ -516,14 +516,14 @@ locality:
.. code-block:: none
<matplotlib.image.AxesImage object at 0x7f0db47ce6d0>
<matplotlib.image.AxesImage object at 0x7f8698111b20>
.. rst-class:: sphx-glr-timing

**Total running time of the script:** ( 0 minutes 2.363 seconds)
**Total running time of the script:** ( 0 minutes 1.613 seconds)


.. _sphx_glr_download_examples_connectivity.py:
Expand Down
18 changes: 9 additions & 9 deletions _sources/examples/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,35 +102,35 @@ notebook for interactive exploration.

.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="A great deal of geospatial data is available not in gridded form, but in vectorized form: as po...">
<div class="sphx-glr-thumbcontainer" tooltip="`Regridding`_ is the process of converting gridded data from one grid to another grid. Xugrid p...">

.. only:: html

.. image:: /examples/images/thumb/sphx_glr_vector_conversion_thumb.png
.. image:: /examples/images/thumb/sphx_glr_regridder_overview_thumb.png
:alt:

:ref:`sphx_glr_examples_vector_conversion.py`
:ref:`sphx_glr_examples_regridder_overview.py`

.. raw:: html

<div class="sphx-glr-thumbnail-title">Vector geometry conversion</div>
<div class="sphx-glr-thumbnail-title">Regridding overview</div>
</div>


.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="`Regridding`_ is the process of converting gridded data from one grid to another grid. Xugrid p...">
<div class="sphx-glr-thumbcontainer" tooltip="A great deal of geospatial data is available not in gridded form, but in vectorized form: as po...">

.. only:: html

.. image:: /examples/images/thumb/sphx_glr_regridder_overview_thumb.png
.. image:: /examples/images/thumb/sphx_glr_vector_conversion_thumb.png
:alt:

:ref:`sphx_glr_examples_regridder_overview.py`
:ref:`sphx_glr_examples_vector_conversion.py`

.. raw:: html

<div class="sphx-glr-thumbnail-title">Regridding overview</div>
<div class="sphx-glr-thumbnail-title">Vector geometry conversion</div>
</div>


Expand All @@ -147,8 +147,8 @@ notebook for interactive exploration.
/examples/plotting
/examples/overlap_regridder
/examples/connectivity
/examples/vector_conversion
/examples/regridder_overview
/examples/vector_conversion



Expand Down
10 changes: 5 additions & 5 deletions _sources/examples/overlap_regridder.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ some bathymetry) of the Netherlands, and a coarser target grid.
.. code-block:: none
<matplotlib.collections.LineCollection object at 0x7f0da7f56250>
<matplotlib.collections.LineCollection object at 0x7f868b8954c0>
Expand Down Expand Up @@ -204,7 +204,7 @@ conservative methods, such as conductance:
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f0db68114f0>
<matplotlib.collections.PolyCollection object at 0x7f868aa2b610>
Expand Down Expand Up @@ -282,7 +282,7 @@ To use our custom method, we provide at initialization of the OverlapRegridder:
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f0db4514970>
<matplotlib.collections.PolyCollection object at 0x7f868a9f39a0>
Expand Down Expand Up @@ -322,7 +322,7 @@ function can deal with NaN values! -- hence ``nanpercentile`` rather than
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f0da7c90250>
<matplotlib.collections.PolyCollection object at 0x7f868a53bdf0>
Expand All @@ -333,7 +333,7 @@ function can deal with NaN values! -- hence ``nanpercentile`` rather than

.. rst-class:: sphx-glr-timing

**Total running time of the script:** ( 0 minutes 6.988 seconds)
**Total running time of the script:** ( 0 minutes 5.197 seconds)


.. _sphx_glr_download_examples_overlap_regridder.py:
Expand Down
Loading

0 comments on commit 5ed7f0d

Please sign in to comment.