SateAIs Python SDK and CLI for SAR satellite image analysis
Project description
sateais
日本語 | English
SateAIs の公式 Python SDK および CLI です。SAR 衛星画像の解析 API (船舶検出 / オイルスリック検出 / 新規・消失建物検出 / 時系列変化検出)に プログラムおよびコマンドラインから統一的にアクセスできます。 現在の対応衛星は Sentinel-1 で、今後順次拡張を予定しています。
pip install sateais
本パッケージには、SDK と CLI の両方 が含まれます。
クイックスタート
from sateais import Client
client = Client() # 認証は自動解決
job = client.analyze.ship(scene_id="S1A_IW_GRDH_...")
result = client.jobs.wait(job.job_id) # 完了まで同期 polling
print(len(result["features"]), "ships detected")
sateais login --api-key sk_live_xxxxx
sateais analyze ship --scene-id S1A_IW_GRDH_... --wait -o ships.geojson
認証
API キーは SateAIs コンソール で発行できます。
優先度: api_key 引数 > 環境変数 SATEAIS_API_KEY > ~/.sateais/credentials
sateais login --api-key sk_live_xxxxx # → ~/.sateais/credentials (0600)
# または
export SATEAIS_API_KEY=sk_live_xxxxx
SDK
解析メソッド
| メソッド | 入力パターン |
|---|---|
client.analyze.ship(...) |
scene_id または polygon+date |
client.analyze.oilslick(...) |
同上 |
client.analyze.newbuilding(...) |
polygon+date_start+date_end |
client.analyze.disappearbuilding(...) |
同上 |
client.analyze.timeseries(...) |
同上 |
詳細パラメータは API リファレンス 参照。
ジョブ管理
job = client.jobs.status(job_id) # 現在の状態を1回取得
geojson = client.jobs.result(job_id) # 完了済ジョブの結果
geojson = client.jobs.wait(
job_id,
poll_interval=10, # 秒
timeout=600, # 秒、None で無限
on_poll=lambda j: print(j.status), # 進捗コールバック
)
例外
| 例外 | 発生条件 |
|---|---|
AuthenticationError |
401 / 403 |
ValidationError |
400 |
InsufficientCreditsError |
402 |
NotFoundError |
404 / 410 |
RateLimitError |
429 |
APIError |
上記以外のHTTPエラー |
JobFailedError |
wait() 中にジョブが failed |
JobTimeoutError |
wait() がタイムアウト |
CredentialsNotFoundError |
APIキーが解決できない |
InvalidAnalysisRequestError |
必須パラメータの組合せ不正 |
CLI
sateais login [--api-key sk_...] # APIキーを保存(省略時はプロンプト)
sateais analyze <endpoint> [options] [--wait] [-o FILE]
sateais jobs status <job_id>
sateais jobs result <job_id> [-o FILE]
sateais jobs wait <job_id> [-o FILE] [--poll-interval N] [--timeout N]
パラメータを JSON でまとめて渡す
analyze の解析パラメータは個別フラグの代わりに --json でまとめて指定できます。
個別フラグを併用した場合は、フラグ側の値が JSON の値を上書きします。
# JSON 文字列で指定
sateais analyze ship --json '{"scene_id": "S1A_IW_GRDH_..."}'
# ファイルから読み込む(@ プレフィクス)
sateais analyze timeseries --json @params.json
# 標準入力から読み込む(-)
cat params.json | sateais analyze newbuilding --json -
# JSON をベースに一部だけフラグで上書き
sateais analyze ship --json @base.json --scene-id S1A_OTHER
JSON に指定できるキー: satellite_id / scene_id / polygon / date /
date_start / date_end / date_direction / orbit_direction。
未知のキーはエラーになります。
終了コード
| コード | 意味 |
|---|---|
| 0 | 成功 |
| 1 | 一般エラー(引数不正など) |
| 2 | ジョブが failed |
| 3 | wait タイムアウト |
| 4 | 認証エラー(401/403、APIキー欠落) |
| 5 | クレジット不足(402) |
| 6 | その他 4xx |
| 7 | サーバーエラー(5xx) |
| 130 | Ctrl-C |
アーキテクチャ
軽量 Hexagonal 構成。HTTP 通信のみ ApiClient Protocol で抽象化されており、
テストや代替 transport で差し替え可能です。
__init__.py
↓
_client.py , cli.py ← Client ファサード / CLI
↓
_http.py ← ApiClient Protocol + HttpApiClient
↓
_types.py , _errors.py ← エンティティ / 例外
詳細は docs/ARCHITECTURE.md、開発者向けは docs/CONTRIBUTING.md。
サポート
技術的なお問い合わせは console-support@spcsft.com までご連絡ください。
ライセンス
MIT — LICENSE 参照。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sateais-0.1.0rc1.tar.gz.
File metadata
- Download URL: sateais-0.1.0rc1.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42ecd31d793308cc3de2081f3d81fb3b74219f360cb4dabe385de56166a1be85
|
|
| MD5 |
92eecc697eb691992acb41921fc052fe
|
|
| BLAKE2b-256 |
873d3fba761b69de60bfeee9da65482ebc0c3f04532bb120da332a9b4529ccce
|
Provenance
The following attestation bundles were made for sateais-0.1.0rc1.tar.gz:
Publisher:
publish.yml on spaceshiftinc/sateais-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sateais-0.1.0rc1.tar.gz -
Subject digest:
42ecd31d793308cc3de2081f3d81fb3b74219f360cb4dabe385de56166a1be85 - Sigstore transparency entry: 1848020440
- Sigstore integration time:
-
Permalink:
spaceshiftinc/sateais-py@f76a66748e9734429550c0c598b6c7943bb78636 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/spaceshiftinc
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f76a66748e9734429550c0c598b6c7943bb78636 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sateais-0.1.0rc1-py3-none-any.whl.
File metadata
- Download URL: sateais-0.1.0rc1-py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63afdb0c1e0ccbcebf8da97e99dfe5982c855e28223149695f5d294981ec9c5d
|
|
| MD5 |
7c25fd8188870b2588e214fdce8f5ace
|
|
| BLAKE2b-256 |
77c44796aabdd0de0e034a5a025427829292b8cd63af7a688f67826fb28fdbb2
|
Provenance
The following attestation bundles were made for sateais-0.1.0rc1-py3-none-any.whl:
Publisher:
publish.yml on spaceshiftinc/sateais-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sateais-0.1.0rc1-py3-none-any.whl -
Subject digest:
63afdb0c1e0ccbcebf8da97e99dfe5982c855e28223149695f5d294981ec9c5d - Sigstore transparency entry: 1848020600
- Sigstore integration time:
-
Permalink:
spaceshiftinc/sateais-py@f76a66748e9734429550c0c598b6c7943bb78636 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/spaceshiftinc
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f76a66748e9734429550c0c598b6c7943bb78636 -
Trigger Event:
push
-
Statement type: