Skip to content

Commit

Permalink
version 0.0.10 & rebuild docs
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 committed Dec 12, 2019
1 parent f388690 commit c7897aa
Show file tree
Hide file tree
Showing 57 changed files with 651 additions and 590 deletions.
2 changes: 1 addition & 1 deletion docs/html/.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: 576af1d2deccad8912e89e721ed20423
config: c5cb58096bc3e0f665fefc1a2222d76e
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified docs/html/_images/examples_categorical_13_1.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 docs/html/_images/examples_categorical_16_1.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 docs/html/_images/examples_categorical_4_1.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 docs/html/_images/examples_resample_point_data_10_1.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 docs/html/_images/examples_resample_point_data_14_1.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 docs/html/_images/examples_resample_point_data_5_1.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 docs/html/_images/examples_timestamp_missing_data_12_1.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 docs/html/_images/examples_timestamp_missing_data_15_1.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 docs/html/_images/examples_timestamp_missing_data_18_1.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 docs/html/_images/examples_timestamp_missing_data_9_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions docs/html/_modules/geocube/api/core.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>geocube.api.core &mdash; geocube 0.0.9 documentation</title>
<title>geocube.api.core &mdash; geocube 0.0.10 documentation</title>



Expand Down Expand Up @@ -59,7 +59,7 @@


<div class="version">
0.0.9
0.0.10
</div>


Expand Down Expand Up @@ -159,6 +159,8 @@ <h1>Source code for geocube.api.core</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">GeoCube client core functionality</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">numpy</span>

<span class="kn">from</span> <span class="nn">geocube.geo_utils.geobox</span> <span class="k">import</span> <span class="n">GeoBoxMaker</span>
<span class="kn">from</span> <span class="nn">geocube.vector_to_cube</span> <span class="k">import</span> <span class="n">VectorToCube</span>

Expand All @@ -172,7 +174,7 @@ <h1>Source code for geocube.api.core</h1><div class="highlight"><pre>
<span class="n">align</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">geom</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">like</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">fill</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">fill</span><span class="o">=</span><span class="n">numpy</span><span class="o">.</span><span class="n">nan</span><span class="p">,</span>
<span class="n">group_by</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">interpolate_na_method</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">categorical_enums</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
Expand Down Expand Up @@ -216,7 +218,7 @@ <h1>Source code for geocube.api.core</h1><div class="highlight"><pre>
<span class="sd"> gcds = make_geocube(vector_data=&#39;my_vector.geopackage&#39;, like=other_gcds)</span>

<span class="sd"> fill: float, optional</span>
<span class="sd"> The value to fill in the grid with for nodata. Default is -9999.0.</span>
<span class="sd"> The value to fill in the grid with for nodata. Default is NaN.</span>
<span class="sd"> group_by: str, optional</span>
<span class="sd"> When specified, perform basic combining/reducing of the data on this column.</span>
<span class="sd"> interpolate_na_method: {‘linear’, ‘nearest’, ‘cubic’}, optional</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/html/_modules/geocube/exceptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>geocube.exceptions &mdash; geocube 0.0.9 documentation</title>
<title>geocube.exceptions &mdash; geocube 0.0.10 documentation</title>



Expand Down Expand Up @@ -59,7 +59,7 @@


<div class="version">
0.0.9
0.0.10
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/html/_modules/geocube/geo_utils/crs.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>geocube.geo_utils.crs &mdash; geocube 0.0.9 documentation</title>
<title>geocube.geo_utils.crs &mdash; geocube 0.0.10 documentation</title>



Expand Down Expand Up @@ -59,7 +59,7 @@


<div class="version">
0.0.9
0.0.10
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/html/_modules/geocube/geo_utils/geobox.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>geocube.geo_utils.geobox &mdash; geocube 0.0.9 documentation</title>
<title>geocube.geo_utils.geobox &mdash; geocube 0.0.10 documentation</title>



Expand Down Expand Up @@ -59,7 +59,7 @@


<div class="version">
0.0.9
0.0.10
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/html/_modules/geocube/logger.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>geocube.logger &mdash; geocube 0.0.9 documentation</title>
<title>geocube.logger &mdash; geocube 0.0.10 documentation</title>



Expand Down Expand Up @@ -59,7 +59,7 @@


<div class="version">
0.0.9
0.0.10
</div>


Expand Down
63 changes: 51 additions & 12 deletions docs/html/_modules/geocube/rasterize.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>geocube.rasterize &mdash; geocube 0.0.9 documentation</title>
<title>geocube.rasterize &mdash; geocube 0.0.10 documentation</title>



Expand Down Expand Up @@ -59,7 +59,7 @@


<div class="version">
0.0.9
0.0.10
</div>


Expand Down Expand Up @@ -160,6 +160,7 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>
<span class="sd">This module contains tools for rasterizing vector data.</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">numpy</span>
<span class="kn">import</span> <span class="nn">pandas</span>
<span class="kn">import</span> <span class="nn">rasterio.features</span>
<span class="kn">import</span> <span class="nn">rasterio.transform</span>
<span class="kn">import</span> <span class="nn">rasterio.warp</span>
Expand All @@ -170,12 +171,26 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">geocube.logger</span> <span class="k">import</span> <span class="n">get_logger</span>


<span class="k">def</span> <span class="nf">_remove_missing_data</span><span class="p">(</span><span class="n">data_values</span><span class="p">,</span> <span class="n">geometry_array</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Missing data causes issues with interpolation of point data</span>
<span class="sd"> https://github.com/corteva/geocube/issues/9</span>

<span class="sd"> This filters the data so those issues don&#39;t cause problems.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">not_missing_data</span> <span class="o">=</span> <span class="o">~</span><span class="n">pandas</span><span class="o">.</span><span class="n">isnull</span><span class="p">(</span><span class="n">data_values</span><span class="p">)</span>
<span class="n">geometry_array</span> <span class="o">=</span> <span class="n">geometry_array</span><span class="p">[</span><span class="n">not_missing_data</span><span class="p">]</span>
<span class="n">data_values</span> <span class="o">=</span> <span class="n">data_values</span><span class="p">[</span><span class="n">not_missing_data</span><span class="p">]</span>
<span class="k">return</span> <span class="n">data_values</span><span class="p">,</span> <span class="n">geometry_array</span>


<div class="viewcode-block" id="rasterize_image"><a class="viewcode-back" href="../../geocube.html#geocube.rasterize.rasterize_image">[docs]</a><span class="k">def</span> <span class="nf">rasterize_image</span><span class="p">(</span>
<span class="n">geometry_array</span><span class="p">,</span>
<span class="n">data_values</span><span class="p">,</span>
<span class="n">geobox</span><span class="p">,</span>
<span class="n">fill</span><span class="o">=-</span><span class="mf">9999.0</span><span class="p">,</span>
<span class="n">fill</span><span class="p">,</span>
<span class="n">merge_alg</span><span class="o">=</span><span class="n">MergeAlg</span><span class="o">.</span><span class="n">replace</span><span class="p">,</span>
<span class="n">filter_nan</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="o">**</span><span class="n">ignored_kwargs</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
Expand All @@ -189,10 +204,13 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>
<span class="sd"> Data values associated with the list of geojson shapes</span>
<span class="sd"> geobox: :obj:`datacube.utils.geometry.GeoBox`</span>
<span class="sd"> Transform of the resulting image.</span>
<span class="sd"> fill: float, optional</span>
<span class="sd"> The value to fill in the grid with for nodata. Default is -9999.0.</span>
<span class="sd"> fill: float</span>
<span class="sd"> The value to fill in the grid with for nodata.</span>
<span class="sd"> merge_alg: `rasterio.enums.MergeAlg`, optional</span>
<span class="sd"> The algorithm for merging values into one cell. Default is `MergeAlg.replace`.</span>
<span class="sd"> filter_nan: bool, optional</span>
<span class="sd"> If True, will remove nodata values from the data before rasterization.</span>
<span class="sd"> Default is False.</span>
<span class="sd"> **ignored_kwargs:</span>
<span class="sd"> These are there to be flexible with additional rasterization methods and</span>
<span class="sd"> will be ignored.</span>
Expand All @@ -206,6 +224,10 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>
<span class="n">logger</span> <span class="o">=</span> <span class="n">get_logger</span><span class="p">()</span>

<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">filter_nan</span><span class="p">:</span>
<span class="n">data_values</span><span class="p">,</span> <span class="n">geometry_array</span> <span class="o">=</span> <span class="n">_remove_missing_data</span><span class="p">(</span>
<span class="n">data_values</span><span class="p">,</span> <span class="n">geometry_array</span>
<span class="p">)</span>
<span class="n">image</span> <span class="o">=</span> <span class="n">rasterio</span><span class="o">.</span><span class="n">features</span><span class="o">.</span><span class="n">rasterize</span><span class="p">(</span>
<span class="nb">zip</span><span class="p">(</span><span class="n">geometry_array</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">mapping</span><span class="p">)</span><span class="o">.</span><span class="n">values</span><span class="p">,</span> <span class="n">data_values</span><span class="p">),</span>
<span class="n">out_shape</span><span class="o">=</span><span class="p">(</span><span class="n">geobox</span><span class="o">.</span><span class="n">height</span><span class="p">,</span> <span class="n">geobox</span><span class="o">.</span><span class="n">width</span><span class="p">),</span>
Expand All @@ -226,9 +248,10 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>
<span class="n">geometry_array</span><span class="p">,</span>
<span class="n">data_values</span><span class="p">,</span>
<span class="n">grid_coords</span><span class="p">,</span>
<span class="n">fill</span><span class="o">=-</span><span class="mf">9999.0</span><span class="p">,</span>
<span class="n">fill</span><span class="p">,</span>
<span class="n">method</span><span class="o">=</span><span class="s2">&quot;nearest&quot;</span><span class="p">,</span>
<span class="n">rescale</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">filter_nan</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="o">**</span><span class="n">ignored_kwargs</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
Expand All @@ -243,12 +266,15 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>
<span class="sd"> Data values associated with the list of geojson shapes</span>
<span class="sd"> grid_coords: dict</span>
<span class="sd"> Output from `rioxarray.rioxarray.affine_to_coords`</span>
<span class="sd"> fill: float, optional</span>
<span class="sd"> The value to fill in the grid with for nodata. Default is -9999.0.</span>
<span class="sd"> fill: float</span>
<span class="sd"> The value to fill in the grid with for nodata.</span>
<span class="sd"> method: {‘linear’, ‘nearest’, ‘cubic’}, optional</span>
<span class="sd"> The method to use for interpolation in `scipy.interpolate.griddata`.</span>
<span class="sd"> rescale: bool, optional</span>
<span class="sd"> Rescale points to unit cube before performing interpolation. Default is false.</span>
<span class="sd"> filter_nan: bool, optional</span>
<span class="sd"> If True, will remove nodata values from the data before rasterization.</span>
<span class="sd"> Default is False.</span>
<span class="sd"> **ignored_kwargs:</span>
<span class="sd"> These are there to be flexible with additional rasterization methods and</span>
<span class="sd"> will be ignored.</span>
Expand All @@ -261,6 +287,10 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="n">data_values</span><span class="o">.</span><span class="n">dtype</span> <span class="o">==</span> <span class="nb">object</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">None</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">filter_nan</span><span class="p">:</span>
<span class="n">data_values</span><span class="p">,</span> <span class="n">geometry_array</span> <span class="o">=</span> <span class="n">_remove_missing_data</span><span class="p">(</span>
<span class="n">data_values</span><span class="p">,</span> <span class="n">geometry_array</span>
<span class="p">)</span>
<span class="k">return</span> <span class="n">griddata</span><span class="p">(</span>
<span class="n">points</span><span class="o">=</span><span class="p">(</span><span class="n">geometry_array</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">geometry_array</span><span class="o">.</span><span class="n">y</span><span class="p">),</span>
<span class="n">values</span><span class="o">=</span><span class="n">data_values</span><span class="p">,</span>
Expand All @@ -276,7 +306,12 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>


<div class="viewcode-block" id="rasterize_points_radial"><a class="viewcode-back" href="../../geocube.html#geocube.rasterize.rasterize_points_radial">[docs]</a><span class="k">def</span> <span class="nf">rasterize_points_radial</span><span class="p">(</span>
<span class="n">geometry_array</span><span class="p">,</span> <span class="n">data_values</span><span class="p">,</span> <span class="n">grid_coords</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s2">&quot;linear&quot;</span><span class="p">,</span> <span class="o">**</span><span class="n">ignored_kwargs</span>
<span class="n">geometry_array</span><span class="p">,</span>
<span class="n">data_values</span><span class="p">,</span>
<span class="n">grid_coords</span><span class="p">,</span>
<span class="n">method</span><span class="o">=</span><span class="s2">&quot;linear&quot;</span><span class="p">,</span>
<span class="n">filter_nan</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="o">**</span><span class="n">ignored_kwargs</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> This method uses scipy.interpolate.Rbf to interpolate point data</span>
Expand All @@ -290,13 +325,13 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>
<span class="sd"> Data values associated with the list of geojson shapes</span>
<span class="sd"> grid_coords: dict</span>
<span class="sd"> Output from `rioxarray.rioxarray.affine_to_coords`</span>
<span class="sd"> fill: float, optional</span>
<span class="sd"> The value to fill in the grid with for nodata. Default is -9999.0.</span>
<span class="sd"> method: str, optional</span>
<span class="sd"> The function to use for interpolation in `scipy.interpolate.Rbf`.</span>
<span class="sd"> {&#39;multiquadric&#39;, &#39;inverse&#39;, &#39;gaussian&#39;, &#39;linear&#39;,</span>
<span class="sd"> &#39;cubic&#39;, &#39;quintic&#39;, &#39;thin_plate&#39;}</span>

<span class="sd"> filter_nan: bool, optional</span>
<span class="sd"> If True, will remove nodata values from the data before rasterization.</span>
<span class="sd"> Default is False.</span>
<span class="sd"> **ignored_kwargs:</span>
<span class="sd"> These are there to be flexible with additional rasterization methods and</span>
<span class="sd"> will be ignored.</span>
Expand All @@ -309,6 +344,10 @@ <h1>Source code for geocube.rasterize</h1><div class="highlight"><pre>
<span class="n">logger</span> <span class="o">=</span> <span class="n">get_logger</span><span class="p">()</span>

<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">filter_nan</span><span class="p">:</span>
<span class="n">data_values</span><span class="p">,</span> <span class="n">geometry_array</span> <span class="o">=</span> <span class="n">_remove_missing_data</span><span class="p">(</span>
<span class="n">data_values</span><span class="p">,</span> <span class="n">geometry_array</span>
<span class="p">)</span>
<span class="n">interp</span> <span class="o">=</span> <span class="n">Rbf</span><span class="p">(</span><span class="n">geometry_array</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">geometry_array</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">data_values</span><span class="p">,</span> <span class="n">function</span><span class="o">=</span><span class="n">method</span><span class="p">)</span>
<span class="k">return</span> <span class="n">interp</span><span class="p">(</span><span class="o">*</span><span class="n">numpy</span><span class="o">.</span><span class="n">meshgrid</span><span class="p">(</span><span class="n">grid_coords</span><span class="p">[</span><span class="s2">&quot;x&quot;</span><span class="p">],</span> <span class="n">grid_coords</span><span class="p">[</span><span class="s2">&quot;y&quot;</span><span class="p">]))</span>
<span class="k">except</span> <span class="ne">ValueError</span> <span class="k">as</span> <span class="n">ter</span><span class="p">:</span>
Expand Down
Loading

0 comments on commit c7897aa

Please sign in to comment.