Skip to content

Commit 80ff6f0

Browse files
committed
Add Acolite EMIT notebook example
1 parent 6f9f390 commit 80ff6f0

File tree

2 files changed

+195
-1
lines changed

2 files changed

+195
-1
lines changed

Diff for: docs/examples/acolite_emit.ipynb

+192
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/HyperCoast/blob/main/docs/examples/acolite_emit.ipynb)\n",
8+
"\n",
9+
"# EMIT Atmospheric Correction with Acolite\n",
10+
"\n",
11+
"\n",
12+
"[Acolite](https://github.com/acolite/acolite) can perform atmospheric correction on a variety of satellite sensors, including Landsat, Sentinel-2, PACE, EMIT, AVIRIS, among others. For more information on how to use Acolite, please refer to the [Acolite manual](https://github.com/acolite/acolite/releases/download/20231023.0/acolite_manual_20231023.pdf.)\n",
13+
"\n",
14+
"\n",
15+
"In this example, we will use Acolite to perform atmospheric correction on an EMIT image."
16+
]
17+
},
18+
{
19+
"cell_type": "code",
20+
"execution_count": null,
21+
"metadata": {},
22+
"outputs": [],
23+
"source": [
24+
"# %pip install \"hypercoast[extra]\""
25+
]
26+
},
27+
{
28+
"cell_type": "markdown",
29+
"metadata": {},
30+
"source": [
31+
"## Import libraries"
32+
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": null,
37+
"metadata": {},
38+
"outputs": [],
39+
"source": [
40+
"import os\n",
41+
"import hypercoast"
42+
]
43+
},
44+
{
45+
"cell_type": "markdown",
46+
"metadata": {},
47+
"source": [
48+
"## Specify input data\n",
49+
"\n",
50+
"We will use the following input data:\n",
51+
"\n",
52+
"- EMIT_L1B_RAD_001_20230220T181144_2305112_013.nc\n",
53+
"- EMIT_L1B_OBS_001_20230220T181144_2305112_013.nc\n",
54+
"\n",
55+
"Put the input data in the `data` folder."
56+
]
57+
},
58+
{
59+
"cell_type": "code",
60+
"execution_count": null,
61+
"metadata": {},
62+
"outputs": [],
63+
"source": [
64+
"work_dir = os.path.expanduser(\"~/Downloads\")\n",
65+
"input_dir = os.path.join(work_dir, \"data\")"
66+
]
67+
},
68+
{
69+
"cell_type": "code",
70+
"execution_count": null,
71+
"metadata": {},
72+
"outputs": [],
73+
"source": [
74+
"filepath = os.path.join(input_dir, \"EMIT_L1B_RAD_001_20230220T181144_2305112_013.nc\")"
75+
]
76+
},
77+
{
78+
"cell_type": "markdown",
79+
"metadata": {},
80+
"source": [
81+
"## Download Acolite software"
82+
]
83+
},
84+
{
85+
"cell_type": "code",
86+
"execution_count": null,
87+
"metadata": {},
88+
"outputs": [],
89+
"source": [
90+
"acolite_dir = hypercoast.download_acolite(work_dir)\n",
91+
"print(f\"Acolite directory: {acolite_dir}\")"
92+
]
93+
},
94+
{
95+
"cell_type": "markdown",
96+
"metadata": {},
97+
"source": [
98+
"## Run Acolite"
99+
]
100+
},
101+
{
102+
"cell_type": "code",
103+
"execution_count": null,
104+
"metadata": {},
105+
"outputs": [],
106+
"source": [
107+
"out_dir = os.path.join(work_dir, \"output\")"
108+
]
109+
},
110+
{
111+
"cell_type": "code",
112+
"execution_count": null,
113+
"metadata": {},
114+
"outputs": [],
115+
"source": [
116+
"hypercoast.run_acolite(\n",
117+
" acolite_dir=acolite_dir,\n",
118+
" input_file=filepath,\n",
119+
" out_dir=out_dir,\n",
120+
" l2w_parameters=\"Rrs_*\",\n",
121+
" rgb_rhot=True,\n",
122+
" rgb_rhos=True,\n",
123+
" map_l2w=True,\n",
124+
")"
125+
]
126+
},
127+
{
128+
"cell_type": "markdown",
129+
"metadata": {},
130+
"source": [
131+
"## Batch processing\n",
132+
"\n",
133+
"To process multiple images, put all the images in a folder. For example, unzip all the images in the `data` folder. Then, run the following code to make sure that all image folders are listed."
134+
]
135+
},
136+
{
137+
"cell_type": "code",
138+
"execution_count": null,
139+
"metadata": {},
140+
"outputs": [],
141+
"source": [
142+
"input_files = [os.path.join(input_dir, f) for f in os.listdir(input_dir) if \"RAD\" in f]\n",
143+
"input_files"
144+
]
145+
},
146+
{
147+
"cell_type": "markdown",
148+
"metadata": {},
149+
"source": [
150+
"Run the following code to process all images in the `data` folder."
151+
]
152+
},
153+
{
154+
"cell_type": "code",
155+
"execution_count": null,
156+
"metadata": {},
157+
"outputs": [],
158+
"source": [
159+
"hypercoast.run_acolite(\n",
160+
" acolite_dir=acolite_dir,\n",
161+
" input_file=input_files,\n",
162+
" out_dir=out_dir,\n",
163+
" l2w_parameters=\"Rrs_*\",\n",
164+
" rgb_rhot=True,\n",
165+
" rgb_rhos=True,\n",
166+
" map_l2w=True,\n",
167+
")"
168+
]
169+
}
170+
],
171+
"metadata": {
172+
"kernelspec": {
173+
"display_name": "hyper",
174+
"language": "python",
175+
"name": "python3"
176+
},
177+
"language_info": {
178+
"codemirror_mode": {
179+
"name": "ipython",
180+
"version": 3
181+
},
182+
"file_extension": ".py",
183+
"mimetype": "text/x-python",
184+
"name": "python",
185+
"nbconvert_exporter": "python",
186+
"pygments_lexer": "ipython3",
187+
"version": "3.10.16"
188+
}
189+
},
190+
"nbformat": 4,
191+
"nbformat_minor": 2
192+
}

Diff for: mkdocs.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ plugins:
5353
execute_ignore:
5454
[
5555
"acolite.ipynb",
56+
"acolite_emit.ipynb",
5657
"search_data.ipynb",
5758
"ecostress.ipynb",
5859
"aviris.ipynb",
@@ -61,7 +62,7 @@ plugins:
6162
"temperature.ipynb",
6263
"pace_oci_l1.ipynb",
6364
"chla_predict.ipynb",
64-
"_earthaccess.ipynb"
65+
"_earthaccess.ipynb",
6566
]
6667

6768
markdown_extensions:
@@ -93,6 +94,7 @@ nav:
9394
- Examples:
9495
- examples/overview.md
9596
- examples/acolite.ipynb
97+
- examples/acolite_emit.ipynb
9698
- examples/search_data.ipynb
9799
- examples/image_cube.ipynb
98100
- examples/image_slicing.ipynb

0 commit comments

Comments
 (0)