Skip to content

Commit

Permalink
updated zonal stats example to use masked=True
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 committed Oct 28, 2019
1 parent f87123f commit 744d49e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
35 changes: 18 additions & 17 deletions docs/html/_sources/examples/zonal_statistics.ipynb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"outputs": [],
"source": [
"elevation = rioxarray.open_rasterio(\n",
" \"zip://USGS_NED_13_n42w091_IMG.zip/USGS_NED_13_n42w091_IMG.img\"\n",
" \"zip://USGS_NED_13_n42w091_IMG.zip/USGS_NED_13_n42w091_IMG.img\",\n",
" masked=True,\n",
").squeeze().drop(\"band\")\n",
"elevation.name = \"elevation\""
]
Expand Down Expand Up @@ -102,7 +103,7 @@
" spatial_ref int64 0\n",
"Data variables:\n",
" mukey (y, x) float64 nan nan nan nan nan nan ... nan nan nan nan nan\n",
" elevation (y, x) float32 ...\n",
" elevation (y, x) float64 ...\n",
"Attributes:\n",
" grid_mapping: spatial_ref"
]
Expand Down Expand Up @@ -180,52 +181,52 @@
" <tbody>\n",
" <tr>\n",
" <td>198692.0</td>\n",
" <td>173.130920</td>\n",
" <td>173.130925</td>\n",
" <td>169.394562</td>\n",
" <td>188.442505</td>\n",
" <td>3.307044</td>\n",
" </tr>\n",
" <tr>\n",
" <td>198714.0</td>\n",
" <td>175.061554</td>\n",
" <td>175.061542</td>\n",
" <td>170.214157</td>\n",
" <td>179.716675</td>\n",
" <td>2.148920</td>\n",
" </tr>\n",
" <tr>\n",
" <td>198724.0</td>\n",
" <td>179.933060</td>\n",
" <td>179.933075</td>\n",
" <td>178.237244</td>\n",
" <td>181.490387</td>\n",
" <td>0.628017</td>\n",
" </tr>\n",
" <tr>\n",
" <td>198750.0</td>\n",
" <td>176.188461</td>\n",
" <td>176.188453</td>\n",
" <td>167.951233</td>\n",
" <td>190.138763</td>\n",
" <td>3.814724</td>\n",
" </tr>\n",
" <tr>\n",
" <td>198754.0</td>\n",
" <td>171.632187</td>\n",
" <td>171.632181</td>\n",
" <td>167.610321</td>\n",
" <td>181.611298</td>\n",
" <td>2.996241</td>\n",
" </tr>\n",
" <tr>\n",
" <td>271425.0</td>\n",
" <td>167.973709</td>\n",
" <td>167.973730</td>\n",
" <td>167.951233</td>\n",
" <td>168.476776</td>\n",
" <td>0.076759</td>\n",
" </tr>\n",
" <tr>\n",
" <td>271431.0</td>\n",
" <td>176.718338</td>\n",
" <td>176.718330</td>\n",
" <td>170.258133</td>\n",
" <td>180.460220</td>\n",
" <td>2.732229</td>\n",
" <td>2.732228</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
Expand All @@ -234,13 +235,13 @@
"text/plain": [
" elevation_mean elevation_min elevation_max elevation_std\n",
"mukey \n",
"198692.0 173.130920 169.394562 188.442505 3.307044\n",
"198714.0 175.061554 170.214157 179.716675 2.148920\n",
"198724.0 179.933060 178.237244 181.490387 0.628017\n",
"198750.0 176.188461 167.951233 190.138763 3.814724\n",
"198754.0 171.632187 167.610321 181.611298 2.996241\n",
"271425.0 167.973709 167.951233 168.476776 0.076759\n",
"271431.0 176.718338 170.258133 180.460220 2.732229"
"198692.0 173.130925 169.394562 188.442505 3.307044\n",
"198714.0 175.061542 170.214157 179.716675 2.148920\n",
"198724.0 179.933075 178.237244 181.490387 0.628017\n",
"198750.0 176.188453 167.951233 190.138763 3.814724\n",
"198754.0 171.632181 167.610321 181.611298 2.996241\n",
"271425.0 167.973730 167.951233 168.476776 0.076759\n",
"271431.0 176.718330 170.258133 180.460220 2.732228"
]
},
"execution_count": 8,
Expand Down
21 changes: 11 additions & 10 deletions docs/html/examples/zonal_statistics.html
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ <h2>Load in the source raster data<a class="headerlink" href="#Load-in-the-sourc
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">elevation</span> <span class="o">=</span> <span class="n">rioxarray</span><span class="o">.</span><span class="n">open_rasterio</span><span class="p">(</span>
<span class="s2">&quot;zip://USGS_NED_13_n42w091_IMG.zip/USGS_NED_13_n42w091_IMG.img&quot;</span>
<span class="s2">&quot;zip://USGS_NED_13_n42w091_IMG.zip/USGS_NED_13_n42w091_IMG.img&quot;</span><span class="p">,</span>
<span class="n">masked</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="p">)</span><span class="o">.</span><span class="n">squeeze</span><span class="p">()</span><span class="o">.</span><span class="n">drop</span><span class="p">(</span><span class="s2">&quot;band&quot;</span><span class="p">)</span>
<span class="n">elevation</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;elevation&quot;</span>
</pre></div>
Expand Down Expand Up @@ -492,7 +493,7 @@ <h2>Create the data mask by rasterizing the unique ID of the vector data<a class
spatial_ref int64 0
Data variables:
mukey (y, x) float64 nan nan nan nan nan nan ... nan nan nan nan nan
elevation (y, x) float32 ...
elevation (y, x) float64 ...
Attributes:
grid_mapping: spatial_ref
</pre></div>
Expand Down Expand Up @@ -562,52 +563,52 @@ <h3>Get the elevation statistics of each region using the mask<a class="headerli
<tbody>
<tr>
<td>198692.0</td>
<td>173.130920</td>
<td>173.130925</td>
<td>169.394562</td>
<td>188.442505</td>
<td>3.307044</td>
</tr>
<tr>
<td>198714.0</td>
<td>175.061554</td>
<td>175.061542</td>
<td>170.214157</td>
<td>179.716675</td>
<td>2.148920</td>
</tr>
<tr>
<td>198724.0</td>
<td>179.933060</td>
<td>179.933075</td>
<td>178.237244</td>
<td>181.490387</td>
<td>0.628017</td>
</tr>
<tr>
<td>198750.0</td>
<td>176.188461</td>
<td>176.188453</td>
<td>167.951233</td>
<td>190.138763</td>
<td>3.814724</td>
</tr>
<tr>
<td>198754.0</td>
<td>171.632187</td>
<td>171.632181</td>
<td>167.610321</td>
<td>181.611298</td>
<td>2.996241</td>
</tr>
<tr>
<td>271425.0</td>
<td>167.973709</td>
<td>167.973730</td>
<td>167.951233</td>
<td>168.476776</td>
<td>0.076759</td>
</tr>
<tr>
<td>271431.0</td>
<td>176.718338</td>
<td>176.718330</td>
<td>170.258133</td>
<td>180.460220</td>
<td>2.732229</td>
<td>2.732228</td>
</tr>
</tbody>
</table>
Expand Down
Binary file modified docs/html/objects.inv
Binary file not shown.
Loading

0 comments on commit 744d49e

Please sign in to comment.