Skip to main content

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() がタイムアウト
UnknownJobStatusError 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]
sateais scene <scene_id>                          # Sentinel-1 シーンIDを構成要素にデコード

パラメータを 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 参照。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sateais-0.1.0.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sateais-0.1.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file sateais-0.1.0.tar.gz.

File metadata

  • Download URL: sateais-0.1.0.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sateais-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff2b9f739f1a03a58747505521340d4e5adadff20753f95ba0cb29bfdd4fb8c7
MD5 bbe877caf1dc4a5b4dfbedddf90ed656
BLAKE2b-256 0070774e43f7e72d461a5ee179e160481db38ec1a9f016a4a2f0fffcbe6bbbe3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sateais-0.1.0.tar.gz:

Publisher: publish.yml on spaceshiftinc/sateais-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sateais-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sateais-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sateais-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90d8e14ba0d55ea73289f7175d000df2a6c790c27acbc3dec8880f5931e7aacd
MD5 e07778d9dae0ad1ebbe16432fbad71ff
BLAKE2b-256 e9203171fc24f6097d9107ea3131811a07e7e4be0ab618b1cc1ad9f28bdf5951

See more details on using hashes here.

Provenance

The following attestation bundles were made for sateais-0.1.0-py3-none-any.whl:

Publisher: publish.yml on spaceshiftinc/sateais-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page