Skip to content

Commit 4ee8e25

Browse files
Update documentation
1 parent fa3dd82 commit 4ee8e25

3 files changed

Lines changed: 17 additions & 47 deletions

File tree

_sources/notebooks/xarray_mosaic_and_clip.ipynb

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
"\n",
3636
"**Data Credit**:\n",
3737
"- NASA Shuttle Radar Topography Mission Global 1 arc second provided by The Land Processes Distributed Active Archive Center (LP DAAC). Downloaded using the [30-Meter SRTM Tile Downloader](https://dwtkns.com/srtm30m/).\n",
38-
"- Made with Natural Earth. Free vector and raster map data @ naturalearthdata.com."
38+
"- Made with Natural Earth. Free vector and raster map data @ naturalearthdata.com.\n",
39+
"\n",
40+
"\n",
41+
"**Watch Video Walkthrough** <a href='https://www.youtube.com/watch?v=Ff9ctKNlku0' target='_blank'><img src='https://github.com/spatialthoughts/geopython-tutorials/blob/main/images/yt_logo.png?raw=1'></a>"
3942
]
4043
},
4144
{
@@ -53,7 +56,7 @@
5356
},
5457
{
5558
"cell_type": "code",
56-
"execution_count": 3,
59+
"execution_count": null,
5760
"id": "27ab242e-e140-4afe-a6e8-c9f044bec425",
5861
"metadata": {
5962
"id": "27ab242e-e140-4afe-a6e8-c9f044bec425"
@@ -67,7 +70,7 @@
6770
},
6871
{
6972
"cell_type": "code",
70-
"execution_count": 17,
73+
"execution_count": null,
7174
"id": "3decd0de-ae44-4d80-80b6-51223cc36ffe",
7275
"metadata": {
7376
"id": "3decd0de-ae44-4d80-80b6-51223cc36ffe"
@@ -85,7 +88,7 @@
8588
},
8689
{
8790
"cell_type": "code",
88-
"execution_count": 4,
91+
"execution_count": null,
8992
"id": "e1c0ed63-39db-4689-9a65-f6eb7de98f19",
9093
"metadata": {
9194
"id": "e1c0ed63-39db-4689-9a65-f6eb7de98f19"
@@ -103,7 +106,7 @@
103106
},
104107
{
105108
"cell_type": "code",
106-
"execution_count": 5,
109+
"execution_count": null,
107110
"id": "782466e6-1f57-437f-a564-dda8caeb87db",
108111
"metadata": {
109112
"id": "782466e6-1f57-437f-a564-dda8caeb87db"
@@ -165,7 +168,7 @@
165168
},
166169
{
167170
"cell_type": "code",
168-
"execution_count": 6,
171+
"execution_count": null,
169172
"id": "HbDnBfLpGH4Q",
170173
"metadata": {
171174
"id": "HbDnBfLpGH4Q"
@@ -212,7 +215,7 @@
212215
},
213216
{
214217
"cell_type": "code",
215-
"execution_count": 8,
218+
"execution_count": null,
216219
"id": "e6428cb4-0d19-4ffd-bea4-e3109dae33d3",
217220
"metadata": {
218221
"id": "e6428cb4-0d19-4ffd-bea4-e3109dae33d3"
@@ -251,7 +254,7 @@
251254
"id": "kXbQ-J5o7PmN"
252255
},
253256
"id": "kXbQ-J5o7PmN",
254-
"execution_count": 10,
257+
"execution_count": null,
255258
"outputs": []
256259
},
257260
{
@@ -292,7 +295,7 @@
292295
"outputId": "dbf93e5a-ae27-4e40-a5d9-a2e050da1ff9"
293296
},
294297
"id": "3EfywFl39UFt",
295-
"execution_count": 11,
298+
"execution_count": null,
296299
"outputs": [
297300
{
298301
"output_type": "display_data",
@@ -341,38 +344,14 @@
341344
},
342345
{
343346
"cell_type": "code",
344-
"execution_count": 19,
347+
"execution_count": null,
345348
"id": "ioN2PJdyG4ow",
346349
"metadata": {
347350
"id": "ioN2PJdyG4ow"
348351
},
349352
"outputs": [],
350353
"source": [
351-
"clipped = merged.rio.clip(filtered_gdf.geometry)\n"
352-
]
353-
},
354-
{
355-
"cell_type": "markdown",
356-
"id": "R9Mk5hdbd9eX",
357-
"metadata": {
358-
"id": "R9Mk5hdbd9eX"
359-
},
360-
"source": [
361-
"Our clipped data has -32768 as nodata. We mask these and [encode the correct nodata](https://corteva.github.io/rioxarray/stable/getting_started/nodata_management.html#Manually-masking-data) value."
362-
]
363-
},
364-
{
365-
"cell_type": "code",
366-
"execution_count": null,
367-
"id": "rrYhsQEUutls",
368-
"metadata": {
369-
"id": "rrYhsQEUutls"
370-
},
371-
"outputs": [],
372-
"source": [
373-
"clipped = clipped.where(clipped != clipped.rio.nodata)\n",
374-
"clipped.rio.write_nodata(clipped.rio.nodata, encoded=True, inplace=True)\n",
375-
"clipped"
354+
"clipped = merged.rio.clip(filtered_gdf.geometry)"
376355
]
377356
},
378357
{
@@ -387,7 +366,7 @@
387366
},
388367
{
389368
"cell_type": "code",
390-
"execution_count": 21,
369+
"execution_count": null,
391370
"id": "UQk5MB6JMsuH",
392371
"metadata": {
393372
"id": "UQk5MB6JMsuH"

notebooks/xarray_mosaic_and_clip.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ <h2>Overview of the Task<a class="headerlink" href="#overview-of-the-task" title
478478
<li><p>NASA Shuttle Radar Topography Mission Global 1 arc second provided by The Land Processes Distributed Active Archive Center (LP DAAC). Downloaded using the <a class="reference external" href="https://dwtkns.com/srtm30m/">30-Meter SRTM Tile Downloader</a>.</p></li>
479479
<li><p>Made with Natural Earth. Free vector and raster map data &#64; naturalearthdata.com.</p></li>
480480
</ul>
481+
<p><strong>Watch Video Walkthrough</strong> <a href='https://www.youtube.com/watch?v=Ff9ctKNlku0' target='_blank'><img alt="https://github.com/spatialthoughts/geopython-tutorials/blob/main/images/yt_logo.png?raw=1" src="https://github.com/spatialthoughts/geopython-tutorials/blob/main/images/yt_logo.png?raw=1" /></a></p>
481482
</section>
482483
<section id="setup-and-data-download">
483484
<h2>Setup and Data Download<a class="headerlink" href="#setup-and-data-download" title="Link to this heading">#</a></h2>
@@ -644,16 +645,6 @@ <h2>Procedure<a class="headerlink" href="#procedure" title="Link to this heading
644645
</div>
645646
</div>
646647
</div>
647-
<p>Our clipped data has -32768 as nodata. We mask these and <a class="reference external" href="https://corteva.github.io/rioxarray/stable/getting_started/nodata_management.html#Manually-masking-data">encode the correct nodata</a> value.</p>
648-
<div class="cell docutils container">
649-
<div class="cell_input docutils container">
650-
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">clipped</span> <span class="o">=</span> <span class="n">clipped</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">clipped</span> <span class="o">!=</span> <span class="n">clipped</span><span class="o">.</span><span class="n">rio</span><span class="o">.</span><span class="n">nodata</span><span class="p">)</span>
651-
<span class="n">clipped</span><span class="o">.</span><span class="n">rio</span><span class="o">.</span><span class="n">write_nodata</span><span class="p">(</span><span class="n">clipped</span><span class="o">.</span><span class="n">rio</span><span class="o">.</span><span class="n">nodata</span><span class="p">,</span> <span class="n">encoded</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">inplace</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
652-
<span class="n">clipped</span>
653-
</pre></div>
654-
</div>
655-
</div>
656-
</div>
657648
<p>Last step is to save the results to disk as GeoTiff files. We use <a class="reference external" href="https://gdal.org/drivers/raster/cog.html">Cloud-Optimized GeoTIFF (COG)</a> driver and specify additional GDAL <a class="reference external" href="https://rasterio.readthedocs.io/en/stable/topics/image_options.html#creation-options">compression options</a>.</p>
658649
<div class="cell docutils container">
659650
<div class="cell_input docutils container">

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)