opera-rs 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. opera_rs-0.1.0/Cargo.toml +25 -0
  2. opera_rs-0.1.0/LICENSE +21 -0
  3. opera_rs-0.1.0/NOTICE +22 -0
  4. opera_rs-0.1.0/PKG-INFO +61 -0
  5. opera_rs-0.1.0/README.md +36 -0
  6. opera_rs-0.1.0/crates/opera-cli/Cargo.toml +26 -0
  7. opera_rs-0.1.0/crates/opera-cli/README.md +139 -0
  8. opera_rs-0.1.0/crates/opera-cli/src/lib.rs +1662 -0
  9. opera_rs-0.1.0/crates/opera-cli/src/main.rs +3 -0
  10. opera_rs-0.1.0/crates/opera-cli/src/mcp.rs +1281 -0
  11. opera_rs-0.1.0/crates/opera-cli/src/usage.rs +208 -0
  12. opera_rs-0.1.0/crates/opera-cli/tests/mcp.rs +157 -0
  13. opera_rs-0.1.0/crates/opera-rs/Cargo.toml +36 -0
  14. opera_rs-0.1.0/crates/opera-rs/README.md +139 -0
  15. opera_rs-0.1.0/crates/opera-rs/src/analysis.rs +1086 -0
  16. opera_rs-0.1.0/crates/opera-rs/src/cmr.rs +1107 -0
  17. opera_rs-0.1.0/crates/opera-rs/src/error.rs +47 -0
  18. opera_rs-0.1.0/crates/opera-rs/src/flood_extent.rs +990 -0
  19. opera_rs-0.1.0/crates/opera-rs/src/geo_io.rs +401 -0
  20. opera_rs-0.1.0/crates/opera-rs/src/geocode.rs +196 -0
  21. opera_rs-0.1.0/crates/opera-rs/src/lib.rs +81 -0
  22. opera_rs-0.1.0/crates/opera-rs/src/products.rs +639 -0
  23. opera_rs-0.1.0/crates/opera-rs/src/titiler.rs +702 -0
  24. opera_rs-0.1.0/crates/opera-rs/src/types.rs +432 -0
  25. opera_rs-0.1.0/crates/opera-rs/src/viz.rs +946 -0
  26. opera_rs-0.1.0/pyproject.toml +52 -0
  27. opera_rs-0.1.0/python/Cargo.lock +2099 -0
  28. opera_rs-0.1.0/python/Cargo.toml +23 -0
  29. opera_rs-0.1.0/python/LICENSE +21 -0
  30. opera_rs-0.1.0/python/NOTICE +22 -0
  31. opera_rs-0.1.0/python/README.md +36 -0
  32. opera_rs-0.1.0/python/opera_rs/__init__.py +359 -0
  33. opera_rs-0.1.0/python/opera_rs/__main__.py +23 -0
  34. opera_rs-0.1.0/python/src/lib.rs +569 -0
  35. opera_rs-0.1.0/python/tests/test_smoke.py +168 -0
@@ -0,0 +1,25 @@
1
+ [workspace]
2
+ resolver = "3"
3
+ members = ["crates/opera-rs", "crates/opera-cli"]
4
+ exclude = ["python"]
5
+
6
+ [workspace.package]
7
+ version = "0.1.0"
8
+ edition = "2024"
9
+ license = "MIT"
10
+ rust-version = "1.90"
11
+ repository = "https://github.com/opengeos/opera-rs"
12
+ authors = ["Qiusheng Wu <giswqs@gmail.com>"]
13
+
14
+ [workspace.dependencies]
15
+ opera-rs = { path = "crates/opera-rs", version = "0.1.0" }
16
+ clap = { version = "4", features = ["derive"] }
17
+ gif = "0.14"
18
+ png = "0.17"
19
+ rayon = "1.10"
20
+ serde = { version = "1", features = ["derive"] }
21
+ serde_json = "1"
22
+ tempfile = "3"
23
+ terrio = { version = "0.9", default-features = false, features = ["geotiff", "sqlite"] }
24
+ thiserror = "2"
25
+ ureq = { version = "3.5", default-features = false, features = ["rustls", "gzip"] }
opera_rs-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Qiusheng Wu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
opera_rs-0.1.0/NOTICE ADDED
@@ -0,0 +1,22 @@
1
+ opera-rs
2
+ Copyright (c) 2026 Qiusheng Wu
3
+
4
+ This software searches, visualizes, and analyzes NASA OPERA satellite products
5
+ (https://www.jpl.nasa.gov/go/opera) using NASA's public Common Metadata
6
+ Repository (CMR) and titiler-cmr (https://github.com/developmentseed/titiler-cmr).
7
+ It shares design patterns with opengeos/geolibre-nasa-opera, opengeos/lidar-rs,
8
+ and opengeos/terrio.
9
+
10
+ OPERA products are produced by NASA JPL's Observational Products for End-Users
11
+ from Remote Sensing Analysis (OPERA) project and distributed by NASA's PO.DAAC,
12
+ LP DAAC, and ASF DAAC.
13
+
14
+ Third-party crates used directly include:
15
+ - `clap` (https://github.com/clap-rs/clap): MIT OR Apache-2.0
16
+ - `gif` (https://github.com/image-rs/image-gif): MIT OR Apache-2.0
17
+ - `png` (https://github.com/image-rs/image-png): MIT OR Apache-2.0
18
+ - `rayon` (https://github.com/rayon-rs/rayon): MIT OR Apache-2.0
19
+ - `serde` / `serde_json` (https://github.com/serde-rs/serde): MIT OR Apache-2.0
20
+ - `terrio` (https://github.com/opengeos/terrio): MIT AND MPL-2.0 AND Apache-2.0
21
+ - `thiserror` (https://github.com/dtolnay/thiserror): MIT OR Apache-2.0
22
+ - `ureq` (https://github.com/algesten/ureq): MIT OR Apache-2.0
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: opera-rs
3
+ Version: 0.1.0
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Rust
10
+ Classifier: Topic :: Scientific/Engineering :: GIS
11
+ Requires-Dist: pytest>=7 ; extra == 'test'
12
+ Provides-Extra: test
13
+ License-File: LICENSE
14
+ License-File: NOTICE
15
+ Summary: Pure-Rust, agent-centric toolkit for searching, visualizing, and analyzing NASA OPERA satellite data (with CLI and MCP server)
16
+ Keywords: GIS,NASA,OPERA,remote-sensing,satellite,MCP,rust
17
+ Author-email: Qiusheng Wu <giswqs@gmail.com>
18
+ License-Expression: MIT
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
21
+ Project-URL: Homepage, https://github.com/opengeos/opera-rs
22
+ Project-URL: Issues, https://github.com/opengeos/opera-rs/issues
23
+ Project-URL: Repository, https://github.com/opengeos/opera-rs
24
+
25
+ # opera-rs (Python)
26
+
27
+ Python bindings and bundled `opera` CLI / MCP server for [`opengeos/opera-rs`](https://github.com/opengeos/opera-rs), a pure-Rust, agent-centric toolkit for searching, visualizing, and analyzing NASA OPERA satellite products via NASA CMR and `titiler-cmr` (zero GDAL dependencies, no Earthdata login required).
28
+
29
+ ## Install
30
+
31
+ ```sh
32
+ pip install opera-rs
33
+ ```
34
+
35
+ Run the MCP server directly without a permanent install:
36
+
37
+ ```sh
38
+ uvx --from opera-rs opera mcp
39
+ ```
40
+
41
+ ## Quick Start
42
+
43
+ ```python
44
+ import opera_rs
45
+
46
+ # List all 9 NASA OPERA collections
47
+ print([p["short_title"] for p in opera_rs.products()])
48
+
49
+ # Search DSWx-HLS surface water over Tulare Lake, April 2023
50
+ bbox = [-119.95, 35.85, -119.45, 36.25]
51
+ res = opera_rs.search("dswx-hls", bbox=bbox, start="2023-04-20", end="2023-04-30", limit=5)
52
+ print(res["hits"], res["dates"])
53
+
54
+ # Compute 30 m categorical water class areas (km^2)
55
+ st = opera_rs.stats(bbox, product="dswx-hls", start="2023-04-20", end="2023-04-30")
56
+ print(st["bands"]["b1"]["class_breakdown"])
57
+
58
+ # Render a PNG map preview with CARTO basemap, scale bar, and legend
59
+ opera_rs.preview(bbox, product="dswx-hls", start="2023-04-20", end="2023-04-30", water_only=True, output_path="tulare.png")
60
+ ```
61
+
@@ -0,0 +1,36 @@
1
+ # opera-rs (Python)
2
+
3
+ Python bindings and bundled `opera` CLI / MCP server for [`opengeos/opera-rs`](https://github.com/opengeos/opera-rs), a pure-Rust, agent-centric toolkit for searching, visualizing, and analyzing NASA OPERA satellite products via NASA CMR and `titiler-cmr` (zero GDAL dependencies, no Earthdata login required).
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ pip install opera-rs
9
+ ```
10
+
11
+ Run the MCP server directly without a permanent install:
12
+
13
+ ```sh
14
+ uvx --from opera-rs opera mcp
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```python
20
+ import opera_rs
21
+
22
+ # List all 9 NASA OPERA collections
23
+ print([p["short_title"] for p in opera_rs.products()])
24
+
25
+ # Search DSWx-HLS surface water over Tulare Lake, April 2023
26
+ bbox = [-119.95, 35.85, -119.45, 36.25]
27
+ res = opera_rs.search("dswx-hls", bbox=bbox, start="2023-04-20", end="2023-04-30", limit=5)
28
+ print(res["hits"], res["dates"])
29
+
30
+ # Compute 30 m categorical water class areas (km^2)
31
+ st = opera_rs.stats(bbox, product="dswx-hls", start="2023-04-20", end="2023-04-30")
32
+ print(st["bands"]["b1"]["class_breakdown"])
33
+
34
+ # Render a PNG map preview with CARTO basemap, scale bar, and legend
35
+ opera_rs.preview(bbox, product="dswx-hls", start="2023-04-20", end="2023-04-30", water_only=True, output_path="tulare.png")
36
+ ```
@@ -0,0 +1,26 @@
1
+ [package]
2
+ name = "opera-cli"
3
+ description = "Command-line interface and Model Context Protocol (MCP) server for searching, visualizing, and analyzing NASA OPERA satellite data"
4
+ readme = "README.md"
5
+ keywords = ["gis", "nasa", "opera", "mcp", "cli"]
6
+ categories = ["science::geo", "command-line-utilities"]
7
+ version.workspace = true
8
+ edition.workspace = true
9
+ license.workspace = true
10
+ rust-version.workspace = true
11
+ repository.workspace = true
12
+ authors.workspace = true
13
+
14
+ [lib]
15
+ name = "opera_cli"
16
+ path = "src/lib.rs"
17
+
18
+ [[bin]]
19
+ name = "opera"
20
+ path = "src/main.rs"
21
+
22
+ [dependencies]
23
+ opera-rs.workspace = true
24
+ clap.workspace = true
25
+ serde_json.workspace = true
26
+ tempfile.workspace = true
@@ -0,0 +1,139 @@
1
+ # opera-rs
2
+
3
+ [![CI](https://github.com/opengeos/opera-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/opengeos/opera-rs/actions/workflows/ci.yml)
4
+ [![crates.io](https://img.shields.io/crates/v/opera-rs.svg)](https://crates.io/crates/opera-rs)
5
+ [![PyPI](https://img.shields.io/pypi/v/opera-rs)](https://pypi.org/project/opera-rs/)
6
+ [![Docs](https://img.shields.io/badge/docs-opera--rs.opengeos.org-teal.svg)](https://opera-rs.opengeos.org)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+
9
+ Pure-Rust, agent-centric toolkit for searching, visualizing, and analyzing [NASA OPERA](https://www.jpl.nasa.gov/go/opera) satellite products (DSWx-HLS, DSWx-S1, DIST-ALERT, DIST-ANN, RTC-S1, CSLC-S1, DISP-S1), powered by [`terrio`](https://github.com/opengeos/terrio), NASA's public CMR API, and [`titiler-cmr`](https://github.com/developmentseed/titiler-cmr) with **zero GDAL dependencies** (`--no-default-features` has zero C/C++ dependencies) and **no Earthdata login required**.
10
+
11
+ **Documentation:** [Installation](https://opera-rs.opengeos.org/installation/) | [CLI](https://opera-rs.opengeos.org/cli/) | [AI Agents (MCP)](https://opera-rs.opengeos.org/mcp/) | [Rust](https://opera-rs.opengeos.org/rust/) | [Python](https://opera-rs.opengeos.org/python/)
12
+
13
+ ## Highlights
14
+
15
+ - **All 9 NASA OPERA products:** `DSWx-HLS`, `DSWx-S1` (cloud-penetrating SAR water), `DIST-ALERT`, `DIST-ANN`, `RTC-S1`, `RTC-S1-STATIC`, `CSLC-S1`, `CSLC-S1-STATIC`, and `DISP-S1`, with built-in categorical colormaps (`B01_WTR`, `--water-only`, `VEG-DIST-STATUS`), band defaults, and `rio-tiler` band-math expression presets (`10*log10(b1)` for SAR dB, water masks).
16
+ - **Public CMR search & place geocoding (`search`, `geocode`):** Paginated NASA CMR UMM-G granule discovery with reprocessed-version deduplication, newest-per-tile filtering, Nominatim place geocoding, and AOI input from `--bbox`, `--place`, or any GeoJSON / GeoPackage / Shapefile (`--aoi-file`, auto-reprojected to WGS 84 via `terrio`).
17
+ - **Backend-aware `titiler-cmr` analytics (`stats`, `point`, `tilejson`):** Supports both `rasterio` (COG/GeoTIFF) and `xarray` (NetCDF/HDF5/Zarr) backends without local Earthdata credentials. Categorical statistics automatically report 30 m class pixel counts, percentages, and surface area in km^2.
18
+ - **Change detection & time-series trends (`change`, `timeseries`):** Find nearest before/after scenes within a search window, compute class area deltas (km^2) or continuous band shifts, export Markdown/CSV reports, and compute OLS temporal trend slopes.
19
+ - **Observed flood-extent vectorization (`flood-extent`):** Union DSWx-HLS and cloud-penetrating DSWx-S1 water-only tiles, stitch into a binary mask, trace boundary rings with nested dry-land holes and RFC 7946 winding, and write polygons to GeoJSON, GeoPackage (`.gpkg`), or Shapefile (`.shp`).
20
+ - **Pure-Rust visualization (`preview`, `animate`, `export-html`):** Render static PNG previews (with CARTO Voyager basemap, categorical legend, metric scale bar, and title banner), side-by-side Before/After comparison PNGs, multi-date animated GIFs, and self-contained interactive MapLibre GL JS HTML viewers.
21
+ - **AI Agents & MCP server (`opera mcp`):** Pure-Rust Model Context Protocol (MCP) server over stdio modeled after `terrio mcp` and `lidar mcp` (`claude mcp add opera -- opera mcp` or zero-install via `uvx --from opera-rs opera mcp`), with automatic Clap tool exposure, inline PNG `preview` image attachments, `--json-usage` command schema, and 4 curated workflow prompts.
22
+ - **Three interfaces, one pure-Rust core:** Rust crate (`opera-rs` on crates.io), standalone CLI & MCP server (`opera-cli` -> `opera` binary), and Python package (`opera-rs` on PyPI, PyO3 ABI3 wheels for Python 3.11+ with bundled `opera` CLI/MCP).
23
+
24
+ ## Supported NASA OPERA Products
25
+
26
+ | Short Name | Alias | Backend | Default Band(s) | Description |
27
+ |---|---|---|---|---|
28
+ | `OPERA_L3_DSWX-HLS_V1` | `dswx-hls` | `rasterio` | `B01_WTR` | 30 m optical surface water extent (HLS) |
29
+ | `OPERA_L3_DSWX-S1_V1` | `dswx-s1` | `rasterio` | `B01_WTR` | 30 m cloud-penetrating SAR surface water (Sentinel-1) |
30
+ | `OPERA_L3_DIST-ALERT-HLS_V1` | `dist-alert` | `rasterio` | `VEG-DIST-STATUS` | Near real-time 30 m land disturbance alerts |
31
+ | `OPERA_L3_DIST-ANN-HLS_V1` | `dist-ann` | `rasterio` | `VEG-DIST-STATUS` | Annual 30 m land disturbance summary |
32
+ | `OPERA_L2_RTC-S1_V1` | `rtc-s1` | `rasterio` | `VV`, `HH` | Radiometric terrain-corrected SAR backscatter |
33
+ | `OPERA_L2_RTC-S1-STATIC_V1` | `rtc-s1-static` | `rasterio` | `local_incidence_angle` | Static incidence angle and mask layers |
34
+ | `OPERA_L2_CSLC-S1_V1` | `cslc-s1` | `xarray` | - | Coregistered Single-Look Complex SAR bursts |
35
+ | `OPERA_L2_CSLC-S1-STATIC_V1` | `cslc-s1-static` | `xarray` | - | Static line-of-sight geometry layers |
36
+ | `OPERA_L3_DISP-S1_V1` | `disp-s1` | `xarray` | - | Line-of-sight surface displacement / subsidence |
37
+
38
+ ## Installation
39
+
40
+ ```sh
41
+ # Prebuilt standalone CLI (Linux / macOS)
42
+ curl -LsSf https://opera-rs.opengeos.org/install.sh | sh
43
+
44
+ # Prebuilt standalone CLI (Windows PowerShell)
45
+ powershell -ExecutionPolicy ByPass -c "irm https://opera-rs.opengeos.org/install.ps1 | iex"
46
+
47
+ # Python package (includes bundled `opera` CLI and `opera mcp`)
48
+ pip install opera-rs
49
+
50
+ # Rust CLI from crates.io
51
+ cargo install opera-cli
52
+ ```
53
+
54
+ ## AI Agents (MCP)
55
+
56
+ Connect `opera mcp` to Claude Code, Claude Desktop, Cursor, or VS Code:
57
+
58
+ ```sh
59
+ # Standalone binary
60
+ claude mcp add opera -- opera mcp
61
+
62
+ # Zero-install via uvx
63
+ claude mcp add opera -- uvx --from opera-rs opera mcp
64
+ ```
65
+
66
+ ## CLI Quick Start
67
+
68
+ ```sh
69
+ # Search DSWx-HLS over Tulare Lake, April 2023 and save footprints as GeoPackage
70
+ opera search --product dswx-hls --bbox -119.95,35.85,-119.45,36.25 \
71
+ --start 2023-04-20 --end 2023-04-30 -o tulare_footprints.gpkg --json
72
+
73
+ # Compute 30 m categorical water class areas (km^2)
74
+ opera stats --product dswx-hls --bbox -119.95,35.85,-119.45,36.25 \
75
+ --start 2023-04-20 --end 2023-04-30
76
+
77
+ # Detect two-date surface water expansion with side-by-side comparison PNG
78
+ opera change --product dswx-hls --bbox -119.95,35.85,-119.45,36.25 \
79
+ --before 2023-01-15 --after 2023-04-30 --preview-out tulare_change.png --markdown
80
+
81
+ # Vectorize observed flood extent (union of DSWx-HLS + DSWx-S1)
82
+ opera flood-extent --place "Valencia Region, Spain" \
83
+ --start 2024-10-27 --end 2024-11-05 -o valencia_flood.geojson
84
+
85
+ # Render a PNG map preview or interactive MapLibre HTML viewer
86
+ opera preview --product dswx-hls --bbox -119.95,35.85,-119.45,36.25 \
87
+ --start 2023-04-20 --end 2023-04-30 --water-only -o tulare.png
88
+ opera export-html --product dswx-hls --bbox -119.95,35.85,-119.45,36.25 \
89
+ --start 2023-04-20 --end 2023-04-30 --water-only -o tulare.html
90
+ ```
91
+
92
+ ## Rust Usage
93
+
94
+ ```toml
95
+ [dependencies]
96
+ opera-rs = "0.1"
97
+ ```
98
+
99
+ ```rust,no_run
100
+ use opera_rs::{BBox, CmrSearchParams, search_granules};
101
+
102
+ fn main() -> opera_rs::Result<()> {
103
+ let bbox = BBox::new(-119.95, 35.85, -119.45, 36.25)?;
104
+ let res = search_granules(&CmrSearchParams {
105
+ product: "dswx-hls".into(),
106
+ bbox: Some(bbox),
107
+ start: Some("2023-04-20".into()),
108
+ end: Some("2023-04-30".into()),
109
+ limit: 10,
110
+ ..Default::default()
111
+ })?;
112
+ println!("Found {} hits across {} dates", res.hits, res.dates.len());
113
+ Ok(())
114
+ }
115
+ ```
116
+
117
+ ## Python Usage
118
+
119
+ ```python
120
+ import opera_rs
121
+
122
+ bbox = [-119.95, 35.85, -119.45, 36.25]
123
+ res = opera_rs.search("dswx-hls", bbox=bbox, start="2023-04-20", end="2023-04-30")
124
+ change = opera_rs.detect_change(bbox, "2023-01-15", "2023-04-30", product="dswx-hls")
125
+ print("Open water delta (km^2):", change["open_water_delta_km2"])
126
+ ```
127
+
128
+ ## Workspace Layout
129
+
130
+ | Path | Description |
131
+ |---|---|
132
+ | `crates/opera-rs` | Pure-Rust core library (published to crates.io as `opera-rs`) |
133
+ | `crates/opera-cli` | Standalone `opera` CLI and MCP server (published to crates.io as `opera-cli`) |
134
+ | `python` | Python bindings (`opera-rs` on PyPI, PyO3) with bundled `opera` CLI and MCP server |
135
+ | `docs` | Zensical documentation site (`opera-rs.opengeos.org`) and installer scripts |
136
+
137
+ ## License
138
+
139
+ `opera-rs` is licensed under the [MIT License](LICENSE). See [NOTICE](NOTICE) for third-party acknowledgments and license attributions.