Skip to content

Commit

Permalink
deploy: 60bb1bb
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikKok committed Jul 13, 2023
1 parent 6c888fa commit e73db85
Show file tree
Hide file tree
Showing 55 changed files with 305 additions and 301 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: 95e146315b5c73b8d1e618b51d69657d
config: 41b471fb9f955ce9b60e9a6afd82478e
tags: 645f666f9bcd5a90fca523b33c5a78b7
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 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.
26 changes: 15 additions & 11 deletions _modules/xugrid/regrid/regridder.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,12 @@ <h1>Source code for xugrid.regrid.regridder</h1><div class="highlight"><pre>
<span class="kn">import</span> <span class="nn">dask.array</span>

<span class="n">DaskArray</span> <span class="o">=</span> <span class="n">dask</span><span class="o">.</span><span class="n">array</span><span class="o">.</span><span class="n">Array</span>
<span class="n">DaskRechunk</span> <span class="o">=</span> <span class="n">dask</span><span class="o">.</span><span class="n">array</span><span class="o">.</span><span class="n">rechunk</span>
<span class="n">DaskReshape</span> <span class="o">=</span> <span class="n">dask</span><span class="o">.</span><span class="n">array</span><span class="o">.</span><span class="n">reshape</span>
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
<span class="n">DaskArray</span> <span class="o">=</span> <span class="p">()</span>
<span class="n">DaskRechunk</span> <span class="o">=</span> <span class="p">()</span>
<span class="n">DaskReshape</span> <span class="o">=</span> <span class="p">()</span>

<span class="kn">import</span> <span class="nn">xugrid</span>
<span class="kn">from</span> <span class="nn">xugrid.constants</span> <span class="kn">import</span> <span class="n">FloatArray</span>
Expand Down Expand Up @@ -521,8 +525,14 @@ <h1>Source code for xugrid.regrid.regridder</h1><div class="highlight"><pre>
<span class="n">source</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">source_grid</span><span class="o">.</span><span class="n">size</span><span class="p">))</span>

<span class="n">size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">size</span>
<span class="c1"># E.g.: sizes of (&quot;time&quot;, &quot;layer&quot;) + (&quot;y&quot;, &quot;x&quot;)</span>
<span class="n">out_shape</span> <span class="o">=</span> <span class="n">first_dims_shape</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">shape</span>

<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">DaskArray</span><span class="p">):</span>
<span class="n">chunks</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">chunks</span><span class="p">[:</span> <span class="o">-</span><span class="n">source_grid</span><span class="o">.</span><span class="n">ndim</span><span class="p">]</span> <span class="o">+</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">shape</span><span class="p">,)</span>
<span class="c1"># for DaskArray&#39;s from multiple partitions, rechunk first to single size per dimension</span>
<span class="c1"># for now always rechunk, could be optional only when explicit chunks in single dimension</span>
<span class="n">source</span> <span class="o">=</span> <span class="n">DaskRechunk</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">source</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
<span class="n">chunks</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">chunks</span><span class="p">[:</span> <span class="o">-</span><span class="n">source_grid</span><span class="o">.</span><span class="n">ndim</span><span class="p">]</span> <span class="o">+</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
<span class="n">out</span> <span class="o">=</span> <span class="n">dask</span><span class="o">.</span><span class="n">array</span><span class="o">.</span><span class="n">map_blocks</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_regrid</span><span class="p">,</span> <span class="c1"># func</span>
<span class="n">source</span><span class="p">,</span> <span class="c1"># *args</span>
Expand All @@ -532,17 +542,16 @@ <h1>Source code for xugrid.regrid.regridder</h1><div class="highlight"><pre>
<span class="n">chunks</span><span class="o">=</span><span class="n">chunks</span><span class="p">,</span>
<span class="n">meta</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">((),</span> <span class="n">dtype</span><span class="o">=</span><span class="n">source</span><span class="o">.</span><span class="n">dtype</span><span class="p">),</span>
<span class="p">)</span>
<span class="n">out</span> <span class="o">=</span> <span class="n">out</span><span class="o">.</span><span class="n">compute</span><span class="p">()</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">out_shape</span><span class="p">)</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">):</span>
<span class="n">out</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_regrid</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_weights</span><span class="p">,</span> <span class="n">size</span><span class="p">)</span>
<span class="n">out</span> <span class="o">=</span> <span class="n">out</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">out_shape</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span>
<span class="s2">&quot;Expected dask.array.Array or numpy.ndarray. Received: &quot;</span>
<span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">source</span><span class="p">)</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="p">)</span>

<span class="c1"># E.g.: sizes of (&quot;time&quot;, &quot;layer&quot;) + (&quot;y&quot;, &quot;x&quot;)</span>
<span class="n">out_shape</span> <span class="o">=</span> <span class="n">first_dims_shape</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">shape</span>
<span class="k">return</span> <span class="n">out</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">out_shape</span><span class="p">)</span>
<span class="k">return</span> <span class="n">out</span>

<span class="k">def</span> <span class="nf">regrid_dataarray</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">xr</span><span class="o">.</span><span class="n">DataArray</span><span class="p">,</span> <span class="n">source_dims</span><span class="p">:</span> <span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">]):</span>
<span class="c1"># Do not set vectorize=True: numba will run the for loop more</span>
Expand Down Expand Up @@ -580,12 +589,7 @@ <h1>Source code for xugrid.regrid.regridder</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="p">)</span> <span class="ow">is</span> <span class="n">StructuredGrid2d</span><span class="p">:</span>
<span class="n">source_dims</span> <span class="o">=</span> <span class="p">(</span><span class="s2">&quot;y&quot;</span><span class="p">,</span> <span class="s2">&quot;x&quot;</span><span class="p">)</span>
<span class="n">regridded</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">regrid_dataarray</span><span class="p">(</span><span class="nb">object</span><span class="p">,</span> <span class="n">source_dims</span><span class="p">)</span>
<span class="n">regridded</span> <span class="o">=</span> <span class="n">regridded</span><span class="o">.</span><span class="n">assign_coords</span><span class="p">(</span>
<span class="n">coords</span><span class="o">=</span><span class="p">{</span>
<span class="s2">&quot;y&quot;</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">flip</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">ybounds</span><span class="o">.</span><span class="n">midpoints</span><span class="p">),</span>
<span class="s2">&quot;x&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">xbounds</span><span class="o">.</span><span class="n">midpoints</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span>
<span class="n">regridded</span> <span class="o">=</span> <span class="n">regridded</span><span class="o">.</span><span class="n">assign_coords</span><span class="p">(</span><span class="n">coords</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">coords</span><span class="p">)</span>
<span class="k">return</span> <span class="n">regridded</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">source_dims</span> <span class="o">=</span> <span class="p">(</span><span class="nb">object</span><span class="o">.</span><span class="n">ugrid</span><span class="o">.</span><span class="n">grid</span><span class="o">.</span><span class="n">face_dimension</span><span class="p">,)</span>
Expand Down
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:01.589** total execution time for **examples-dev** files:
**00:02.366** total execution time for **examples-dev** files:

+----------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_examples-dev_voronoi.py` (``voronoi.py``) | 00:01.589 | 0.0 MB |
| :ref:`sphx_glr_examples-dev_voronoi.py` (``voronoi.py``) | 00:02.366 | 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 1.589 seconds)
**Total running time of the script:** ( 0 minutes 2.366 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 0x7f8384680670>
<matplotlib.collections.PolyCollection object at 0x7f6064be7b80>
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 0x7f8385634eb0>
<matplotlib.collections.PolyCollection object at 0x7f60653e87c0>
Expand Down Expand Up @@ -200,7 +200,7 @@ alternative border value:
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f838531efa0>
<matplotlib.collections.PolyCollection object at 0x7f6064b6f5e0>
Expand Down Expand Up @@ -238,7 +238,7 @@ analyse connected parts of the mesh.
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f83839e3910>
<matplotlib.collections.PolyCollection object at 0x7f606517ff10>
Expand Down Expand Up @@ -272,7 +272,7 @@ Tesselation.
.. code-block:: none
<matplotlib.collections.LineCollection object at 0x7f8385435dc0>
<matplotlib.collections.LineCollection object at 0x7f606450b400>
Expand Down Expand Up @@ -316,7 +316,7 @@ the original.
.. code-block:: none
<matplotlib.collections.LineCollection object at 0x7f8383b09280>
<matplotlib.collections.LineCollection object at 0x7f6063422880>
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 0x7f83847484f0>
<matplotlib.collections.LineCollection object at 0x7f606e0efaf0>
Expand Down Expand Up @@ -409,7 +409,7 @@ the upper and lower parts:
.. code-block:: none
<matplotlib.collections.LineCollection object at 0x7f8383985ac0>
<matplotlib.collections.LineCollection object at 0x7f606e31ab50>
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 0x7f838e4d8c70>
<matplotlib.collections.PolyCollection object at 0x7f60652c52b0>
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 0x7f838e2416a0>
<matplotlib.image.AxesImage object at 0x7f606df68ca0>
Expand Down Expand Up @@ -516,14 +516,14 @@ locality:
.. code-block:: none
<matplotlib.image.AxesImage object at 0x7f838457f850>
<matplotlib.image.AxesImage object at 0x7f60648f2c10>
.. rst-class:: sphx-glr-timing

**Total running time of the script:** ( 0 minutes 1.619 seconds)
**Total running time of the script:** ( 0 minutes 2.422 seconds)


.. _sphx_glr_download_examples_connectivity.py:
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 0x7f8384f24190>
<matplotlib.collections.LineCollection object at 0x7f60646cf970>
Expand Down Expand Up @@ -204,7 +204,7 @@ conservative methods, such as conductance:
.. code-block:: none
<matplotlib.collections.PolyCollection object at 0x7f838e2b44f0>
<matplotlib.collections.PolyCollection object at 0x7f60633e3af0>
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 0x7f8383b88970>
<matplotlib.collections.PolyCollection object at 0x7f60636cad60>
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 0x7f838541d730>
<matplotlib.collections.PolyCollection object at 0x7f6065212cd0>
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 5.273 seconds)
**Total running time of the script:** ( 0 minutes 7.128 seconds)


.. _sphx_glr_download_examples_overlap_regridder.py:
Expand Down
Loading

0 comments on commit e73db85

Please sign in to comment.