Skip to content

Commit

Permalink
Deploying to gh-pages from @ 6a29c36 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 committed Nov 4, 2024
1 parent b36b455 commit 8d29402
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 23 deletions.
Binary file modified latest/.doctrees/environment.pickle
Binary file not shown.
4 changes: 4 additions & 0 deletions latest/_modules/rioxarray/_io.html
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,12 @@ <h1>Source code for rioxarray._io</h1><div class="highlight"><pre>
<span class="n">variables</span><span class="o">.</span><span class="n">pop_to</span><span class="p">(</span>
<span class="n">result</span><span class="o">.</span><span class="n">attrs</span><span class="p">,</span> <span class="n">result</span><span class="o">.</span><span class="n">encoding</span><span class="p">,</span> <span class="s2">&quot;scale_factor&quot;</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">da_name</span>
<span class="p">)</span>
<span class="k">if</span> <span class="s2">&quot;scales&quot;</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">attrs</span><span class="p">:</span>
<span class="n">variables</span><span class="o">.</span><span class="n">pop_to</span><span class="p">(</span><span class="n">result</span><span class="o">.</span><span class="n">attrs</span><span class="p">,</span> <span class="n">result</span><span class="o">.</span><span class="n">encoding</span><span class="p">,</span> <span class="s2">&quot;scales&quot;</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">da_name</span><span class="p">)</span>
<span class="k">if</span> <span class="s2">&quot;add_offset&quot;</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">attrs</span><span class="p">:</span>
<span class="n">variables</span><span class="o">.</span><span class="n">pop_to</span><span class="p">(</span><span class="n">result</span><span class="o">.</span><span class="n">attrs</span><span class="p">,</span> <span class="n">result</span><span class="o">.</span><span class="n">encoding</span><span class="p">,</span> <span class="s2">&quot;add_offset&quot;</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">da_name</span><span class="p">)</span>
<span class="k">if</span> <span class="s2">&quot;offsets&quot;</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">attrs</span><span class="p">:</span>
<span class="n">variables</span><span class="o">.</span><span class="n">pop_to</span><span class="p">(</span><span class="n">result</span><span class="o">.</span><span class="n">attrs</span><span class="p">,</span> <span class="n">result</span><span class="o">.</span><span class="n">encoding</span><span class="p">,</span> <span class="s2">&quot;offsets&quot;</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">da_name</span><span class="p">)</span>
<span class="k">if</span> <span class="n">masked</span><span class="p">:</span>
<span class="k">if</span> <span class="s2">&quot;_FillValue&quot;</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">attrs</span><span class="p">:</span>
<span class="n">variables</span><span class="o">.</span><span class="n">pop_to</span><span class="p">(</span><span class="n">result</span><span class="o">.</span><span class="n">attrs</span><span class="p">,</span> <span class="n">result</span><span class="o">.</span><span class="n">encoding</span><span class="p">,</span> <span class="s2">&quot;_FillValue&quot;</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">da_name</span><span class="p">)</span>
Expand Down
19 changes: 11 additions & 8 deletions latest/_modules/rioxarray/merge.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,16 @@ <h1>Source code for rioxarray.merge</h1><div class="highlight"><pre>
<span class="s2">&quot;crs&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">crs</span><span class="p">,</span>
<span class="s2">&quot;nodata&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodatavals</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
<span class="p">}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_scale_factor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_xds</span><span class="o">.</span><span class="n">encoding</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;scale_factor&quot;</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_add_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_xds</span><span class="o">.</span><span class="n">encoding</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;add_offset&quot;</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">)</span>
<span class="n">valid_scale_factor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_xds</span><span class="o">.</span><span class="n">encoding</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;scale_factor&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span> <span class="ow">or</span> <span class="nb">any</span><span class="p">(</span>
<span class="n">scale</span> <span class="o">!=</span> <span class="mi">1</span> <span class="k">for</span> <span class="n">scale</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_xds</span><span class="o">.</span><span class="n">encoding</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;scales&quot;</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,))</span>
<span class="p">)</span>
<span class="n">valid_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_xds</span><span class="o">.</span><span class="n">encoding</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;add_offset&quot;</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">0</span> <span class="ow">or</span> <span class="nb">any</span><span class="p">(</span>
<span class="n">offset</span> <span class="o">!=</span> <span class="mi">0</span> <span class="k">for</span> <span class="n">offset</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_xds</span><span class="o">.</span><span class="n">encoding</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;offsets&quot;</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,))</span>
<span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_mask_and_scale</span> <span class="o">=</span> <span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_xds</span><span class="o">.</span><span class="n">rio</span><span class="o">.</span><span class="n">encoded_nodata</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span>
<span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scale_factor</span> <span class="o">!=</span> <span class="mi">1</span>
<span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_add_offset</span> <span class="o">!=</span> <span class="mi">0</span>
<span class="ow">or</span> <span class="n">valid_scale_factor</span>
<span class="ow">or</span> <span class="n">valid_offset</span>
<span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_xds</span><span class="o">.</span><span class="n">encoding</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;_Unsigned&quot;</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span>
<span class="p">)</span>

Expand All @@ -149,10 +153,9 @@ <h1>Source code for rioxarray.merge</h1><div class="highlight"><pre>
<span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;masked&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span>
<span class="n">out</span> <span class="o">=</span> <span class="n">dataset</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_mask_and_scale</span><span class="p">:</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scale_factor</span> <span class="o">!=</span> <span class="mi">1</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="bp">self</span><span class="o">.</span><span class="n">_scale_factor</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_add_offset</span> <span class="o">!=</span> <span class="mi">0</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="bp">self</span><span class="o">.</span><span class="n">_add_offset</span>
<span class="n">out</span> <span class="o">=</span> <span class="n">out</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_xds</span><span class="o">.</span><span class="n">dtype</span><span class="p">)</span>
<span class="k">for</span> <span class="n">iii</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">count</span><span class="p">):</span>
<span class="n">out</span><span class="p">[</span><span class="n">iii</span><span class="p">]</span> <span class="o">=</span> <span class="n">out</span><span class="p">[</span><span class="n">iii</span><span class="p">]</span> <span class="o">*</span> <span class="n">dataset</span><span class="o">.</span><span class="n">scales</span><span class="p">[</span><span class="n">iii</span><span class="p">]</span> <span class="o">+</span> <span class="n">dataset</span><span class="o">.</span><span class="n">offsets</span><span class="p">[</span><span class="n">iii</span><span class="p">]</span>
<span class="k">return</span> <span class="n">out</span>


Expand Down
20 changes: 15 additions & 5 deletions latest/_modules/rioxarray/raster_array.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ <h1>Source code for rioxarray.raster_array</h1><div class="highlight"><pre>
<span class="sd">- https://github.com/opendatacube/datacube-core/blob/1d345f08a10a13c316f81100936b0ad8b1a374eb/LICENSE # noqa: E501</span>

<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">copy</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">from</span> <span class="nn">collections.abc</span> <span class="kn">import</span> <span class="n">Hashable</span><span class="p">,</span> <span class="n">Iterable</span><span class="p">,</span> <span class="n">Mapping</span>
Expand Down Expand Up @@ -207,7 +208,13 @@ <h1>Source code for rioxarray.raster_array</h1><div class="highlight"><pre>
<span class="o">**</span><span class="n">kwargs</span><span class="p">,</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Determine the affine of the new projected `xarray.DataArray`&quot;&quot;&quot;</span>
<span class="n">src_bounds</span> <span class="o">=</span> <span class="p">()</span> <span class="k">if</span> <span class="s2">&quot;gcps&quot;</span> <span class="ow">in</span> <span class="n">kwargs</span> <span class="k">else</span> <span class="n">src_data_array</span><span class="o">.</span><span class="n">rio</span><span class="o">.</span><span class="n">bounds</span><span class="p">()</span>
<span class="n">src_bounds</span> <span class="o">=</span> <span class="p">()</span>
<span class="k">if</span> <span class="p">(</span>
<span class="s2">&quot;gcps&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span>
<span class="ow">and</span> <span class="s2">&quot;rpcs&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span>
<span class="ow">and</span> <span class="s2">&quot;src_geoloc_array&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span>
<span class="p">):</span>
<span class="n">src_bounds</span> <span class="o">=</span> <span class="n">src_data_array</span><span class="o">.</span><span class="n">rio</span><span class="o">.</span><span class="n">bounds</span><span class="p">()</span>
<span class="n">src_height</span><span class="p">,</span> <span class="n">src_width</span> <span class="o">=</span> <span class="n">src_data_array</span><span class="o">.</span><span class="n">rio</span><span class="o">.</span><span class="n">shape</span>
<span class="n">dst_height</span><span class="p">,</span> <span class="n">dst_width</span> <span class="o">=</span> <span class="n">dst_shape</span> <span class="k">if</span> <span class="n">dst_shape</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="c1"># pylint: disable=isinstance-second-argument-not-valid-type</span>
Expand Down Expand Up @@ -542,8 +549,12 @@ <h1>Source code for rioxarray.raster_array</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="n">gcps</span><span class="p">:</span>
<span class="n">kwargs</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s2">&quot;gcps&quot;</span><span class="p">,</span> <span class="n">gcps</span><span class="p">)</span>

<span class="n">gcps_or_rpcs</span> <span class="o">=</span> <span class="s2">&quot;gcps&quot;</span> <span class="ow">in</span> <span class="n">kwargs</span> <span class="ow">or</span> <span class="s2">&quot;rpcs&quot;</span> <span class="ow">in</span> <span class="n">kwargs</span>
<span class="n">src_affine</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">gcps_or_rpcs</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">recalc</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">use_affine</span> <span class="o">=</span> <span class="p">(</span>
<span class="s2">&quot;gcps&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span>
<span class="ow">and</span> <span class="s2">&quot;rpcs&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span>
<span class="ow">and</span> <span class="s2">&quot;src_geoloc_array&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span>
<span class="p">)</span>
<span class="n">src_affine</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">use_affine</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">recalc</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="k">if</span> <span class="n">transform</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">dst_affine</span><span class="p">,</span> <span class="n">dst_width</span><span class="p">,</span> <span class="n">dst_height</span> <span class="o">=</span> <span class="n">_make_dst_affine</span><span class="p">(</span>
<span class="n">src_data_array</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="p">,</span>
Expand All @@ -563,7 +574,6 @@ <h1>Source code for rioxarray.raster_array</h1><div class="highlight"><pre>
<span class="n">dst_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_create_dst_data</span><span class="p">(</span><span class="n">dst_height</span><span class="o">=</span><span class="n">dst_height</span><span class="p">,</span> <span class="n">dst_width</span><span class="o">=</span><span class="n">dst_width</span><span class="p">)</span>

<span class="n">dst_nodata</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_dst_nodata</span><span class="p">(</span><span class="n">nodata</span><span class="p">)</span>

<span class="n">rasterio</span><span class="o">.</span><span class="n">warp</span><span class="o">.</span><span class="n">reproject</span><span class="p">(</span>
<span class="n">source</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">values</span><span class="p">,</span>
<span class="n">destination</span><span class="o">=</span><span class="n">dst_data</span><span class="p">,</span>
Expand Down Expand Up @@ -595,7 +605,7 @@ <h1>Source code for rioxarray.raster_array</h1><div class="highlight"><pre>
<span class="n">dst_affine</span><span class="o">=</span><span class="n">dst_affine</span><span class="p">,</span>
<span class="n">dst_width</span><span class="o">=</span><span class="n">dst_width</span><span class="p">,</span>
<span class="n">dst_height</span><span class="o">=</span><span class="n">dst_height</span><span class="p">,</span>
<span class="n">force_generate</span><span class="o">=</span><span class="n">gcps_or_rpcs</span><span class="p">,</span>
<span class="n">force_generate</span><span class="o">=</span><span class="ow">not</span> <span class="n">use_affine</span><span class="p">,</span>
<span class="p">),</span>
<span class="n">dims</span><span class="o">=</span><span class="nb">tuple</span><span class="p">(</span><span class="n">dst_dims</span><span class="p">),</span>
<span class="n">attrs</span><span class="o">=</span><span class="n">new_attrs</span><span class="p">,</span>
Expand Down
Loading

0 comments on commit 8d29402

Please sign in to comment.