|
5 | 5 | "id": "e9045413", |
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | | - "## Exploring Xarray-spatial Local Tools Functions" |
| 8 | + "## Exploring local tools in Xarray-Spatial" |
9 | 9 | ] |
10 | 10 | }, |
11 | 11 | { |
12 | 12 | "cell_type": "markdown", |
13 | 13 | "id": "32b5e1bf", |
14 | 14 | "metadata": {}, |
15 | 15 | "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", |
18 | 18 | "- 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", |
30 | 25 | "- [Cell Statistics](#Cell-Statistics)\n", |
31 | 26 | "- [Combine](#Combine)\n", |
32 | 27 | "- [Lesser Frequency](#Lesser-Frequency)\n", |
|
35 | 30 | "- [Lowest Position](#Lowest-Position)\n", |
36 | 31 | "- [Highest Position](#Highest-Position)\n", |
37 | 32 | "- [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):" |
55 | 40 | ] |
56 | 41 | }, |
57 | 42 | { |
|
94 | 79 | "id": "17d54999", |
95 | 80 | "metadata": {}, |
96 | 81 | "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:" |
98 | 83 | ] |
99 | 84 | }, |
100 | 85 | { |
|
143 | 128 | "id": "01ab159c", |
144 | 129 | "metadata": {}, |
145 | 130 | "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." |
147 | 132 | ] |
148 | 133 | }, |
149 | 134 | { |
|
207 | 192 | "id": "87c34a83", |
208 | 193 | "metadata": {}, |
209 | 194 | "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." |
211 | 196 | ] |
212 | 197 | }, |
213 | 198 | { |
|
255 | 240 | "id": "4f6da50e", |
256 | 241 | "metadata": {}, |
257 | 242 | "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." |
259 | 244 | ] |
260 | 245 | }, |
261 | 246 | { |
|
305 | 290 | "id": "intelligent-philadelphia", |
306 | 291 | "metadata": {}, |
307 | 292 | "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." |
309 | 294 | ] |
310 | 295 | }, |
311 | 296 | { |
|
355 | 340 | "id": "vocational-inside", |
356 | 341 | "metadata": {}, |
357 | 342 | "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." |
359 | 344 | ] |
360 | 345 | }, |
361 | 346 | { |
|
405 | 390 | "id": "8d7235ec", |
406 | 391 | "metadata": {}, |
407 | 392 | "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." |
409 | 394 | ] |
410 | 395 | }, |
411 | 396 | { |
|
454 | 439 | "id": "a17c6e93", |
455 | 440 | "metadata": {}, |
456 | 441 | "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." |
458 | 443 | ] |
459 | 444 | }, |
460 | 445 | { |
|
503 | 488 | "id": "e5408cea", |
504 | 489 | "metadata": {}, |
505 | 490 | "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." |
507 | 492 | ] |
508 | 493 | }, |
509 | 494 | { |
|
554 | 539 | "id": "385dac65", |
555 | 540 | "metadata": {}, |
556 | 541 | "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." |
558 | 543 | ] |
559 | 544 | }, |
560 | 545 | { |
|
590 | 575 | " [\"arr_ref\", \"arr1\", \"arr2\", \"arr3\", \"result\"],\n", |
591 | 576 | ")" |
592 | 577 | ] |
| 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 | + ] |
593 | 588 | } |
594 | 589 | ], |
595 | 590 | "metadata": { |
596 | 591 | "kernelspec": { |
597 | | - "display_name": "Python 3", |
| 592 | + "display_name": "Python 3 (ipykernel)", |
598 | 593 | "language": "python", |
599 | 594 | "name": "python3" |
600 | 595 | }, |
|
608 | 603 | "name": "python", |
609 | 604 | "nbconvert_exporter": "python", |
610 | 605 | "pygments_lexer": "ipython3", |
611 | | - "version": "3.8.8" |
| 606 | + "version": "3.9.1" |
612 | 607 | } |
613 | 608 | }, |
614 | 609 | "nbformat": 4, |
|
0 commit comments