Skip to content

Commit 41d7014

Browse files
authored
Merge pull request #1 from CU-ESIIL/dusty
Dusty's example
2 parents bb1521b + 180b812 commit 41d7014

4 files changed

Lines changed: 688 additions & 10 deletions

File tree

445 KB
Loading

docs/index.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,9 @@ Long term:
209209

210210
## Findings at a glance 📣 { #findings-at-a-glance .oasis-report-out-section .oasis-report-out-day3 }
211211

212-
Headline 1 — what, where, how much
212+
- **Headline 1**: Embedding space similarity could be useful for selecting control/comparison sites in natural experiments
213213

214-
...
215-
216-
Headline 2 — change/trend/contrast
217-
218-
...
219-
220-
Headline 3 — implication for practice or policy
221-
222-
...
214+
![dusty image](assets/figures/burn_site_similarity.png)
223215

224216
## Visuals that tell a story 📣 { #story-visuals .oasis-report-out-section .oasis-report-out-day3 }
225217

notebooks/dusty_get_aee.ipynb

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "6101af59",
6+
"metadata": {},
7+
"source": [
8+
"This notebook documents the process of saving the AlphaEarth embeddings to Google Drive as a GeoTIFF. I then downloaded it locally, or one can use `rclone` to get it to CyVerse."
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": null,
14+
"id": "4d1f03e6",
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"import ee"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": 7,
24+
"id": "0a176cc8",
25+
"metadata": {},
26+
"outputs": [
27+
{
28+
"data": {
29+
"text/plain": [
30+
"True"
31+
]
32+
},
33+
"execution_count": 7,
34+
"metadata": {},
35+
"output_type": "execute_result"
36+
}
37+
],
38+
"source": [
39+
"\n",
40+
"ee.Authenticate()"
41+
]
42+
},
43+
{
44+
"cell_type": "code",
45+
"execution_count": 9,
46+
"id": "b89fe45e",
47+
"metadata": {},
48+
"outputs": [],
49+
"source": [
50+
"ee.Initialize(project=\"embeddings-test-496221\")"
51+
]
52+
},
53+
{
54+
"cell_type": "code",
55+
"execution_count": 13,
56+
"id": "de5e0079",
57+
"metadata": {},
58+
"outputs": [
59+
{
60+
"name": "stdout",
61+
"output_type": "stream",
62+
"text": [
63+
"AOI area (km²): 149.73898314571272\n"
64+
]
65+
}
66+
],
67+
"source": [
68+
"# Bounding box: Willamette National Forest / Cascades study area (Oregon)\n",
69+
"aoi = ee.Geometry.BBox(\n",
70+
" west=-122.25240108713064,\n",
71+
" south=44.19136542920598,\n",
72+
" east=-122.07249996408376,\n",
73+
" north=44.28532650370888,\n",
74+
")\n",
75+
"\n",
76+
"print(\"AOI area (km²):\", aoi.area(maxError=1).divide(1e6).getInfo())"
77+
]
78+
},
79+
{
80+
"cell_type": "code",
81+
"execution_count": 29,
82+
"id": "4f9c2143",
83+
"metadata": {},
84+
"outputs": [
85+
{
86+
"name": "stdout",
87+
"output_type": "stream",
88+
"text": [
89+
"Embedding image bands: ['A00', 'A01', 'A02', 'A03', 'A04', 'A05', 'A06', 'A07', 'A08', 'A09', 'A10', 'A11', 'A12', 'A13', 'A14', 'A15', 'A16', 'A17', 'A18', 'A19', 'A20', 'A21', 'A22', 'A23', 'A24', 'A25', 'A26', 'A27', 'A28', 'A29', 'A30', 'A31', 'A32', 'A33', 'A34', 'A35', 'A36', 'A37', 'A38', 'A39', 'A40', 'A41', 'A42', 'A43', 'A44', 'A45', 'A46', 'A47', 'A48', 'A49', 'A50', 'A51', 'A52', 'A53', 'A54', 'A55', 'A56', 'A57', 'A58', 'A59', 'A60', 'A61', 'A62', 'A63']\n"
90+
]
91+
}
92+
],
93+
"source": [
94+
"# AlphaEarth embedding ImageCollection\n",
95+
"# Verify the asset path matches what you have access to — common paths:\n",
96+
"# 'projects/alpha-earth/embeddings/v1'\n",
97+
"# 'projects/sat-io/open-datasets/alpha-earth/...'\n",
98+
"ALPHA_EARTH_ASSET = 'GOOGLE/SATELLITE_EMBEDDING/V1/ANNUAL'\n",
99+
"\n",
100+
"embeddings = ee.ImageCollection(ALPHA_EARTH_ASSET) \\\n",
101+
" .filterDate('2022-01-01', '2023-07-31') \\\n",
102+
" .filterBounds(aoi) \\\n",
103+
" .mosaic() \\\n",
104+
" .clip(aoi)\n",
105+
"\n",
106+
"\n",
107+
"print(\"Embedding image bands:\", embeddings.bandNames().getInfo())"
108+
]
109+
},
110+
{
111+
"cell_type": "code",
112+
"execution_count": 34,
113+
"id": "5d9a78a8",
114+
"metadata": {},
115+
"outputs": [
116+
{
117+
"name": "stdout",
118+
"output_type": "stream",
119+
"text": [
120+
"Export task submitted: 4SKCKE6O4NVUCJ2H3B35M4RL\n"
121+
]
122+
}
123+
],
124+
"source": [
125+
"task = ee.batch.Export.image.toDrive(\n",
126+
" image=embeddings,\n",
127+
" description='hja_alpha_earth',\n",
128+
" folder='alpha_earth',\n",
129+
" fileNamePrefix='hja_all_2022',\n",
130+
" region=aoi,\n",
131+
" scale=10,\n",
132+
" crs='EPSG:4326',\n",
133+
" maxPixels=1e9,\n",
134+
" fileFormat='GeoTIFF',\n",
135+
")\n",
136+
"task.start()\n",
137+
"print(\"Export task submitted:\", task.id)"
138+
]
139+
},
140+
{
141+
"cell_type": "markdown",
142+
"id": "01551e90",
143+
"metadata": {},
144+
"source": [
145+
"Can monitor tasks at https://code.earthengine.google.com/tasks"
146+
]
147+
}
148+
],
149+
"metadata": {
150+
"kernelspec": {
151+
"display_name": ".venv-dusty (3.14.3)",
152+
"language": "python",
153+
"name": "python3"
154+
},
155+
"language_info": {
156+
"codemirror_mode": {
157+
"name": "ipython",
158+
"version": 3
159+
},
160+
"file_extension": ".py",
161+
"mimetype": "text/x-python",
162+
"name": "python",
163+
"nbconvert_exporter": "python",
164+
"pygments_lexer": "ipython3",
165+
"version": "3.14.3"
166+
}
167+
},
168+
"nbformat": 4,
169+
"nbformat_minor": 5
170+
}

notebooks/dusty_site_selection2.ipynb

Lines changed: 516 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)