-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2025-02-05-PangeoShowcase.html
500 lines (464 loc) · 16 KB
/
2025-02-05-PangeoShowcase.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>High-performance Python STAC tooling, backed by Rust</title>
<link rel="stylesheet" href="dist/reset.css" />
<link rel="stylesheet" href="dist/reveal.css" />
<link rel="stylesheet" href="dist/theme/devseed.css" />
<!-- Theme used for syntax highlighted code -->
<link rel="stylesheet" href="plugin/highlight/monokai.css" />
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h2>High-performance Python STAC tooling, backed by Rust</h2>
<p>
<img src="img/STAC-04.png" height="128px" />
<br />
🐍 🤝 🦀
</p>
<p>
<small>
<a href="https://www.gadom.ski/">Pete Gadomski</a> is a geospatial
engineer at
<a href="https://developmentseed.org/">Development Seed</a>
</small>
</p>
</section>
<section>
<section>
<h2>STAC</h2>
<img class="r-stretch" src="img/stac-entities.excalidraw.png" />
</section>
<section>
<h2>Usage</h2>
<img class="r-stretch" src="img/stac-usage.excalidraw.png" />
</section>
<section>
<blockquote>STAC's sweet spot is L1 to L2</blockquote>
<p>— me</p>
</section>
<section data-markdown>
<textarea data-template>
<!-- .slide: style="font-size: medium" -->
## Tools (Python)
| Repository | Description | 👩🍳 |💁♂️ | 😋️ |
| -- | -- | -- | -- | -- |
| [pystac](https://github.com/stac-utils/pystac) | Python library for working with any SpatioTemporal Asset Catalog (STAC) | ✅ | ✅ | ✅ |
| [stactools](https://github.com/stac-utils/stactools) | Command line utility and Python library for STAC | ✅ | | |
| [stac-fastapi](https://github.com/stac-utils/stac-fastapi) | STAC API implementation with FastAPI. | | ✅ | |
| [stac-pydantic](https://github.com/stac-utils/stac-pydantic) | Pydantic data models for the STAC spec | | ✅ | |
| [stac-geoparquet](https://github.com/stac-utils/stac-geoparquet) | Convert STAC items between JSON, GeoParquet, pgstac, and Delta Lake. | | ✅ | ✅ |
| [pystac-client](https://github.com/stac-utils/pystac-client) | Python client for searching STAC APIs | | | ✅ |
| [odc-stac](https://github.com/opendatacube/odc-stac) | Load STAC items into xarray Datasets. | | | ✅ |
| [stackstac](https://github.com/gjoseph92/stackstac) | Turn a STAC catalog into a dask-based xarray | | | ✅ |
| etc... | | | | |
https://github.com/stac-utils/ et al
</textarea
>
</section>
</section>
<section>
<section>
<h2>Issues</h2>
</section>
<section>
<p>Original libraries (e.g. pystac) must move slowly</p>
<img src="img/pystac-used-by.png" />
</section>
<section>
<p>Building for <br /></p>
<table>
<tr>
<td>data providers 👩🍳</td>
<td>developers 💁♂️</td>
<td>data users 😋</td>
</tr>
</table>
<p>requires different strategies and methods</p>
</section>
<section>
<p>Sometimes (but not always) performance matters</p>
<pre>
<code style="font-size: large" data-trim class="language-shell">
$ curl -s https://landsatlook.usgs.gov/stac-server/search | jq .numberMatched
45955446
</code>
</pre>
</section>
</section>
<section>
<section>
<h2>"Strategy"</h2>
<ol>
<li>Build lots of small, bespoke libraries</li>
<li>Stitch them together</li>
<li>...</li>
<li>Don't profit?! (it's open source, after all)</li>
</ol>
</section>
</section>
<section>
<section>
<h2>stac-geoparquet</h2>
<img
src="img/geoparquet-size-chart.excalidraw.png"
class="r-stretch"
/>
<table style="font-size: large">
<thead>
<tr>
<th>Format</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td>json</td>
<td>21 MB</td>
</tr>
<tr>
<td>json.gz</td>
<td>614 kB</td>
</tr>
<tr>
<td>parquet</td>
<td>488 kB</td>
</tr>
<tr>
<td>parquet (compressed)</td>
<td>179 kB</td>
</tr>
</tbody>
</table>
<p style="font-size: large">1000 sentinel-2 items</p>
</section>
<section>
<h2>stacrs</h2>
<pre>
<code style="font-size: large" data-trim>
$ python -m pip install stacrs
</code></pre>
<pre><code data-trim style="font-size: large;" class="language-python">
items = stacrs.search(
"https://landsatlook.usgs.gov/stac-server",
collections="landsat-c2l2-sr",
intersects={"type": "Point", "coordinates": [-105.119, 40.173]},
sortby="-properties.datetime",
max_items=1000,
)
stacrs.write("items.parquet", items)
</code>
</pre>
<p>
<a href="https://github.com/gadomski/stacrs">gadomski/stacrs</a>
</p>
</section>
<section>
<h2>stacrs-cli</h2>
<pre>
<code style="font-size: large" data-trim class="language-shell">
$ python -m pip install stacrs-cli
$ stacrs search https://landsatlook.usgs.gov/stac-server/search --max-items 1000 \
| stacrs translate - items.parquet
</code>
</pre>
<p>
<a href="https://github.com/stac-utils/stac-rs"
>stac-utils/stac-rs</a
>
</p>
</section>
<section>
<h2>stac-fastapi-geoparquet</h2>
<p>👷♂️</p>
<p>Coming March 2025...</p>
</section>
</section>
<section>
<section>
<h2>cql2</h2>
<blockquote
class="bluesky-embed"
data-bluesky-uri="at://did:plc:gwget3q2rpmjd3pj7h6xloxc/app.bsky.feed.post/3lfbfrtut6s26"
data-bluesky-cid="bafyreifwgzj6q6uypb6xizjv3xshgce3qqoxpvwaa7czassyzmb5hwrfum"
>
<p lang="en">
we need more CQL2 STAC examples in the wild, feels very sparse -
and not even clear on easy way for a user to know if said API
supports CQL2
</p>
— Alex (<a
href="https://bsky.app/profile/did:plc:gwget3q2rpmjd3pj7h6xloxc?ref_src=embed"
>@wildintellect.com</a
>)
<a
href="https://bsky.app/profile/did:plc:gwget3q2rpmjd3pj7h6xloxc/post/3lfbfrtut6s26?ref_src=embed"
>January 8, 2025 at 5:19 PM</a
>
</blockquote>
<script
async
src="https://embed.bsky.app/static/embed.js"
charset="utf-8"
></script>
</section>
<section>
<h2>cql2-rs</h2>
<p>CLI</p>
<pre><code data-trim class="language-shell" style="font-size: large;">
$ echo "(\"landsat:scene_id\" = 'LC82030282019133LGN00')" | cql2 -o json
{"op":"=","args":[{"property":"landsat:scene_id"},"LC82030282019133LGN00"]}
</code></pre>
<p>Python</p>
<pre><code data-trim class="language-python" style="font-size: large;">
from cql2 import Expr
expr = Expr("landsat:scene_id = 'LC82030282019133LGN00'")
print(expr.to_json())
print(expr.to_sql())
</code></pre>
</section>
<section>
<h2>Implementations</h2>
<table>
<thead>
<tr>
<th>Backend</th>
<th>Supported?</th>
</tr>
</thead>
<tbody>
<tr>
<td>Postgres (pgstac)</td>
<td>✅</td>
</tr>
<tr>
<td>Elasticsearch</td>
<td>✅</td>
</tr>
<tr>
<td>DuckDB</td>
<td>👷</td>
</tr>
</tbody>
</table>
</section>
</section>
<section>
<section>
<h2>DuckDB</h2>
<p>🦆</p>
</section>
<section>
<h2>stacrs (again)</h2>
<p>CLI</p>
<pre>
<code style="font-size: large" data-trim class="language-shell">
$ stacrs search items.parquet --max-items 1000
</code>
</pre>
<p>Python</p>
<pre>
<code style="font-size: large" data-trim class="language-python">
from stacrs import DuckdbClient
client = DuckdbClient()
item_collection = client.search("items.parquet", ...)
</code>
</pre>
</section>
</section>
<section>
<h2>STAC API search</h2>
<p>"Lingua franca"</p>
<ul>
<li>Datetime(s)</li>
<li>Geometry (or bbox)</li>
<li>cql2</li>
<li>sort</li>
<li>fields</li>
</ul>
</section>
<section>
<section>
<h2>Putting it together</h2>
<img src="img/pepe-silvia.jpg" />
</section>
<section>
<img
src="img/putting-it-together.excalidraw.png"
class="r-stretch"
/>
</section>
<section>
<img src="img/libraries.excalidraw.png" class="r-stretch" />
</section>
<section>
<table style="font-size: medium">
<thead>
<tr>
<th>Repo</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="https://github.com/developmentseed/cql2-rs"
>developmentseed/cql2-rs</a
>
</td>
<td>
Rust library and Python bindings for parsing the OGC CQL2
filter language
</td>
</tr>
<tr>
<td>
<a href="https://github.com/geoarrow/geoarrow-rs"
>geoarrow/geoarrow-rs</a
>
</td>
<td>
GeoArrow in Rust, Python, and JavaScript (WebAssembly) with
vectorized geometry operations
</td>
</tr>
<tr>
<td>
<a
href="https://github.com/apache/arrow-rs/tree/main/object_store"
>object_store</a
>
</td>
<td>
A focused, easy to use, idiomatic, high performance, async
object store library for interacting with object stores.
</td>
</tr>
<tr>
<td>
<a href="https://github.com/stac-utils/stac-rs"
>stac-utils/stac-rs</a
>
</td>
<td>
Tools and libraries for the SpatioTemporal Asset Catalog
(STAC) specification, written in Rust
</td>
</tr>
<tr>
<td>
<a href="https://github.com/gadomski/stacrs"
>gadomski/stacrs</a
>
</td>
<td>
A small no-dependency Python package for STAC, using Rust
under the hood
</td>
</tr>
<tr>
<td>
<a href="https://github.com/stac-utils/pgstacrs"
>stac-utils/pgstacrs</a
>
</td>
<td>Python async API for pgstac, backed by Rust</td>
</tr>
<tr>
<td>
<a href="https://github.com/stac-utils/pystac"
>stac-utils/pystac</a
>
</td>
<td>
Python library for working with any SpatioTemporal Asset
Catalog (STAC)
</td>
</tr>
<tr>
<td>
<a href="https://github.com/stac-utils/pystac-client"
>stac-utils/pystac-client</a
>
</td>
<td>Python client for searching STAC APIs</td>
</tr>
<tr>
<td>
<a href="https://github.com/developmentseed/obstore"
>developmentseed/obstore</a
>
</td>
<td>
The simplest, highest-throughput interface to Amazon S3,
Google Cloud Storage, Azure Storage, and S3-compliant APIs
like Cloudflare R2
</td>
</tr>
<tr>
<td>
<a href="https://github.com/stac-utils/stac-fastapi-pgstac"
>stac-utils/stac-fastapi-pgstac</a
>
</td>
<td>
PostgreSQL backend for stac-fastapi using pgstac
(https://github.com/stac-utils/pgstac)
</td>
</tr>
</tbody>
</table>
</section>
</section>
<section>
<section>
<h2>Rust and Python</h2>
<p>🐍 🤝 🦀</p>
</section>
<section>
<img src="img/json-hydrate-benchmark.png" class="r-stretch" />
</section>
</section>
<section>
<section>
<h2>Closing thoughts</h2>
<img src="img/mountain.jpg" class="r-stretch" />
</section>
<section>
<h2>Fin</h2>
<p>Thank you for your time.</p>
<img src="img/ferris-holding-stac.png" height="200px" />
<p style="font-size: large">
<a href="https://github.com/gadomski/">Github</a> |
<a href="https://bsky.app/profile/gadom.ski">Bluesky</a> |
<a href="https://www.gadom.ski/2025-02-05-PangeoShowcase/"
>These slides</a
>
</p>
</section>
</section>
</div>
</div>
<script src="dist/reveal.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [RevealMarkdown, RevealHighlight, RevealNotes],
});
</script>
</body>
</html>