feature add:修改恒星数据格式

master
兔子 5 months ago
parent 7a317ff1af
commit dbe0fe1229

@ -12,7 +12,7 @@ import (
// this file contains bright 9100 stars
// 9100颗亮星列表
type starData struct {
type InnerStarData struct {
HR uint16 //Bright Star Number;[1/9110]+ Harvard Revised Number;亮星编号
Name string //Name, generally Bayer(如天狼星Alpha CMA) and/or Flamsteed(如天狼星9 CMA) name
HD uint32 //Henry Draper Catalog Number;HD星表编号
@ -27,7 +27,7 @@ type starData struct {
HIP uint32 //HIP星表编号
}
type StarData struct {
starData
InnerStarData
ChineseName string
ChineseAlias string
ChineseBayerName string
@ -37,9 +37,9 @@ type StarData struct {
CstChinese string
}
func parseStarData(star []byte) (starData, error) {
func parseStarData(star []byte) (InnerStarData, error) {
var err error
var stardata starData
var stardata InnerStarData
if len(star) < 160 {
return stardata, errors.New("invalid stardat")
}
@ -9285,11 +9285,11 @@ func LoadStarData() error {
return nil
}
func fullStarData(star starData) StarData {
func fullStarData(star InnerStarData) StarData {
star.HIP = hr2hip[star.HR]
if info, ok := hr2detail[star.HR]; ok {
return StarData{
starData: star,
InnerStarData: star,
ChineseName: info[0],
ChineseAlias: info[1],
ChineseBayerName: info[2],
@ -9300,7 +9300,7 @@ func fullStarData(star starData) StarData {
}
}
return StarData{starData: star}
return StarData{InnerStarData: star}
}
func StarDataByChinese(name string) (StarData, error) {
@ -9341,7 +9341,7 @@ func StarDataByHR(hr int) (StarData, error) {
return fullStarData(data), nil
}
func (s starData) RaDecByJde(jde float64) (float64, float64) {
func (s InnerStarData) RaDecByJde(jde float64) (float64, float64) {
//计算自行
year := ((jde - 2451545.0) / 365.2422)
return ZuoBiaoSuiCha(s.Ra+(year*s.PmRA/3600), s.Dec+(year*s.PmDec/3600), 2451545.0, jde)

@ -142,7 +142,7 @@ func StarDataByName(name string) (basic.StarData, error) {
// 从亮到暗返回视星等小于3.00的恒星数据
func TopBrightStars() ([]basic.StarData, error) {
var brightStars = make([]basic.StarData, 0, 170)
for _, star := range []int{2491, 2326, 5340, 5459, 7001, 1708, 1713, 2943, 472, 2061, 5267, 7557, 1457, 6134, 5056, 2990, 8728, 4853, 7924, 4730, 5460, 3982, 2618, 6527, 4763, 1790, 1791, 3685, 1903, 4731, 8425, 4905, 3207, 4301, 1017, 2693, 6879, 3307, 5191, 6553, 2088, 6217, 2421, 7790, 3485, 2294, 2891, 3748, 617, 5958, 7121, 424, 188, 1948, 337, 15, 2004, 5288, 6556, 5563, 8636, 936, 4534, 4819, 7796, 3634, 5793, 1852, 168, 6705, 3165, 3699, 603, 21, 5054, 6241, 5469, 5132, 5440, 5953, 4295, 99, 8308, 6580, 8775, 6378, 4554, 8162, 2827, 7949, 264, 8781, 3734, 911, 5231, 4357, 6175, 1865, 4662, 4621, 7194, 5685, 4057, 2095, 5984, 1956, 553, 4786, 5854, 5235, 403, 5571, 4216, 4798, 1577, 6508, 6859, 2773, 5506, 7525, 6056, 6132, 5531, 5028, 4199, 1899, 6603, 6148, 5776, 6536, 1666, 4656, 98, 6913, 3185, 6212, 6165, 4932, 39, 1829, 1203, 6461, 5897, 8502, 591, 8322, 1165, 7528, 2286, 2890, 7264, 6084, 5944, 5671, 1220, 2845, 4915, 8232, 2553, 915, 8650, 1231, 4757, 6510, 8414, 2473, 3873, 6746, 7235, 1605} {
for _, star := range []int{2491, 2326, 5340, 5459, 7001, 1708, 1713, 2943, 472, 2061, 5267, 7557, 1457, 6134, 5056, 2990, 8728, 4853, 7924, 4730, 5460, 3982, 2618, 6527, 4763, 1790, 1791, 3685, 1903, 4731, 8425, 4905, 3207, 4301, 1017, 2693, 6879, 3307, 5191, 6553, 2088, 6217, 2421, 7790, 3485, 2294, 2891, 3748, 617, 7121, 424, 188, 1948, 337, 15, 2004, 5288, 6556, 5563, 8636, 936, 4534, 4819, 7796, 3634, 5793, 1852, 168, 6705, 3165, 3699, 603, 21, 5054, 6241, 5469, 5132, 5440, 5953, 4295, 99, 8308, 6580, 8775, 6378, 4554, 8162, 2827, 7949, 264, 8781, 3734, 911, 5231, 4357, 6175, 1865, 4662, 4621, 7194, 5685, 4057, 2095, 5984, 1956, 553, 4786, 5854, 5235, 403, 5571, 4216, 4798, 1577, 6508, 6859, 2773, 5506, 7525, 6056, 6132, 5531, 5028, 4199, 1899, 6603, 6148, 5776, 6536, 1666, 4656, 98, 6913, 3185, 6212, 6165, 4932, 39, 1829, 1203, 6461, 5897, 8502, 591, 8322, 1165, 7528, 2286, 2890, 7264, 6084, 5944, 5671, 1220, 2845, 4915, 8232, 2553, 915, 8650, 1231, 4757, 6510, 8414, 2473, 3873, 6746, 7235, 1605} {
info, err := basic.StarDataByHR(star)
if err != nil {
return nil, err

Loading…
Cancel
Save