Skip to Content
cwa
Guides

Astronomy

Sunrise, sunset, moonrise and moonset for each county.

cwa.astronomy.sun() and moon() return a county’s times for one date. date defaults to today in Taiwan.

from datetime import date

import cwa

sun = cwa.astronomy.sun("臺北市", date=date(2026, 12, 1))
print(sun.civil_dawn, sun.rise, sun.transit, sun.set, sun.civil_dusk)

moon = cwa.astronomy.moon("花蓮縣")
print(moon.rise, moon.set)

Times are datetime values in Taiwan time. An event that does not happen that day, such as a moonrise, is None. rise_azimuth and set_azimuth are in degrees; transit_altitude is (altitude, "N" or "S").

A sequence of counties returns a mapping keyed by County, fetched in one request.