You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix duplicate notebook numbers and restructure to standard format (#1181)
* Renumber duplicate user guide notebooks (#1180)
Two notebooks shared prefix 48 and four shared prefix 50.
Renumber to a gap-free 48-54 sequence, ordered by commit date.
* Restructure 13 user guide notebooks to standard format (#1180)
Notebooks 38, 40-41, 44-49, 51-54 were missing the standard cell
sequence (title, "What you'll build", imports intro, data section,
References). Each notebook now follows the established structure:
- Cell 0: h1 title in "Xarray-Spatial {module}: {tools}" format
- Cell 1: "What you'll build" with anchor-linked section list
- Cells 2-7: imports one-liner, imports, data header, data gen, description, plot
- Final cell: References with real URLs
Also fixed:
- ax.imshow(data.values) replaced with data.plot.imshow() throughout
- Red/green colormap in 48_Sieve_Filter swapped for teal/blue/orange
- Em dashes removed from prose
- Patch legends added to categorical overlays
"Focal variety counts the number of distinct values in a sliding\n",
10
-
"neighbourhood window. It is most useful for categorical rasters\n",
11
-
"(land-cover, soil type, geology codes) where you want to map\n",
12
-
"boundary complexity or patch fragmentation.\n",
10
+
"Focal variety counts distinct values in a sliding window over a categorical raster, making it a natural fit for mapping boundary complexity in land-cover, soil-type, or geology data. This notebook walks through computing focal variety with `xrspatial.focal.focal_stats`, comparing kernel shapes, and combining variety with other focal statistics."
11
+
]
12
+
},
13
+
{
14
+
"cell_type": "markdown",
15
+
"id": "5be55dfa",
16
+
"metadata": {},
17
+
"source": [
18
+
"### What you'll build\n",
19
+
"\n",
20
+
"1. Create a synthetic categorical raster with multiple land-cover classes\n",
21
+
"2. Compute focal variety with a 3x3 box kernel\n",
22
+
"3. Compare kernel shapes: box vs. circle\n",
23
+
"4. Combine variety with other focal statistics in a single call\n",
13
24
"\n",
14
-
"This notebook shows how to compute focal variety with\n",
15
-
"`xrspatial.focal.focal_stats` across different kernel shapes."
"Five land-cover classes on a 60x60 grid. The quadrant layout gives clean boundaries for focal variety to detect, and the random class-5 patches add smaller-scale fragmentation."
"Pixels deep inside a uniform quadrant show variety = 1. Pixels on\n",
109
-
"boundaries between classes show variety = 2, 3, or 4 depending on\n",
110
-
"how many classes meet at that point. The scattered class-5 patches\n",
111
-
"create small pockets of higher variety."
148
+
"Pixels deep inside a uniform quadrant show variety = 1. Pixels on boundaries between classes show variety = 2, 3, or 4 depending on how many classes meet at that point. The scattered class-5 patches create small pockets of higher variety."
112
149
]
113
150
},
114
151
{
115
152
"cell_type": "markdown",
153
+
"id": "68589081",
116
154
"metadata": {},
117
155
"source": [
118
156
"## Larger kernel: 5x5 circle\n",
119
157
"\n",
120
-
"Increasing the kernel radius captures more of the surrounding\n",
121
-
"landscape, so variety values near boundaries will be higher."
158
+
"Increasing the kernel radius captures more of the surrounding landscape, so variety values near boundaries will be higher."
"You can request variety alongside other statistics in one call.\n",
153
-
"Here we grab both range and variety to compare continuous and\n",
154
-
"categorical measures of local heterogeneity."
195
+
"You can request variety alongside other statistics in one call. Here we compute both range and variety to compare continuous and categorical measures of local heterogeneity."
"Range measures the numeric spread (max minus min) while variety counts distinct classes. For categorical data, variety is usually the more meaningful metric since the numeric distance between class codes is arbitrary."
178
227
]
179
228
},
180
229
{
181
230
"cell_type": "markdown",
231
+
"id": "ad3e1f07",
182
232
"metadata": {},
183
233
"source": [
184
-
"Range measures the numeric spread (max minus min) while variety\n",
185
-
"counts distinct classes. For categorical data, variety is usually\n",
186
-
"the more meaningful measure since the numeric distance between\n",
"- [xrspatial.focal.focal_stats API docs](https://xarray-spatial.readthedocs.io/en/latest/reference/_autosummary/xrspatial.focal.focal_stats.html)\n",
238
+
"- McGarigal, K. & Marks, B. J. (1995). [FRAGSTATS: Spatial Pattern Analysis Program](https://www.fs.usda.gov/research/treesearch/3064). USDA Forest Service General Technical Report PNW-GTR-351."
0 commit comments