Skip to content

Commit

Permalink
deploy: c98b776
Browse files Browse the repository at this point in the history
  • Loading branch information
Huite committed Apr 29, 2024
1 parent 7b19f0e commit d677c2c
Show file tree
Hide file tree
Showing 307 changed files with 2,834 additions and 567 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: 4c58a4ceab4453c17ef67772dbeeab06
config: 1864999a6a1df70cb84555637409d055
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified .doctrees/api.doctree
Binary file not shown.
Binary file modified .doctrees/api/xugrid.BarycentricInterpolator.doctree
Binary file not shown.
Binary file modified .doctrees/api/xugrid.CentroidLocatorRegridder.doctree
Binary file not shown.
Binary file modified .doctrees/api/xugrid.OverlapRegridder.doctree
Binary file not shown.
Binary file modified .doctrees/api/xugrid.RelativeOverlapRegridder.doctree
Binary file not shown.
Binary file modified .doctrees/api/xugrid.Ugrid2d.doctree
Binary file not shown.
Binary file not shown.
Binary file modified .doctrees/api/xugrid.burn_vector_geometry.doctree
Binary file not shown.
Binary file not shown.
Binary file modified .doctrees/changelog.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Binary file modified .doctrees/examples-dev/sg_execution_times.doctree
Binary file not shown.
Binary file modified .doctrees/examples-dev/voronoi.doctree
Binary file not shown.
Binary file modified .doctrees/examples/connectivity.doctree
Binary file not shown.
Binary file modified .doctrees/examples/overlap_regridder.doctree
Binary file not shown.
Binary file modified .doctrees/examples/partitioning.doctree
Binary file not shown.
Binary file modified .doctrees/examples/plotting.doctree
Binary file not shown.
Binary file modified .doctrees/examples/quick_overview.doctree
Binary file not shown.
Binary file modified .doctrees/examples/regridder_overview.doctree
Binary file not shown.
Binary file modified .doctrees/examples/selection.doctree
Binary file not shown.
Binary file modified .doctrees/examples/sg_execution_times.doctree
Binary file not shown.
Binary file modified .doctrees/examples/vector_conversion.doctree
Binary file not shown.
Binary file modified .doctrees/sample_data/adh_san_diego.doctree
Binary file not shown.
Binary file modified .doctrees/sample_data/disk.doctree
Binary file not shown.
Binary file modified .doctrees/sample_data/elevation_nl.doctree
Binary file not shown.
Binary file modified .doctrees/sample_data/provinces_nl.doctree
Binary file not shown.
Binary file modified .doctrees/sample_data/sg_execution_times.doctree
Binary file not shown.
Binary file modified .doctrees/sample_data/xoxo.doctree
Binary file not shown.
Binary file modified .doctrees/sg_execution_times.doctree
Binary file not shown.
30 changes: 29 additions & 1 deletion _modules/xugrid/regrid/regridder.html
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ <h1>Source code for xugrid.regrid.regridder</h1><div class="highlight"><pre>

<span class="kn">import</span> <span class="nn">numba</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="kn">import</span> <span class="nn">xarray</span> <span class="k">as</span> <span class="nn">xr</span>

<span class="kn">import</span> <span class="nn">xugrid</span> <span class="k">as</span> <span class="nn">xu</span>
Expand Down Expand Up @@ -476,10 +477,12 @@ <h1>Source code for xugrid.regrid.regridder</h1><div class="highlight"><pre>
<span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_source</span> <span class="o">=</span> <span class="n">setup_grid</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">_target</span> <span class="o">=</span> <span class="n">setup_grid</span><span class="p">(</span><span class="n">target</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_weights</span> <span class="o">=</span> <span class="kc">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_compute_weights</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</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="k">return</span>

<span class="nd">@abc</span><span class="o">.</span><span class="n">abstractproperty</span>
<span class="nd">@property</span>
<span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
<span class="k">def</span> <span class="nf">weights</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">pass</span>

Expand Down Expand Up @@ -632,6 +635,31 @@ <h1>Source code for xugrid.regrid.regridder</h1><div class="highlight"><pre>
<span class="n">target_ds</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">to_dataset</span><span class="p">(</span><span class="s2">&quot;__target&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">xr</span><span class="o">.</span><span class="n">merge</span><span class="p">((</span><span class="n">weights_ds</span><span class="p">,</span> <span class="n">source_ds</span><span class="p">,</span> <span class="n">target_ds</span><span class="p">))</span>

<span class="k">def</span> <span class="nf">weights_as_dataframe</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Return the weights as a three column dataframe:</span>

<span class="sd"> * source index</span>
<span class="sd"> * target index</span>
<span class="sd"> * weight</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> weights: pd.DataFrame</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">matrix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_weights</span>
<span class="k">if</span> <span class="n">matrix</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Weights have not been computed yet.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">matrix</span><span class="p">,</span> <span class="n">MatrixCSR</span><span class="p">):</span>
<span class="n">matrix</span> <span class="o">=</span> <span class="n">matrix</span><span class="o">.</span><span class="n">to_coo</span><span class="p">()</span>
<span class="k">return</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span>
<span class="p">{</span>
<span class="s2">&quot;target_index&quot;</span><span class="p">:</span> <span class="n">matrix</span><span class="o">.</span><span class="n">row</span><span class="p">,</span>
<span class="s2">&quot;source_index&quot;</span><span class="p">:</span> <span class="n">matrix</span><span class="o">.</span><span class="n">col</span><span class="p">,</span>
<span class="s2">&quot;weight&quot;</span><span class="p">:</span> <span class="n">matrix</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
<span class="p">}</span>
<span class="p">)</span>

<span class="nd">@staticmethod</span>
<span class="k">def</span> <span class="nf">_csr_from_dataset</span><span class="p">(</span><span class="n">dataset</span><span class="p">:</span> <span class="n">xr</span><span class="o">.</span><span class="n">Dataset</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">MatrixCSR</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
Expand Down
Loading

0 comments on commit d677c2c

Please sign in to comment.