mcp-별보기
지구상 어느 위치에 있는 천체(태양, 달, 행성, 별, 심우주 천체)의 고도, 일출, 일몰 시간을 계산하며, 선택적으로 광공해 분석도 가능합니다.
특징
- 고도/방위각 계산 : 모든 천체의 고도와 나침반 방향을 구합니다.
- 상승/하강 시간 : 지평선 위에 물체가 나타나거나 사라지는 시점을 결정합니다.
- 광공해 분석 : 광공해 지도(GeoTIFF 형식)를 불러와 분석합니다.
- 지원 :
- 태양계 천체(태양, 달, 행성)
- 별(예: "시리우스")
- 심우주 천체(예: "안드로메다", "오리온 성운")
- 시간대 인식 : 현지 시간 또는 UTC 시간과 함께 작동합니다.
설치
지엑스피1
용법
고도/방위각 계산
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°).
- 반환 : UTC
Time
객체로 (rise_time, set_time)
반환합니다.
load_map(map_path)
( src/light_pollution.py
)
- 입력 :
map_path
: GeoTIFF 파일 경로.
- 반환 : 광공해 분석을 위한 튜플
(vriis_data, bounds, crs, transform)
을 반환합니다.
테스트
다음을 사용하여 테스트를 실행합니다.
주요 테스트 사례( 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 쿼리를 최적화합니다.
- 가시성 예측에 광공해 데이터를 통합합니다.
주요 업데이트:
- 광공해 : 기능 및 API 참조에
light_pollution.py
추가했습니다. - 종속성 : 설치 지침에
rasterio
와 geopy
추가했습니다. - 프로젝트 구조 : 파일 역할과 테스트 범위가 명확해졌습니다.