Skip to content

Commit

Permalink
minor addition in notebook, fix publication date
Browse files Browse the repository at this point in the history
  • Loading branch information
npikall committed Jul 26, 2024
1 parent 241d5a7 commit 3a5f1e1
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project:
book:
title: "notebooks4eo"
author: ""
date: "10/7/2024"
date: "7/10/2024"
chapters:
- index.qmd
- chapters/01_classification.qmd
Expand Down
19 changes: 19 additions & 0 deletions chapters/01_classification.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,25 @@ plot.axes.set_title(f"RGB - Median Composite\n{start_date.strftime('%d.%m.%Y')}
plt.show()
```

### False Color Image
In addition to the regular RGB Image, we can swap any of the bands from the visible spectrum with any other bands. In this specific case the red band has been changed to the near infrared band. This allows us to see vegetated areas more clearly, since they now appear in a bright red color. This is due to the fact that plants absorb regular red light while reflecting near infrared light [@nasa2020].

```{python}
# compute the false color image
fc_median = (
ds_odc[['nir', 'green', 'blue']]
.where(ds_odc.valid)
.to_dataarray(dim="band")
.transpose(..., "band")
.median(dim="time")
.astype(int)
)
fc_comp = avg(fc_median)
plot = fc_comp.plot.imshow(rgb="band", figsize=(8, 8))
plot.axes.set_title(f"False Color - Median Composite\n{start_date.strftime('%d.%m.%Y')} - {end_date.strftime('%d.%m.%Y')}")
plt.show()
```

### NDVI Image
To get an first impression of the data, we can calculate the NDVI (Normalized Difference Vegetation Index) and plot it. The NDVI is calculated by useing the following formula. [@rouse1974monitoring]

Expand Down
8 changes: 8 additions & 0 deletions chapters/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,11 @@ @article{rouse1974monitoring
pages={309},
year={1974}
}

@online{nasa2020,
title = {Earth Observatory},
author = {NASA},
year = {2020},
url = {https://earthobservatory.nasa.gov/features/MeasuringVegetation/measuring_vegetation_2.php},
urldate = {2024-07-26}
}
29 changes: 29 additions & 0 deletions notebooks/01_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,35 @@
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### False Color Image\n",
"In addition to the regular RGB Image, we can swap any of the bands from the visible spectrum with any other bands. In this specific case the red band has been changed to the near infrared band. This allows us to see vegetated areas more clearly, since they now appear in a bright red color. This is due to the fact that plants absorb regular red light while reflecting near infrared light [@nasa2020]."
]
},
{
"cell_type": "code",
"metadata": {},
"source": [
"# compute the false color image\n",
"fc_median = (\n",
" ds_odc[['nir', 'green', 'blue']]\n",
" .where(ds_odc.valid)\n",
" .to_dataarray(dim=\"band\")\n",
" .transpose(..., \"band\")\n",
" .median(dim=\"time\")\n",
" .astype(int)\n",
")\n",
"fc_comp = avg(fc_median)\n",
"plot = fc_comp.plot.imshow(rgb=\"band\", figsize=(8, 8))\n",
"plot.axes.set_title(f\"False Color - Median Composite\\n{start_date.strftime('%d.%m.%Y')} - {end_date.strftime('%d.%m.%Y')}\")\n",
"plt.show()"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 3a5f1e1

Please sign in to comment.