All Projects → Starainrt → astro

Starainrt / astro

Licence: Apache-2.0 License
自用天文算法,公历农历转换、八大行星位置、日出日落月出月落时间、节气物候时间等

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to astro

go-sunrise
Go package for calculating the sunrise and sunset times for a given location
Stars: ✭ 42 (+27.27%)
Mutual labels:  sunrise, sunset, calendar, astronomy
Daylight-Calendar-ICS
Daylight Calendar is a dynamically generated .ics calendar that you can host and subscribe to in Google Calendar, iCal, or other calendar software.
Stars: ✭ 22 (-33.33%)
Mutual labels:  sunrise, sunset, calendar
suncalc-py
A Python port of suncalc.js for calculating sun position and sunlight phases
Stars: ✭ 31 (-6.06%)
Mutual labels:  sunrise, sunset, sun
KosherCocoa
My Objective-C port of KosherJava. KosherCocoa enables you to perform sunrise-based and sunset-based calculations for Jewish prayer and calendar.
Stars: ✭ 49 (+48.48%)
Mutual labels:  sunrise, sunset, calendar
LunarCalendar
A lightweight macOS App for displaying calendar and time
Stars: ✭ 82 (+148.48%)
Mutual labels:  calendar, lunar, lunar-calendar
rust-sun
A Rust library for calculating sun positions
Stars: ✭ 31 (-6.06%)
Mutual labels:  sunrise, sunset, sun
HackTheSolarSystem
The 5th Annual American Museum of Natural History Hackathon produced by the BridgeUP: STEM program
Stars: ✭ 22 (-33.33%)
Mutual labels:  mars, jupiter, venus
astral
☀️ Go calculations for the position of the sun and moon.
Stars: ✭ 23 (-30.3%)
Mutual labels:  sunrise, sunset
Solar-Calculator
Calculates the sunrise and sunset for a given date and location (using GEO coordinates). This library uses the method outlined NOAA Solar Calculations Day spreadsheet found at http://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html.
Stars: ✭ 36 (+9.09%)
Mutual labels:  sunrise, sunset
sunraster
A SunPy-affiliated package which provides tools to analyze data from spectral data from any solar mission.
Stars: ✭ 19 (-42.42%)
Mutual labels:  sunrise, astronomy
sunrisesunset
🌅 Go package that provides the sunrise and sunset equation
Stars: ✭ 75 (+127.27%)
Mutual labels:  sunrise, sunset
Sunscreen
🌅 A macOS app that sets your wallpaper based on sunrise and sunset.
Stars: ✭ 52 (+57.58%)
Mutual labels:  sunrise, sunset
sun
Simple library and application that shows sunset and sunrise based on your latitude,longitude
Stars: ✭ 23 (-30.3%)
Mutual labels:  sunrise, sunset
lunar-typescript
日历、公历(阳历)、农历(阴历、老黄历)、佛历、道历,支持节假日、星座、儒略日、干支、生肖、节气、节日、彭祖百忌、每日宜忌、吉神宜趋凶煞宜忌、吉神(喜神/福神/财神/阳贵神/阴贵神)方位、胎神方位、冲煞、纳音、星宿、八字、五行、十神、建除十二值星、青龙名堂等十二神、黄道黑道日及吉凶等。lunar is a calendar library for Solar and Chinese Lunar.
Stars: ✭ 62 (+87.88%)
Mutual labels:  calendar, lunar
node-google-calendar
Simple node module that supports Google Calendar API
Stars: ✭ 76 (+130.3%)
Mutual labels:  calendar
bhitte-patro
Google Calendar for Nepali Date
Stars: ✭ 25 (-24.24%)
Mutual labels:  calendar
persian-date-time
Persian Date Time
Stars: ✭ 54 (+63.64%)
Mutual labels:  calendar
wp-event-calendar
The best way to manage events in WordPress
Stars: ✭ 46 (+39.39%)
Mutual labels:  calendar
school2021
ESCAPE Summer School 2021
Stars: ✭ 241 (+630.3%)
Mutual labels:  astronomy
holidata
Holidata is the core of holidata.net, a no-nonsense, ad-free provider of international holiday data.
Stars: ✭ 27 (-18.18%)
Mutual labels:  calendar

astro

用了多年的天文自用代码,最开始用vb写的,后来转成php,最近又转写到golang,代码大多不规范(慢慢改 基本上是参考实现《天文算法》一书中内容,行星算法为vsop87

使用

go get github.com/starainrt/astro

示例

package main

import (
	"fmt"
	"time"

	"github.com/starainrt/astro/star"

	"github.com/starainrt/astro/calendar"
	"github.com/starainrt/astro/venus"

	"github.com/starainrt/astro/moon"
	"github.com/starainrt/astro/sun"
)


func main() {
	cst := time.FixedZone("CST", 8*3600)
	date := time.Date(2020, 1, 1, 8, 8, 8, 8, cst)             //指定2020年1月1日8时8分8秒
	fmt.Println(calendar.ChineseLunar(date))                   //2020年1月1日农历
	fmt.Println(calendar.ChineseLunar(date.AddDate(0, 5, 10))) //2020年06月11日农历(闰月)
	fmt.Println(calendar.Solar(2020, 1, 1, false))             //2020年大年初一对应的公历
	fmt.Println(calendar.JieQi(2020, calendar.JQ_大暑))          //2020年大暑时刻

	fmt.Println(sun.RiseTime(date, 117, 40, 0, true))    //东经117北纬40度海拔0米处日出时刻
	fmt.Println(sun.RiseTime(date, 117, 40, 2000, true)) //东经117北纬40度海拔2000米处日出时刻
	fmt.Println(sun.CulminationTime(date, 117))          //东经117北纬40度太阳中天时刻
	fmt.Println(sun.DownTime(date, 117, 40, 0, true))    //东经117北纬40度海拔0米处日落时刻
	fmt.Println(sun.Zenith(date, 117, 40))               //太阳高度角
	fmt.Println(sun.Azimuth(date, 117, 40))              //太阳方位角
	ra, dec := sun.SeeRaDec(date)                        //太阳天文坐标(赤经赤纬)
	fmt.Println(ra, dec)
	fmt.Println(star.Constellation(ra, dec, date)) //太阳所在星座
	fmt.Println(sun.EarthDistance(date))           //日地距离

	fmt.Println(moon.RiseTime(date, 117, 40, 0, true)) //东经117北纬40度海拔0米处月出时刻
	fmt.Println(moon.DownTime(date, 117, 40, 0, true)) //东经117北纬40度海拔0米处月落时刻
	fmt.Println(moon.Zenith(date, 117, 40))            //月球高度角
	fmt.Println(moon.Azimuth(date, 117, 40))           //月球方位角
	fmt.Println(moon.Phase(date))                      //月相
	ra, dec = moon.SeeRaDec(date, 117, 40)
	fmt.Println(star.Constellation(ra, dec, date)) //月亮所在星座
	fmt.Println(moon.EarthDistance(date))          //日月距离

	fmt.Println(venus.SeeRaDec(calendar.Date2JDE(date))) //金星天文坐标
}

输出如下

12 7 false 腊月初七     //2020年1月1日农历
4 20 true 闰四月二十    //2020年06月11日农历(闰月)
2020-01-25 00:00:00 +0800 CST   //2020年大年初一对应的公历
2020-07-22 16:36:44.143761098 +0800 CST //2020年大暑时刻
2020-01-01 07:33:45.119881331 +0800 CST <nil>  //东经117北纬40度海拔0米处日出时刻
2020-01-01 07:29:26.434018313 +0800 CST <nil>  //东经117北纬40度海拔2000米处日出时刻
2020-01-01 12:15:19.122862815 +0800 CST         //东经117北纬40度太阳中天时刻
2020-01-01 16:56:42.8474316 +0800 CST <nil>   //东经117北纬40度海拔2000米处日落时刻
4.702335599543981   //太阳高度角
125.59379868359358  //太阳方位角
280.8951498494854 -23.05837169975993  //太阳天文坐标(赤经赤纬)
人马座  //太阳所在星座
0.9832929352714874  //日地距离,单位:天文单位(au)


2020-01-01 11:25:59.024749696 +0800 CST <nil>   //东经117北纬40度月出时刻
2020-01-01 22:48:30.492829978  +0800 CST <nil>   //东经117北纬40度月落时刻
-37.1795367151122   //月球高度角
70.09670289513748   //月球方位角
0.3000487434203941  //月相(被照亮的比例)
宝瓶座  //月亮所在星座
404238.68856284436  //日月距离(单位:千米)


317.8537654752149 -18.1404176641921 //金星天文坐标

实现

  1. 太阳坐标、高度角、方位角、中天、晨昏朦影、日出日落、节气
  2. 月亮坐标、高度角、方位角、中天、升落
  3. 地球偏心率、日地距离
  4. 真平恒星时,指定赤经赤纬对应星座
  5. 七大行星坐标、距日、距地距离
  6. 公农历转换
  7. 待续

TODO

  1. 代码规范化
  2. 增加内行星上下合/留/最大距角计算 (2022-03)
  3. 增加外行星冲/合/留计算 (2022-03)
  4. 恒星相关计算 (2022-02)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].