Skip to content

Commit bc0e25d

Browse files
authored
Rename, edit and link notebooks (#2)
* Rename files * Check and update internal and external links * Consistent capitalization for Xarray-Spatial * Begin editing for style and consistency * Finish editing for style and consistency * Update next steps section for classification nb
1 parent 0c3aba5 commit bc0e25d

9 files changed

+767
-816
lines changed

tutorials/reprojection.ipynb renamed to tutorials/01_Reprojecting_and_Resampling.ipynb

Lines changed: 334 additions & 369 deletions
Large diffs are not rendered by default.

tutorials/coregistration.ipynb renamed to tutorials/02_Coregistration.ipynb

Lines changed: 183 additions & 198 deletions
Large diffs are not rendered by default.

tutorials/cloudless-mosaic-sentinel2.ipynb renamed to tutorials/03_Mosaicking.ipynb

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
"source": [
77
"## Cloudless Mosaic\n",
88
"\n",
9-
"This tutorial constructs a *cloudless mosaic* (also known as a composite) from a time series of satellite images. We'll see the following:\n",
9+
"In this tutorial, you'll learn how to constructs a *cloudless mosaic* (also known as a composite) from a time series of satellite images. The tutorial covers the following steps:\n",
1010
"\n",
11-
"* Find a time series of images at a particular point on Earth\n",
12-
"* Stack those images together into a single array\n",
13-
"* Compute the cloudless mosaic by taking a median\n",
14-
"* Visualize the results\n",
11+
"* [Find a time series of images at a particular point on Earth](#Discover-data)\n",
12+
"* [Stack those images together into a single array](#Stack-images)\n",
13+
"* [Compute the cloudless mosaic by taking a median](#Median-composite)\n",
14+
"* [Create mosaics after grouping the data](#Monthly-composite)\n",
1515
"\n",
16-
"This example uses [Sentinel-2 Level-2A](https://planetarycomputer.microsoft.com/dataset/sentinel-2-l2a) data. The techniques used here apply equally well to other remote-sensing datasets."
16+
"This example uses [Sentinel-2 Level-2A](https://planetarycomputer.microsoft.com/dataset/sentinel-2-l2a) data. The techniques used here work equally well with other remote-sensing datasets.\n",
17+
"\n",
18+
"---"
1719
]
1820
},
1921
{
@@ -41,7 +43,7 @@
4143
"source": [
4244
"### Create a Dask cluster\n",
4345
"\n",
44-
"We're going to process a large amount of data. To cut down on the execution time, we'll use a Dask cluster to do the computation in parallel, adaptively scaling to add and remove workers as needed. See [Scale With Dask](../quickstarts/scale-with-dask.ipynb) for more on using Dask."
46+
"This example requires processing a large amms match our seaunt of data. To cut down on the execution time, use a Dask cluster to do the computation in parallel, adaptively scaling to add and remove workers as needed. See [Scale With Dask](../quickstarts/scale-with-dask.ipynb) for more on using Dask."
4547
]
4648
},
4749
{
@@ -58,7 +60,7 @@
5860
}
5961
],
6062
"source": [
61-
"cluster = GatewayCluster() # Creates the Dask Scheduler. Might take a minute.\n",
63+
"cluster = GatewayCluster() # creates the Dask Scheduler - might take a minute.\n",
6264
"\n",
6365
"client = cluster.get_client()\n",
6466
"\n",
@@ -72,7 +74,7 @@
7274
"source": [
7375
"### Discover data\n",
7476
"\n",
75-
"In this example, we define our area of interest as a GeoJSON object. It's near Redmond, Washington."
77+
"In this example, the area of interest is located near Redmond, Washington. It is defined as a GeoJSON object."
7678
]
7779
},
7880
{
@@ -100,7 +102,7 @@
100102
"cell_type": "markdown",
101103
"metadata": {},
102104
"source": [
103-
"Using `pystac_client` we can search the Planetary Computer's STAC endpoint for items matching our query parameters."
105+
"Use `pystac_client` to search the Planetary Computer's STAC endpoint for items matching your query parameters:"
104106
]
105107
},
106108
{
@@ -135,7 +137,11 @@
135137
"cell_type": "markdown",
136138
"metadata": {},
137139
"source": [
138-
"So 138 items match our search requirements, over space, time, and cloudiness. Those items will still have *some* clouds over portions of the scenes, though. To create our cloudless mosaic, we'll load the data into an [xarray](https://xarray.pydata.org/en/stable/) DataArray using [stackstac](https://stackstac.readthedocs.io/) and then reduce the time-series of images down to a single image."
140+
"As you can see, there are 138 items that match your search requirements in terms of location, time, and cloudiness. Those items will still have *some* clouds over portions of the scenes, though. \n",
141+
"\n",
142+
"### Stack images\n",
143+
"\n",
144+
"To create a cloudless mosaic, first, load the data into an [xarray](https://xarray.pydata.org/en/stable/) DataArray using [stackstac](https://stackstac.readthedocs.io/):"
139145
]
140146
},
141147
{
@@ -160,6 +166,13 @@
160166
" signed_items.append(planetary_computer.sign(item).to_dict())"
161167
]
162168
},
169+
{
170+
"cell_type": "markdown",
171+
"metadata": {},
172+
"source": [
173+
"Next, reduce the time series of images down to a single image:"
174+
]
175+
},
163176
{
164177
"cell_type": "code",
165178
"execution_count": 6,
@@ -1471,7 +1484,7 @@
14711484
"cell_type": "markdown",
14721485
"metadata": {},
14731486
"source": [
1474-
"Since the data matching our query isn't too large we can persist it in distributed memory. Once in memory, subsequent operations will be much faster."
1487+
"Since the data matching your query isn't too large, you can persist it in distributed memory. Once it is stored in memory, subsequent operations will be much faster."
14751488
]
14761489
},
14771490
{
@@ -1489,7 +1502,7 @@
14891502
"source": [
14901503
"### Median composite\n",
14911504
"\n",
1492-
"Using normal xarray operations, we can [compute the median](http://xarray.pydata.org/en/stable/generated/xarray.DataArray.median.html) over the time dimension. Under the assumption that clouds are transient, the composite shouldn't contain (many) clouds, since they shouldn't be the median pixel value at that point over many images.\n",
1505+
"Using regular xarray operations, you can [compute the median](http://xarray.pydata.org/en/stable/generated/xarray.DataArray.median.html) over the time dimension. Under the assumption that clouds are transient, the composite shouldn't contain (many) clouds, since clouds shouldn't be the median pixel value at that point over many images.\n",
14931506
"\n",
14941507
"This will be computed in parallel on the cluster (make sure to open the Dask Dashboard using the link printed out above)."
14951508
]
@@ -1507,7 +1520,7 @@
15071520
"cell_type": "markdown",
15081521
"metadata": {},
15091522
"source": [
1510-
"To visualize the data, we'll use xarray-spatial's `true_color` method to convert to red/green/blue values."
1523+
"Use Xarray-Spatial's `true_color` method to visualize your data by converting it to red/green/blue values."
15111524
]
15121525
},
15131526
{
@@ -1552,7 +1565,7 @@
15521565
"source": [
15531566
"### Monthly composite\n",
15541567
"\n",
1555-
"Now suppose we don't want to combine images from different parts of the year (for example, we might not want to combine images from January that often include snow with images from July). Again using standard xarray syntax, we can create set of per-month composites by grouping by month and then taking the median."
1568+
"Now suppose you don't want to combine images from different parts of the year (for example, you might not want to combine images from January that often include snow with images from July). Again using standard xarray syntax, you can create sets of per-month composites by grouping by month and then computing the median:"
15561569
]
15571570
},
15581571
{
@@ -1568,7 +1581,7 @@
15681581
"cell_type": "markdown",
15691582
"metadata": {},
15701583
"source": [
1571-
"Let's convert each of those arrays to a true-color image and plot the results as a grid."
1584+
"Convert each of those arrays to a true-color image and plot the results as a grid:"
15721585
]
15731586
},
15741587
{
@@ -1604,15 +1617,17 @@
16041617
"cell_type": "markdown",
16051618
"metadata": {},
16061619
"source": [
1607-
"### Learn more\n",
1620+
"### Next steps\n",
1621+
"\n",
1622+
"To learn more about using the Planetary Computer's STAC API, see [Reading data from the STAC API](../quickstarts/reading-stac.ipynb). To learn more about Dask, see [Scaling with Dask](../quickstarts/scale-with-dask.ipynb).\n",
16081623
"\n",
1609-
"To learn more about using the the Planetary Computer's STAC API, see [Reading data from the STAC API](../quickstarts/reading-stac.ipynb). To learn more about Dask, see [Scaling with Dask](../quickstarts/scale-with-dask.ipynb)."
1624+
"Click on this link to go to the next notebook: [04 Geospatial Classification](04_Geospatial_Classification.ipynb)"
16101625
]
16111626
}
16121627
],
16131628
"metadata": {
16141629
"kernelspec": {
1615-
"display_name": "Python 3",
1630+
"display_name": "Python 3 (ipykernel)",
16161631
"language": "python",
16171632
"name": "python3"
16181633
},
@@ -1626,7 +1641,7 @@
16261641
"name": "python",
16271642
"nbconvert_exporter": "python",
16281643
"pygments_lexer": "ipython3",
1629-
"version": "3.8.8"
1644+
"version": "3.9.1"
16301645
},
16311646
"widgets": {
16321647
"application/vnd.jupyter.widget-state+json": {

tutorials/xarray-spatial_classification-methods.ipynb renamed to tutorials/04_Geospatial_Classification.ipynb

Lines changed: 45 additions & 52 deletions
Large diffs are not rendered by default.

tutorials/local-tools.ipynb renamed to tutorials/05_Local_Tools.ipynb

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,23 @@
55
"id": "e9045413",
66
"metadata": {},
77
"source": [
8-
"## Exploring Xarray-spatial Local Tools Functions"
8+
"## Exploring local tools in Xarray-Spatial"
99
]
1010
},
1111
{
1212
"cell_type": "markdown",
1313
"id": "32b5e1bf",
1414
"metadata": {},
1515
"source": [
16-
"Local tools operate at the cell level, where values with the same position from a set of input rasters are used to calculate the values of the cells at the output raster.\n",
17-
"Some examples of the application of local tools are:\n",
16+
"In this tutorial, you'll learn how to use various local tools in [Xarray-Spatial](http://xarray-spatial.org/). Local tools operate at the cell level, where values with the same position from a set of input rasters are used to calculate the values of the cells at the output raster. Some examples of the application of local tools are:\n",
17+
"\n",
1818
"- Change over time: You can use local tools to identify places where a value like land use or temperature changed over time.\n",
19-
"- Aggregate over time: You can use local tools to aggregate values over time, for example calculating the average rainfall or hours of sunshine for each cell.\n",
20-
"- Threshold over time: You can use local tools to identify places where a value is above or below a specified threshold, for example where the temperature was below a 0 °C.\n",
21-
"- Data aggregation: You can use local tools to calculate the [cost surface](http://wiki.gis.com/wiki/index.php/Cost_surface) of an area, summing up different types of cost over the same cell in different layers."
22-
]
23-
},
24-
{
25-
"cell_type": "markdown",
26-
"id": "ea55ffed",
27-
"metadata": {},
28-
"source": [
29-
"In this notebook, we'll demonstrate how to use the [Xarray-spatial](http://xarray-spatial.org/) local tools functions supported by [Numpy](https://numpy.org/). The spatial functions available are:\n",
19+
"- Aggregate over time: You can use local tools to aggregate values over time, for example to calculate the average rainfall or hours of sunshine for each cell.\n",
20+
"- Threshold over time: You can use local tools to identify places where a value is above or below a specified threshold, for example where the temperature was below 0 °C.\n",
21+
"- Data aggregation: You can use local tools to calculate the [cost surface](http://wiki.gis.com/wiki/index.php/Cost_surface) of an area, summing up different types of cost over the same cell in different layers.\n",
22+
"\n",
23+
"This notebook demonstrates the Xarray-Spatial local tools functions supported by [Numpy](https://numpy.org/). The available spatial functions are:\n",
24+
"\n",
3025
"- [Cell Statistics](#Cell-Statistics)\n",
3126
"- [Combine](#Combine)\n",
3227
"- [Lesser Frequency](#Lesser-Frequency)\n",
@@ -35,23 +30,13 @@
3530
"- [Lowest Position](#Lowest-Position)\n",
3631
"- [Highest Position](#Highest-Position)\n",
3732
"- [Popularity](#Popularity)\n",
38-
"- [Rank](#Rank)"
39-
]
40-
},
41-
{
42-
"cell_type": "markdown",
43-
"id": "b9c4ed8c",
44-
"metadata": {},
45-
"source": [
46-
"### Creating the sample data"
47-
]
48-
},
49-
{
50-
"cell_type": "markdown",
51-
"id": "af3c5207",
52-
"metadata": {},
53-
"source": [
54-
"In order to present the functions in a very simple and easy to understand way, we'll use 4x4 data arrays and create an `xarray.Dataset`."
33+
"- [Rank](#Rank)\n",
34+
"\n",
35+
"---\n",
36+
"\n",
37+
"### Creating the sample data\n",
38+
"\n",
39+
"To have some data to test the functions on, create four 4 x 4 [xarray DataArrays](http://xarray.pydata.org/en/stable/generated/xarray.DataArray.html) and merge them into a [xarray Dataset](http://xarray.pydata.org/en/stable/generated/xarray.Dataset.html):"
5540
]
5641
},
5742
{
@@ -94,7 +79,7 @@
9479
"id": "17d54999",
9580
"metadata": {},
9681
"source": [
97-
"This function will be used to plot the arrays for all the examples in this notebook."
82+
"The following function will be used to plot the arrays for all the examples in this notebook:"
9883
]
9984
},
10085
{
@@ -143,7 +128,7 @@
143128
"id": "01ab159c",
144129
"metadata": {},
145130
"source": [
146-
"[`xrspatial.local.cell_stats`](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.cell_stats.html) calculates statistics from a raster dataset on a cell-by-cell basis."
131+
"[xrspatial.local.cell_stats](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.cell_stats.html) calculates statistics from a raster dataset on a cell-by-cell basis."
147132
]
148133
},
149134
{
@@ -207,7 +192,7 @@
207192
"id": "87c34a83",
208193
"metadata": {},
209194
"source": [
210-
"[`xrspatial.local.combine`](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.combine.html) combines multiple arrays from a raster dataset, assigning a unique output value to each unique combination of raster values."
195+
"[xrspatial.local.combine](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.combine.html) combines multiple arrays from a raster dataset, assigning a unique output value to each unique combination of raster values."
211196
]
212197
},
213198
{
@@ -255,7 +240,7 @@
255240
"id": "4f6da50e",
256241
"metadata": {},
257242
"source": [
258-
"[`xrspatial.local.lesser_frequency`](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.lesser_frequency.html) calculates, given a raster dataset, the number of times the data variables values are lower than the values of a given reference data variable on a cell-by-cell basis."
243+
"[xrspatial.local.lesser_frequency](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.lesser_frequency.html) calculates, given a raster dataset, the number of times the data variables values are lower than the values of a given reference data variable on a cell-by-cell basis."
259244
]
260245
},
261246
{
@@ -305,7 +290,7 @@
305290
"id": "intelligent-philadelphia",
306291
"metadata": {},
307292
"source": [
308-
"[`xrspatial.local.equal_frequency`](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.equal_frequency.html) calculates, given a raster dataset, the number of times the data variables values are equal than the values of a given reference data variable on a cell-by-cell basis."
293+
"[xrspatial.local.equal_frequency](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.equal_frequency.html) calculates, given a raster dataset, the number of times the data variables values are equal to the values of a given reference data variable on a cell-by-cell basis."
309294
]
310295
},
311296
{
@@ -355,7 +340,7 @@
355340
"id": "vocational-inside",
356341
"metadata": {},
357342
"source": [
358-
"[`xrspatial.local.greater_frequency`](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.greater_frequency.html) calculates, given a raster dataset, the number of times the data variables values are greater than the values of a given reference data variable on a cell-by-cell basis."
343+
"[xrspatial.local.greater_frequency](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.greater_frequency.html) calculates, given a raster dataset, the number of times the data variables values are greater than the values of a given reference data variable on a cell-by-cell basis."
359344
]
360345
},
361346
{
@@ -405,7 +390,7 @@
405390
"id": "8d7235ec",
406391
"metadata": {},
407392
"source": [
408-
"[`xrspatial.local.lowest_position`](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.lowest_position.html) calculates the data variable index of the lowest value on a cell-by-cell basis."
393+
"[xrspatial.local.lowest_position](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.lowest_position.html) calculates the data variable index of the lowest value on a cell-by-cell basis."
409394
]
410395
},
411396
{
@@ -454,7 +439,7 @@
454439
"id": "a17c6e93",
455440
"metadata": {},
456441
"source": [
457-
"[`xrspatial.local.highest_position`](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.highest_position.html) calculates the data variable index of the highest value on a cell-by-cell basis."
442+
"[xrspatial.local.highest_position](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.highest_position.html) calculates the data variable index of the highest value on a cell-by-cell basis."
458443
]
459444
},
460445
{
@@ -503,7 +488,7 @@
503488
"id": "e5408cea",
504489
"metadata": {},
505490
"source": [
506-
"[`xrspatial.local.popularity`](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.popularity.html) calculates the number of occurrences of each value of a raster dataset, on a cell-by-cell basis. The output value is assigned based on the reference data variable nth most popular."
491+
"[xrspatial.local.popularity](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.popularity.html) calculates the number of occurrences of each value of a raster dataset, on a cell-by-cell basis. The output value is assigned based on the reference data variable nth most popular."
507492
]
508493
},
509494
{
@@ -554,7 +539,7 @@
554539
"id": "385dac65",
555540
"metadata": {},
556541
"source": [
557-
"[`xrspatial.local.rank`](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.rank.html) calculates the rank of each value of a raster dataset, on a cell-by-cell basis. The output value is assigned based on the rank of the reference data variable rank."
542+
"[xrspatial.local.rank](https://xarray-spatial.org/reference/_autosummary/xrspatial.local.rank.html) calculates the rank of each value of a raster dataset, on a cell-by-cell basis. The output value is assigned based on the rank of the reference data variable rank."
558543
]
559544
},
560545
{
@@ -590,11 +575,21 @@
590575
" [\"arr_ref\", \"arr1\", \"arr2\", \"arr3\", \"result\"],\n",
591576
")"
592577
]
578+
},
579+
{
580+
"cell_type": "markdown",
581+
"id": "7849e658-30a7-43a9-babc-360b9a18d8c4",
582+
"metadata": {},
583+
"source": [
584+
"## Next steps\n",
585+
"\n",
586+
"Click on this link to go to the next notebook: [06 Focal Statistics](06_Focal_Statistics.ipynb)"
587+
]
593588
}
594589
],
595590
"metadata": {
596591
"kernelspec": {
597-
"display_name": "Python 3",
592+
"display_name": "Python 3 (ipykernel)",
598593
"language": "python",
599594
"name": "python3"
600595
},
@@ -608,7 +603,7 @@
608603
"name": "python",
609604
"nbconvert_exporter": "python",
610605
"pygments_lexer": "ipython3",
611-
"version": "3.8.8"
606+
"version": "3.9.1"
612607
}
613608
},
614609
"nbformat": 4,

0 commit comments

Comments
 (0)