Moon Phase Calculator
任意の日付の現在の月齢、月面照度パーセンテージ、月周期情報を計算します。
このツールについて
月相計算機は、過去から未来のあらゆる日付について、月の現在の位相、照度パーセンテージ、および詳細な月周期情報を提供します。29.5日の月の周期における見かけと位置を理解することは、天文学の愛好家、月暦に従う園芸家、夜間撮影を計画する写真家、そして地球の衛星の動作に興味のある人にとって価値があります。
カレンダーピッカーを使って任意の日付を入力すると、月相の名前、月光面の照度パーセンテージ、現在の周期における日数、および次の満月または新月の日付が即座に表示されます。誕生日の月の見かけを調べたり、天文現象の観測条件を確認したり、植え付けや釣りなどの活動に影響する月周期を追跡したりできます。
この計算機は天文学的アルゴリズムを使用して月の位置を高精度で計算するため、教育プロジェクト、創造的な企画、およびカジュアルな星空観察に適しています。照度のパーセンテージはおおよその値であることに注意してください。実際の視認性はあなたの位置、地域の天候、および夜間の時刻に依存します。
よくある質問
コード実装
import math
from datetime import date, datetime
def calculate_moon_phase(year: int, month: int, day: int) -> dict:
"""
Calculate moon phase using the Conway algorithm.
Returns phase name, illumination percentage, and age in days.
"""
# Julian date calculation
if month <= 2:
year -= 1
month += 12
A = int(year / 100)
B = 2 - A + int(A / 4)
julian = int(365.25 * (year + 4716)) + int(30.6001 * (month + 1)) + day + B - 1524.5
# Days since known new moon (Jan 6, 2000)
known_new_moon = 2451549.5
lunation = 29.53058868
age = (julian - known_new_moon) % lunation
illumination = (1 - math.cos(2 * math.pi * age / lunation)) / 2
# Phase name
phases = [
(0.03, "New Moon"), (0.22, "Waxing Crescent"), (0.28, "First Quarter"),
(0.47, "Waxing Gibbous"), (0.53, "Full Moon"), (0.72, "Waning Gibbous"),
(0.78, "Last Quarter"), (0.97, "Waning Crescent"), (1.00, "New Moon")
]
fraction = age / lunation
phase_name = next(name for threshold, name in phases if fraction <= threshold)
return {
"age_days": round(age, 2),
"illumination_pct": round(illumination * 100, 1),
"phase": phase_name,
"fraction": round(fraction, 4)
}
result = calculate_moon_phase(2024, 1, 15)
print(f"Phase: {result['phase']}")
print(f"Age: {result['age_days']} days")
print(f"Illumination: {result['illumination_pct']}%")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.