Skip to content

Commit 32a22e5

Browse files
committed
Re-execute notebooks and fix rasterize scanline off-by-one
Add half-pixel offset to scanline edge extraction so integer positions correspond to pixel centers instead of edges. Re-execute notebooks 10, 23-31 to capture updated outputs.
1 parent b351db0 commit 32a22e5

11 files changed

+88
-309
lines changed

examples/user_guide/10_Mahalanobis_Distance.ipynb

Lines changed: 26 additions & 175 deletions
Large diffs are not rendered by default.

examples/user_guide/23_Hydraulic_Erosion.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
},
5252
"outputs": [],
5353
"source": [
54+
"%matplotlib inline\n",
5455
"import numpy as np\n",
5556
"import pandas as pd\n",
5657
"import xarray as xr\n",

examples/user_guide/24_Sky_View_Factor.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
},
5252
"outputs": [],
5353
"source": [
54+
"%matplotlib inline\n",
5455
"import numpy as np\n",
5556
"import pandas as pd\n",
5657
"import xarray as xr\n",

examples/user_guide/25_GLCM_Texture.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
},
6060
"outputs": [],
6161
"source": [
62+
"%matplotlib inline\n",
6263
"import numpy as np\n",
6364
"import pandas as pd\n",
6465
"import xarray as xr\n",
@@ -359,7 +360,7 @@
359360
"id": "ec79xdunce9",
360361
"metadata": {},
361362
"source": [
362-
"### Step 1 Download a Sentinel-2 NIR band\n",
363+
"### Step 1 \u2014 Download a Sentinel-2 NIR band\n",
363364
"\n",
364365
"We read a 500 x 500 pixel window (5 km x 5 km at 10 m resolution) straight from a\n",
365366
"Cloud-Optimized GeoTIFF hosted on AWS. The scene is\n",
@@ -442,7 +443,7 @@
442443
"id": "joxz7n8olpc",
443444
"metadata": {},
444445
"source": [
445-
"### Step 2 Compute GLCM texture features\n",
446+
"### Step 2 \u2014 Compute GLCM texture features\n",
446447
"\n",
447448
"We pick four metrics that tend to separate water (uniform, high energy, high homogeneity) from land (rough, high contrast):\n",
448449
"\n",

examples/user_guide/26_Contour_Lines.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
},
5151
"outputs": [],
5252
"source": [
53+
"%matplotlib inline\n",
5354
"import numpy as np\n",
5455
"import pandas as pd\n",
5556
"import xarray as xr\n",

examples/user_guide/27_Stream_Analysis_Dinf_MFD.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
},
4747
"outputs": [],
4848
"source": [
49+
"%matplotlib inline\n",
4950
"import numpy as np\n",
5051
"import pandas as pd\n",
5152
"import xarray as xr\n",

examples/user_guide/28_Rasterize.ipynb

Lines changed: 19 additions & 102 deletions
Large diffs are not rendered by default.

examples/user_guide/29_Preview.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
},
5151
"outputs": [],
5252
"source": [
53+
"%matplotlib inline\n",
5354
"import numpy as np\n",
5455
"import pandas as pd\n",
5556
"import xarray as xr\n",

examples/user_guide/30_Zonal_Crosstab.ipynb

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
},
5252
"outputs": [],
5353
"source": [
54+
"%matplotlib inline\n",
5455
"import numpy as np\n",
5556
"import pandas as pd\n",
5657
"import xarray as xr\n",
@@ -172,7 +173,7 @@
172173
"name": "stdout",
173174
"output_type": "stream",
174175
"text": [
175-
"Slope range: 0.0° - 0.0°\n"
176+
"Slope range: 0.0\u00b0 - 0.0\u00b0\n"
176177
]
177178
}
178179
],
@@ -181,7 +182,7 @@
181182
"slope_agg = terrain.xrs.slope()\n",
182183
"slope_agg.name = \"Slope\"\n",
183184
"\n",
184-
"print(f\"Slope range: {float(slope_agg.min()):.1f}° - {float(slope_agg.max()):.1f}°\")"
185+
"print(f\"Slope range: {float(slope_agg.min()):.1f}\u00b0 - {float(slope_agg.max()):.1f}\u00b0\")"
185186
]
186187
},
187188
{
@@ -357,11 +358,11 @@
357358
" Peaks: 2001m - 2014m\n",
358359
"\n",
359360
"Slope classes:\n",
360-
" Flat: 0.0° - 0.0°\n",
361-
" Gentle: 0.0° - 0.0°\n",
362-
" Moderate: 0.0° - 0.0°\n",
363-
" Steep: 0.0° - 0.0°\n",
364-
" Very Steep: 0.0° - 0.0°\n"
361+
" Flat: 0.0\u00b0 - 0.0\u00b0\n",
362+
" Gentle: 0.0\u00b0 - 0.0\u00b0\n",
363+
" Moderate: 0.0\u00b0 - 0.0\u00b0\n",
364+
" Steep: 0.0\u00b0 - 0.0\u00b0\n",
365+
" Very Steep: 0.0\u00b0 - 0.0\u00b0\n"
365366
]
366367
}
367368
],
@@ -371,7 +372,7 @@
371372
"slope_names = [\"Flat\", \"Gentle\", \"Moderate\", \"Steep\", \"Very Steep\"]\n",
372373
"\n",
373374
"elev_labels = bin_ranges(elevation_zones, terrain, unit='m', decimals=0)\n",
374-
"slope_labels = bin_ranges(slope_classes, slope_agg, unit='°', decimals=1)\n",
375+
"slope_labels = bin_ranges(slope_classes, slope_agg, unit='\u00b0', decimals=1)\n",
375376
"\n",
376377
"print(\"Elevation zones:\")\n",
377378
"for name, label in zip(zone_names, elev_labels):\n",
@@ -426,11 +427,11 @@
426427
" <thead>\n",
427428
" <tr style=\"text-align: right;\">\n",
428429
" <th></th>\n",
429-
" <th>Flat\\n(0.0° - 0.0°)</th>\n",
430-
" <th>Gentle\\n(0.0° - 0.0°)</th>\n",
431-
" <th>Moderate\\n(0.0° - 0.0°)</th>\n",
432-
" <th>Steep\\n(0.0° - 0.0°)</th>\n",
433-
" <th>Very Steep\\n(0.0° - 0.0°)</th>\n",
430+
" <th>Flat\\n(0.0\u00b0 - 0.0\u00b0)</th>\n",
431+
" <th>Gentle\\n(0.0\u00b0 - 0.0\u00b0)</th>\n",
432+
" <th>Moderate\\n(0.0\u00b0 - 0.0\u00b0)</th>\n",
433+
" <th>Steep\\n(0.0\u00b0 - 0.0\u00b0)</th>\n",
434+
" <th>Very Steep\\n(0.0\u00b0 - 0.0\u00b0)</th>\n",
434435
" </tr>\n",
435436
" <tr>\n",
436437
" <th>Elevation Zone</th>\n",
@@ -487,23 +488,23 @@
487488
"</div>"
488489
],
489490
"text/plain": [
490-
" Flat\\n(0.0° - 0.0°) Gentle\\n(0.0° - 0.0°) \\\n",
491+
" Flat\\n(0.0\u00b0 - 0.0\u00b0) Gentle\\n(0.0\u00b0 - 0.0\u00b0) \\\n",
491492
"Elevation Zone \n",
492493
"Valley\\n(1952m - 1998m) 0.160460 2.379629 \n",
493494
"Lowlands\\n(1998m - 2000m) 4.109002 30.917339 \n",
494495
"Foothills\\n(2000m - 2000m) 85.650793 14.349207 \n",
495496
"Mountains\\n(2000m - 2001m) 9.803059 48.124300 \n",
496497
"Peaks\\n(2001m - 2014m) 0.298084 4.136447 \n",
497498
"\n",
498-
" Moderate\\n(0.0° - 0.0°) Steep\\n(0.0° - 0.0°) \\\n",
499+
" Moderate\\n(0.0\u00b0 - 0.0\u00b0) Steep\\n(0.0\u00b0 - 0.0\u00b0) \\\n",
499500
"Elevation Zone \n",
500501
"Valley\\n(1952m - 1998m) 10.866168 28.294407 \n",
501502
"Lowlands\\n(1998m - 2000m) 39.824184 22.381570 \n",
502503
"Foothills\\n(2000m - 2000m) 0.000000 0.000000 \n",
503504
"Mountains\\n(2000m - 2001m) 31.051921 10.701385 \n",
504505
"Peaks\\n(2001m - 2014m) 18.181055 38.655471 \n",
505506
"\n",
506-
" Very Steep\\n(0.0° - 0.0°) \n",
507+
" Very Steep\\n(0.0\u00b0 - 0.0\u00b0) \n",
507508
"Elevation Zone \n",
508509
"Valley\\n(1952m - 1998m) 58.299336 \n",
509510
"Lowlands\\n(1998m - 2000m) 2.767906 \n",
@@ -621,8 +622,8 @@
621622
" <thead>\n",
622623
" <tr style=\"text-align: right;\">\n",
623624
" <th></th>\n",
624-
" <th>Mean Slope (°)</th>\n",
625-
" <th>Std Dev (°)</th>\n",
625+
" <th>Mean Slope (\u00b0)</th>\n",
626+
" <th>Std Dev (\u00b0)</th>\n",
626627
" </tr>\n",
627628
" <tr>\n",
628629
" <th>Elevation Zone</th>\n",
@@ -661,7 +662,7 @@
661662
"</div>"
662663
],
663664
"text/plain": [
664-
" Mean Slope (°) Std Dev (°)\n",
665+
" Mean Slope (\u00b0) Std Dev (\u00b0)\n",
665666
"Elevation Zone \n",
666667
"Valley 0.000198 0.000183\n",
667668
"Lowlands 0.000044 0.000032\n",
@@ -680,7 +681,7 @@
680681
"mean_slope_by_elev = slope_agg.xrs.zonal_stats(elevation_zones, stats_funcs=['mean', 'std'])\n",
681682
"mean_slope_by_elev['Elevation Zone'] = zone_names\n",
682683
"mean_slope_by_elev = mean_slope_by_elev[['Elevation Zone', 'mean', 'std']]\n",
683-
"mean_slope_by_elev.columns = ['Elevation Zone', 'Mean Slope (°)', 'Std Dev (°)']\n",
684+
"mean_slope_by_elev.columns = ['Elevation Zone', 'Mean Slope (\u00b0)', 'Std Dev (\u00b0)']\n",
684685
"mean_slope_by_elev.set_index('Elevation Zone', inplace=True)\n",
685686
"\n",
686687
"mean_slope_by_elev"
@@ -712,9 +713,9 @@
712713
],
713714
"source": [
714715
"fig, ax = plt.subplots(figsize=(10, 5))\n",
715-
"mean_slope_by_elev['Mean Slope (°)'].plot(\n",
716+
"mean_slope_by_elev['Mean Slope (\u00b0)'].plot(\n",
716717
" kind=\"bar\", ax=ax, color=\"orangered\",\n",
717-
" yerr=mean_slope_by_elev['Std Dev (°)'], capsize=5)\n",
718+
" yerr=mean_slope_by_elev['Std Dev (\u00b0)'], capsize=5)\n",
718719
"ax.set_xlabel(\"Elevation Zone\")\n",
719720
"ax.set_ylabel(\"Mean Slope (degrees)\")\n",
720721
"ax.set_title(\"Mean terrain steepness by elevation zone\")\n",

examples/user_guide/31_Viewshed.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
},
5151
"outputs": [],
5252
"source": [
53+
"%matplotlib inline\n",
5354
"import numpy as np\n",
5455
"import pandas as pd\n",
5556
"import xarray as xr\n",

0 commit comments

Comments
 (0)