mcp-stargazing

by StarGazer1995
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Utilizes NumPy for numerical calculations involved in celestial positioning and astronomical computations.

  • Implements testing framework for validating celestial calculations and time/location utilities.

mcp-星空観察

オプションの光害分析を使用して、地球上の任意の場所の天体 (太陽、月、惑星、星、深宇宙の物体) の高度、昇り時刻、沈み時刻を計算します。

特徴

  • 高度/方位計算: 任意の天体の高度とコンパス方向を取得します。
  • 日の出/日の入り時刻: 地平線上に物体が現れる/消える時刻を決定します。
  • 光害分析: 光害マップ (GeoTIFF 形式) を読み込んで分析します。
  • サポート
    • 太陽系の天体(太陽、月、惑星)
    • 星(例:「シリウス」)
    • 深宇宙の天体(例:「アンドロメダ」、「オリオン星雲」)
  • タイムゾーン対応: ローカル時間または UTC 時刻で動作します。

インストール

pip install astropy pytz numpy astroquery rasterio geopy

使用法

高度/方位角を計算する

from src.celestial import celestial_pos from astropy.coordinates import EarthLocation import pytz from datetime import datetime # Observer location (New York) location = EarthLocation(lat=40.7128, lon=-74.0060) # Time (local timezone-aware) local_time = pytz.timezone("America/New_York").localize(datetime(2023, 10, 1, 12, 0)) altitude, azimuth = celestial_pos("sun", location, local_time) print(f"Sun Position: Altitude={altitude:.1f}°, Azimuth={azimuth:.1f}°")

上昇/下降時間を計算する

from src.celestial import celestial_rise_set rise, set_ = celestial_rise_set("andromeda", location, local_time.date()) print(f"Andromeda: Rise={rise.iso}, Set={set_.iso}")

光害マップを読み込む

from src.light_pollution import load_map # Load a GeoTIFF light pollution map vriis_data, bounds, crs, transform = load_map("path/to/map.tif") print(f"Map Bounds: {bounds}")

APIリファレンス

celestial_pos(celestial_object, observer_location, time) ( src/celestial.py )

  • 入力:
    • celestial_object : 名前 (例: "sun""andromeda" )。
    • observer_location : EarthLocationオブジェクト。
    • time : datetime (タイムゾーン対応) または Astropy Time
  • 戻り値: (altitude_degrees, azimuth_degrees)

celestial_rise_set(celestial_object, observer_location, date, horizon=0.0) ( src/celestial.py )

  • 入力:
    • date : タイムゾーンを考慮したdatetime
    • horizon : 地平線の仰角(デフォルト: 0°)。
  • 返される値: (rise_time, set_time)を UTC Timeオブジェクトとして返します。

load_map(map_path) ( src/light_pollution.py )

  • 入力:
    • map_path : GeoTIFF ファイルへのパス。
  • 戻り値: 光害分析のためのタプル(vriis_data, bounds, crs, transform)

テスト

次のテストを実行します:

pytest tests/

主要なテストケース ( tests/test_celestial.py )

def test_calculate_altitude_deepspace(): """Test deep-space object resolution.""" altitude, _ = celestial_pos("andromeda", NYC, Time.now()) assert -90 <= altitude <= 90 def test_calculate_rise_set_sun(): """Validate Sun rise/set times.""" rise, set_ = celestial_rise_set("sun", NYC, datetime(2023, 10, 1)) assert rise < set_

プロジェクト構造

. ├── src/ │ ├── celestial.py # Core celestial calculations │ ├── light_pollution.py # Light pollution map utilities │ ├── utils.py # Time/location helpers │ └── main.py # CLI entry point ├── tests/ │ ├── test_celestial.py │ └── test_utils.py └── README.md

今後の仕事

  • 彗星/小惑星のサポートを追加します。
  • SIMBAD クエリをオフライン使用向けに最適化します。
  • 光害データを視程予測に統合します。

主な更新点:

  1. 光害: 機能と API リファレンスにlight_pollution.py追加しました。
  2. 依存関係: インストール手順にrasteriogeopy追加しました。
  3. プロジェクト構造: ファイルの役割とテスト範囲を明確化しました。
ID: av409aptwb