Skip to content

Commit 49dd52d

Browse files
Quarto output
1 parent a39f4cc commit 49dd52d

11 files changed

+29
-42
lines changed

notebooks/courses/microwave-remote-sensing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- aiohttp
66
- bokeh
77
- cmcrameri
8-
- dask=2024.12.0
8+
- dask
99
- datashader
1010
- folium
1111
- graphviz

notebooks/courses/microwave-remote-sensing/02_in_class_exercise.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"import odc.stac\n",
3232
"import matplotlib.pyplot as plt\n",
3333
"import xarray as xr\n",
34-
"import rioxarray # noqa"
34+
"import rioxarray # noqa: F401"
3535
]
3636
},
3737
{

notebooks/courses/microwave-remote-sensing/03_in_class_exercise.ipynb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,9 @@
2222
"import numpy as np\n",
2323
"import xarray as xr\n",
2424
"import intake\n",
25-
"\n",
26-
"import rioxarray #noqa\n",
27-
"import matplotlib.pyplot as plt # noqa\n",
28-
"import hvplot.xarray # noqa\n",
29-
"\n",
30-
"from pathlib import Path\n",
31-
"from functools import partial"
25+
"import rioxarray # noqa: F401\n",
26+
"import matplotlib.pyplot as plt # noqa: F401\n",
27+
"import hvplot.xarray # noqa: F401"
3228
]
3329
},
3430
{
@@ -240,7 +236,7 @@
240236
"source": [
241237
"*Figure 7: $\\sigma^0_E$, $\\gamma^0_E$, and $\\gamma^0_T$ can be selected on the right-hand side of the graphic.*\n",
242238
"\n",
243-
"When comparing $\\gamma^0_E$ and $\\gamma^0_T$ in the plot we can clearly see the impact of the radiometric correction in the mountainous areas. This correction is necessary, because for slopes facing towards the sensor, a larger ground area contributes to the backscatter value of a slant range resolution cell, than for slopes lying in the opposite direction. This results in significant brightness changes, where foreshortening areas appear brighter and lengthening areas darker. $\\gamma^0_T$ adjusts the backscatter to represent what it would be if the terrain was flat, thus reducing these effects. This significantly reduces the impact of the terrain on the backscatter values, allowing for more accurate comparisons across different terrain types and locations. The correction is done by using a DEM to determine the local illuminated area at each radar position. The above illustrated approach is also referred to as terrain flattening because in the resulting image, mountains appear flat. As $\\gamma^0_T$ is corrected for geometric and radiometric distortions, it is also referred to as Normalized Radar Backscatter (NRB) and is the current standard for Analysis-Ready-Backscatter (ARD).\n"
239+
"When comparing $\\gamma^0_E$ and $\\gamma^0_T$ in the plot we can clearly see the impact of the radiometric correction in the mountainous areas. This correction is necessary, because for slopes facing towards the sensor, a larger ground area contributes to the backscatter value of a slant range resolution cell, than for slopes lying in the opposite direction. This results in significant brightness changes, where foreshortening areas appear brighter and lengthening areas darker. $\\gamma^0_T$ adjusts the backscatter to represent what it would be if the terrain was flat, thus reducing these effects. This significantly reduces the impact of the terrain on the backscatter values, allowing for more accurate comparisons across different terrain types and locations. The correction is done by using a DEM to determine the local illuminated area at each radar position. The above illustrated approach is also referred to as terrain flattening because in the resulting image, mountains appear flat. As $\\gamma^0_T$ is corrected for geometric and radiometric distortions, it is also referred to as Normalized Radar Backscatter (NRB) and is the current standard for Analysis-Ready-Backscatter (ARD)."
244240
]
245241
}
246242
],

notebooks/courses/microwave-remote-sensing/04_in_class_exercise.ipynb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,13 @@
4848
"import numpy as np\n",
4949
"import pandas as pd\n",
5050
"import xarray as xr\n",
51-
"import rioxarray # noqa\n",
52-
"import hvplot.xarray # noqa\n",
51+
"import rioxarray # noqa: F401\n",
52+
"import hvplot.xarray # noqa: F401\n",
5353
"import folium\n",
54-
"\n",
5554
"from huggingface_hub import snapshot_download\n",
5655
"from shapely.geometry import mapping, box\n",
5756
"from shapely import affinity\n",
5857
"from rasterio.enums import Resampling\n",
59-
"\n",
6058
"from pathlib import Path\n",
6159
"from functools import partial"
6260
]
@@ -479,7 +477,7 @@
479477
"id": "30",
480478
"metadata": {},
481479
"source": [
482-
"*Figure 3: Stacked array with ALOS-2 L-band and Sentinel-1 C-band $\\gamma^0_T (dB)$.*\n"
480+
"*Figure 3: Stacked array with ALOS-2 L-band and Sentinel-1 C-band $\\gamma^0_T (dB)$.*"
483481
]
484482
}
485483
],

notebooks/courses/microwave-remote-sensing/05_in_class_exercise.ipynb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@
2828
"outputs": [],
2929
"source": [
3030
"import numpy as np\n",
31-
"import xarray as xr\n",
3231
"import intake\n",
33-
"\n",
3432
"import matplotlib.pyplot as plt\n",
35-
"import hvplot.xarray # noqa\n",
33+
"import hvplot.xarray # noqa: F401\n",
3634
"import holoviews as hv"
3735
]
3836
},
@@ -226,7 +224,7 @@
226224
"\n",
227225
"Can you see some patterns when analyzing the different wavelengths and polarizations?\n",
228226
"\n",
229-
"Remember again that we deal with a logarithmic scale. A measurement of 10 dB is 10 times brighter than the intensity measured at 0 dB, and 100 times brighter at 20 dB. The most notable difference is that the offset between cross- and co-polarised signals becomes larger at low LAI and lower at higher LAI. This might indicate the effect of volume scattering in forested areas where co- and cross-polarization render backscattering values more equal. You will study the differences among cross- and co-polarized backscattering in more detail in the homework exercise.\n"
227+
"Remember again that we deal with a logarithmic scale. A measurement of 10 dB is 10 times brighter than the intensity measured at 0 dB, and 100 times brighter at 20 dB. The most notable difference is that the offset between cross- and co-polarised signals becomes larger at low LAI and lower at higher LAI. This might indicate the effect of volume scattering in forested areas where co- and cross-polarization render backscattering values more equal. You will study the differences among cross- and co-polarized backscattering in more detail in the homework exercise."
230228
]
231229
}
232230
],

notebooks/courses/microwave-remote-sensing/06_in_class_exercise.ipynb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,9 @@
2222
"source": [
2323
"import numpy as np\n",
2424
"import xarray as xr\n",
25-
"import rioxarray # noqa\n",
26-
"\n",
25+
"import rioxarray # noqa: F401\n",
2726
"import intake\n",
2827
"import json\n",
29-
"\n",
30-
"from functools import partial\n",
31-
"from pathlib import Path\n",
32-
"\n",
3328
"import matplotlib.pyplot as plt\n",
3429
"import matplotlib.patches as mpatches\n",
3530
"from matplotlib.colors import ListedColormap, BoundaryNorm\n",
@@ -118,7 +113,7 @@
118113
"outputs": [],
119114
"source": [
120115
"# Load encoding\n",
121-
"with open(\"../../images/cmaps/06_color_mapping.json\", \"r\") as f:\n",
116+
"with cat.corine_cmap.read()[0] as f:\n",
122117
" color_mapping_data = json.load(f)\n",
123118
"\n",
124119
"# Get mapping\n",

notebooks/courses/microwave-remote-sensing/07_in_class_exercise.ipynb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626
"outputs": [],
2727
"source": [
2828
"import numpy as np\n",
29-
"import xarray as xr\n",
3029
"import intake\n",
3130
"import json\n",
32-
"from pathlib import Path\n",
3331
"import matplotlib.pyplot as plt\n",
3432
"import holoviews as hv\n",
3533
"from holoviews.streams import RangeXY\n",
@@ -183,7 +181,7 @@
183181
"outputs": [],
184182
"source": [
185183
"# Load encoding\n",
186-
"with open(\"../../images/cmaps/06_color_mapping.json\", \"r\") as f:\n",
184+
"with cat.corine_cmap.read()[0] as f:\n",
187185
" color_mapping_data = json.load(f)\n",
188186
"\n",
189187
"# Get mapping\n",
@@ -450,7 +448,7 @@
450448
"source": [
451449
"*Figure 4: Lake Neusiedl $\\sigma^0_E$ with a temporal filter applied.*\n",
452450
"\n",
453-
"Let´s observe the histograms of the two plots. Especially in the region around the lake, it is clear that the distribution is now less dispersed and more centered around a central value.\n"
451+
"Let´s observe the histograms of the two plots. Especially in the region around the lake, it is clear that the distribution is now less dispersed and more centered around a central value."
454452
]
455453
}
456454
],

notebooks/courses/microwave-remote-sensing/08_in_class_exercise.ipynb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,13 @@
2727
"metadata": {},
2828
"outputs": [],
2929
"source": [
30-
"import xarray as xr\n",
31-
"import numpy as np\n",
3230
"import matplotlib.pyplot as plt\n",
3331
"import hvplot.xarray # noqa: F401\n",
3432
"import seaborn as sns\n",
3533
"import holoviews as hv\n",
3634
"import folium\n",
3735
"import base64\n",
3836
"import intake\n",
39-
"from pathlib import Path\n",
4037
"from io import BytesIO\n",
4138
"\n",
4239
"hv.extension(\"bokeh\")"

notebooks/courses/microwave-remote-sensing/09_in_class_exercise.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"import matplotlib.pyplot as plt\n",
3636
"import matplotlib.patches as patches\n",
3737
"import xarray as xr\n",
38-
"from pathlib import Path\n",
3938
"import cmcrameri as cmc # noqa: F401\n",
4039
"import snaphu\n",
4140
"import seaborn as sns\n",
@@ -607,7 +606,7 @@
607606
"In the following animation, we can capture the 3D displacement caused by the Ridgecrest quake by observing the after and before elevation model.\n",
608607
"\n",
609608
"![](../../images/ridgecrest.gif)\n",
610-
"*Credits: NASA*\n"
609+
"*Credits: NASA*"
611610
]
612611
}
613612
],

notebooks/tutorials/floodmapping.ipynb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"import xarray as xr\n",
3333
"import numpy as np\n",
3434
"import datetime\n",
35-
"import rioxarray\n",
35+
"import rioxarray # noqa: F401\n",
3636
"import pandas as pd\n",
3737
"\n",
3838
"import hvplot.pandas\n",
@@ -125,8 +125,9 @@
125125
"\n",
126126
"\n",
127127
"def post_process_eodc_cube_(dc, items, band):\n",
128-
" scale = items[0].assets[band].extra_fields.get(\"raster:bands\")[0][\"scale\"]\n",
129-
" nodata = items[0].assets[band].extra_fields.get(\"raster:bands\")[0][\"nodata\"]\n",
128+
" fields = items[0].assets[band].extra_fields\n",
129+
" scale = fields.get(\"raster:bands\")[0][\"scale\"]\n",
130+
" nodata = fields.get(\"raster:bands\")[0][\"nodata\"]\n",
130131
" return dc.where(dc != nodata) / scale\n",
131132
"\n",
132133
"\n",
@@ -416,7 +417,9 @@
416417
").interactive()\n",
417418
"\n",
418419
"view_likelihoods = (\n",
419-
" likelihood_pdi.hvplot(\"sigma\", \"water_likelihood\", ylabel=\"likelihoods\").dmap()\n",
420+
" likelihood_pdi.hvplot(\n",
421+
" \"sigma\", \"water_likelihood\",\n",
422+
" ylabel=\"likelihoods\").dmap()\n",
420423
" * likelihood_pdi.hvplot(\"sigma\", \"land_likelihood\").dmap()\n",
421424
" * likelihood_pdi.hvplot(\"observed\", \"land_likelihood\").dmap()\n",
422425
").opts(frame_height=200, frame_width=300)\n",
@@ -465,7 +468,9 @@
465468
" land_likelihood = calc_land_likelihood(sigma=sigma, x=x, y=y)\n",
466469
" water_likelihood = calc_water_likelihood(sigma=sigma, x=x, y=y)\n",
467470
" evidence = (water_likelihood * 0.5) + (land_likelihood * 0.5)\n",
468-
" return (water_likelihood * 0.5) / evidence, (land_likelihood * 0.5) / evidence"
471+
" water_posterior = (water_likelihood * 0.5) / evidence\n",
472+
" land_posterior = (land_likelihood * 0.5) / evidence\n",
473+
" return water_posterior, land_posterior"
469474
]
470475
},
471476
{
@@ -598,7 +603,8 @@
598603
" \"ticker\": FixedTicker(ticks=[0, 1]),\n",
599604
"}\n",
600605
"flood_view = flood_dc.decision.hvplot.image(\n",
601-
" x=\"x\", y=\"y\", rasterize=True, geo=True, cmap=[\"rgba(0, 0, 1, 0.1)\", \"darkred\"]\n",
606+
" x=\"x\", y=\"y\", rasterize=True, geo=True,\n",
607+
" cmap=[\"rgba(0, 0, 1, 0.1)\", \"darkred\"]\n",
602608
").opts(frame_height=400, colorbar_opts={**colorbar_opts})\n",
603609
"mrs_view.get(0) * flood_view"
604610
]

0 commit comments

Comments
 (0)