コンテンツへスキップ
🛠️ToolsShed

Golden Hour Calculator

位置と日付に基づいて黄金時間と青い時間の写真撮影ウィンドウを検索します。

このツールについて

ゴールデンアワーとは、日の出直後や日の入り直前に太陽が低い位置にあり、あらゆるものを柔らかく暖かな光で包む短い時間帯のことです。一方ブルーアワーは、日の出前や日の入り後に訪れる深い薄明で、空が均一で涼やかな青色に染まります。どちらも、日中の強い光では得られない雰囲気のある美しい画を生むため、写真家に愛されています。本ツールは天文学的な計算式を用いて、任意の日付と場所についてこれらの時間帯がいつ始まりいつ終わるかを正確に割り出します。

使い方は、日付と場所を入力するだけで、日の出と日の入りそれぞれの前後におけるゴールデンアワーとブルーアワーの開始・終了時刻が表示されます。撮影を分単位で計画し、光が最高の状態のうちに現場へ到着したい写真家、映像作家、旅行者のために作られています。

これらの時刻は季節と緯度によって大きく変わるため、おおまかな目安に頼らず、必ずご自身の正確な日付で数値を確認してください。すべての計算はブラウザ内でローカルに行われるため、位置情報がデバイスの外に送信されることは一切ありません。

よくある質問

コード実装

import math
from datetime import datetime, timedelta, timezone

def sun_times(lat: float, lon: float, date: datetime) -> dict:
    """Calculate sunrise, sunset and golden hour times."""
    # Day of year
    N = date.timetuple().tm_yday

    # Mean longitude and anomaly
    L = (280.460 + 0.9856474 * N) % 360
    g = math.radians((357.528 + 0.9856003 * N) % 360)

    # Ecliptic longitude
    lam = math.radians(L + 1.915 * math.sin(g) + 0.020 * math.sin(2 * g))

    # Declination
    decl = math.asin(math.sin(math.radians(23.439)) * math.sin(lam))

    # Hour angle for sunrise/sunset (sun altitude = -0.833°)
    cos_ha = (math.sin(math.radians(-0.833)) - math.sin(math.radians(lat)) * math.sin(decl)) /              (math.cos(math.radians(lat)) * math.cos(decl))

    if abs(cos_ha) > 1:
        return {"error": "Midnight sun or polar night"}

    ha = math.degrees(math.acos(cos_ha))

    # Equation of time correction (simplified)
    B = math.radians(360 / 365 * (N - 81))
    eot = 9.87 * math.sin(2 * B) - 7.53 * math.cos(B) - 1.5 * math.sin(B)

    # Solar noon in minutes from midnight UTC
    solar_noon = 720 - 4 * lon - eot

    sunrise_min = solar_noon - 4 * ha
    sunset_min  = solar_noon + 4 * ha

    # Golden hour bounds: sun at 6° above horizon
    cos_gh = (math.sin(math.radians(6)) - math.sin(math.radians(lat)) * math.sin(decl)) /              (math.cos(math.radians(lat)) * math.cos(decl))
    gh_ha = math.degrees(math.acos(max(-1, min(1, cos_gh))))

    golden_end_morn = solar_noon - 4 * gh_ha
    golden_start_eve = solar_noon + 4 * gh_ha

    def mins_to_str(m):
        h, mn = divmod(int(m), 60)
        return f"{h:02d}:{mn:02d}"

    return {
        "sunrise": mins_to_str(sunrise_min),
        "golden_hour_morning_end": mins_to_str(golden_end_morn),
        "solar_noon": mins_to_str(solar_noon),
        "golden_hour_evening_start": mins_to_str(golden_start_eve),
        "sunset": mins_to_str(sunset_min),
    }

# New York City
result = sun_times(40.7128, -74.0060, datetime(2024, 6, 21))
for k, v in result.items():
    print(f"{k}: {v}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.