python怎样使用各个日期赤纬_科学网—PyEphem基本功能介绍 - 张金龙的博文
PyEphem为Python下的一个程序包, 用来进行天文历算, 虽然是爱好者编写的, 但是由于使用VOS87行星运动数据, 计算精度达到了很高的精度, 足以满足一般的观测需要。 详情参见 http://rhodesmill.org/pyephem/ 本文是学习该程序包的读书笔记。
火星在2018年的星座import ephem
m = ephem.Mars('2018')
print(ephem.constellation(m))('Lib', 'Libra')
计算不同天体在1970年1月1日0时的位置等信息from ephem import *
mars = Mars('1970') # 火星
print('%s, %s, %.10f' % (mars.name, mars.elong, mars.size))
sun = Sun('1970') # 太阳
print('%s, %s, %.10f' % (sun.name, sun.elong, sun.size))
moon = Moon('1970') # 月亮
print('%s, %s, %.10f' % (moon.name, moon.elong, moon.size))
mercury = Mercury('1970') # 水星
print('%s, %s, %.10f' % (mercury.name, mercury.elong, mercury.size))
venus = Venus('1970') # 金星
print('%s, %s, %.10f' % (venus.name, venus.elong, venus.size))
jupiter = Jupiter('1970') # 木星
print('%s, %s, %.10f' % (jupiter.name, jupiter.elong, jupiter.size))
saturn = Saturn('1970') # 土星
print('%s, %s, %.10f' % (saturn.name, saturn.elong, saturn.size))
uranus = Uranus('1970') # 天王星
print('%s, %s, %.10f' % (uranus.name, uranus.elong, uranus.size))
neptune = Neptune('1970') # 海王星
print('%s, %s, %.10f' % (neptune.name, neptune.elong, neptune.size))
pluto = Pluto('1970') # 冥王星
print('%s, %s , %.10f' % (pluto.name, pluto.elong, pluto.size))Mars, 62:04:48.0, 5.9295825958
Sun, 0:00:00.0, 1951.8359375000
Moon, -89:27:48.3, 1831.0117187500
Mercury, 18:52:17.4, 7.5804867744
Venus, -5:42:32.4, 9.9605798721
Jupiter, -67:50:24.1, 34.2474060059
Saturn, 111:52:32.6, 18.8122367859
Uranus, -91:26:29.1, 3.8586533070
Neptune, -40:17:59.5, 2.1982953548
Pluto, -102:16:48.8 , 0.2606950402### a_ra — Astrometric geocentric right ascension for the epoch specified
### a_dec — Astrometric geocentric declination for the epoch specified
### g_ra and ra — Apparent geocentric right ascension for the epoch-of-date
### g_dec and dec — Apparent geocentric declination for the epoch-of-date
### elong — Elongation (angle to sun)
### mag — Magnitude
### size — Size (diameter in arcseconds)
### radius — Size (radius as an angle)
### circumpolar — whether it stays above the horizon
### neverup — whether is stays below the horizon
############################################
hlon — Heliocentric longitude (see next paragraph)
### hlat — Heliocentric latitude (see next paragraph)
### sun_distance — Distance to Sun (AU)
### earth_distance — Distance to Earth (AU)
### phase — Percent of surface illuminated
已知观测者的位置, 包括 经纬度和海拔, 观测日期和时刻, 求天体的高度和方位gatech = Observer()
gatech.lon = '114.169576'
gatech.lat = '22.451939'
gatech.elevation = 5
gatech.date = '2014/9/22 22:30:00'
v = Venus(gatech)
print('%s, %s' % (v.alt, v.az))11:47:49.3, 89:41:14.6
已知彗星的根数, 计算彗星的亮度和位置, 读取的格式为 xephem格式line = "C/2002 Y1 (Juels-Holvorcem),e,103.7816,166.2194,128.8232,242.5695,
0.0002609,0.99705756,0.0000,04/13.2508/2003,2000,g 6.5,4.0"
yh = ephem.readdb(line)
yh.compute('2007/10/1')
print('%.10f' % yh.earth_distance)
print(yh.mag)14.8046731949
23.96## 已知人造卫星的轨道根数, 计算其在任意时刻的高度和方位### 读取 xephem格式用 readdb 方法
### 写出 xepheme格式, 用 writedb 方法
######### 人造卫星为 tle格式, 这里用readtle方法来阅读
line1 = "ISS (ZARYA)"
line2 = "1 25544U 98067A 03097.78853147 .00021906 00000-0 28403-3 0 8652"
line3 = "2 25544 51.6361 13.7980 0004256 35.6671 59.2566 15.58778559250029"
iss = ephem.readtle(line1, line2, line3)
iss.compute('2003/3/23')
print('%s %s' % (iss.sublong, iss.sublat))-76:24:18.3 13:05:31.1
('Sgr', 'Sagittarius')
50.54
V2 - P274
V2 - P135
V1 - P273
计算月亮在某时刻所在星座m = Moon('1980/6/1')
print(constellation(m))('Sgr', 'Sagittarius')
查询某一赤经赤纬在不同星图中的页码####### Uranometria by Johannes Bayer.
####### Uranometria 2000.0 edited by Wil Tirion.
####### Millennium Star Atlas by Roger W. Sinnott and Michael A. C. Perryman.
ra, dec = '7:16:00', '-6:17:00'print(ephem.uranometria(ra, dec))
print(ephem.uranometria2000(ra, dec))
print(ephem.millennium_atlas(ra, dec))
转换儒略日ephem.julian_date('2000/1/1')
计算 Delta Tprint(ephem.delta_t('1980'))
计算两个物件的角距m1 = ephem.Moon('1970/1/16')
m2 = ephem.Moon('1970/1/17')
s = ephem.separation(m1, m2)
print("In one day the Moon moved %s" % s)In one day the Moon moved 12:33:28.5
坐标系转换np = Equatorial('0', '90', epoch='2000')
g = Galactic(np)
print('%s %s' % (g.lon, g.lat))
#### Equatorial
#### ra — right ascension
#### dec — declination
#### epoch — epoch of the coordinate
#### Ecliptic
#### lon — ecliptic longitude (+E)
#### lat — ecliptic latitude (+N)
#### epoch — epoch of the coordinate
#### Galactic
#### lon — galactic longitude (+E)
#### lat — galactic latitude (+N)
#### epoch — epoch of the coordinate122:55:54.9 27:07:41.7
计算某地点的天象
天体的高度和方位#### Describes a position on Earth’s surface.lowell = ephem.Observer()
lowell.lon = '-111:32.1'
lowell.lat = '35:05.8'
lowell.elevation = 2198
lowell.date = '1986/3/13'
j = ephem.Jupiter()
j.compute(lowell)
print('%s %s' % (j.alt, j.az))
## Attributes can be set:
## date — Date and time
## epoch — Epoch for astrometric RA/dec
## lat — Latitude (+N)
## lon — Longitude (+E)
## elevation — Elevation (m)
## temp — Temperature (°C)
## pressure — Atmospheric pressure (mBar)
## ## The date defaults to now().
## The epoch defaults to '2000'.
## The temp defaults to 25°C.
## The pressure defaults to 1010mBar.
## Other attributes default to zero.0:57:44.7 256:41:01.3
天体的升降与中天时刻############## 内置的城市位置数据
city = city('Beijing')
print('%s %s' % (city.lat, city.lon))
############# 天体的升降和中天
sitka = Observer()
sitka.date = '1999/6/27'
sitka.lat = '57:10'
sitka.lon = '-135:15'm = Mars()
print(sitka.next_transit(m))
print('%s %s' % (m.alt, m.az))
print(sitka.next_rising(m, start='1999/6/28'))
print('%s %s' % (m.alt, m.az))
#### 给定观测者之后, 每个天体可以使用方法 (人造卫星除外)
### previous_transit()
### next_transit()
### previous_antitransit()
### next_antitransit()
### previous_rising()
### next_rising()
### previous_setting()
### next_setting()39:54:15.2 116:24:26.7
1999/6/27 04:22:45
21:18:33.6 180:00:00.0
1999/6/28 23:28:25
-0:00:05.8 111:10:41.6
人造卫星升落和中天时刻等##### 某年某月某日, 某地, 计算人造卫星掠过的时刻
line1 = "IRIDIUM 80 [+]"
line2 = "1 25469U 98051C 09119.61415140 -.00000218 00000-0 -84793-4 0 4781"
line3 = "2 25469 86.4029 183.4052 0002522 86.7221 273.4294 14.34215064557061"
iridium_80 = ephem.readtle(line1, line2, line3)
city.date = '2009/5/1'
info = city.next_pass(iridium_80)
print("Rise time: %s azimuth: %s" % (info[0], info[1]))
#### 返回值的时刻####
0 Rise time####
1 Rise azimuth####
2 Transit time####
3 Transit altitude####
4 Set time####
5 Set azimuth
##############################################Rise time: 2009/5/1 00:45:05 azimuth: 6:13:37.5
计算日出时刻sun = Sun()
greenwich = Observer()
greenwich.lat = '51:28:38'
print(greenwich.horizon)
greenwich.date = '2007/10/1'
r1 = greenwich.next_rising(sun)
greenwich.pressure = 0
greenwich.horizon = '-0:34'
greenwich.date = '2007/10/1'
r2 = greenwich.next_rising(sun)
print('Visual sunrise: %s' % r1)
print('Naval Observatory sunrise: %s' % r2)0:00:00.0
Visual sunrise: 2007/10/1 05:59:30
Naval Observatory sunrise: 2007/10/1 05:59:50
恒星时madrid = ephem.city('Madrid')
madrid.date = '1978/10/3 11:32'
print(madrid.sidereal_time())12:04:28.09
2000/3/20 07:35:17
2000/6/21 01:47:51
Spring lasted 92.8 days
春分, 秋分, 冬至, 夏至的时刻d1 = ephem.next_equinox('2000')
print(d1)
d2 = ephem.next_solstice(d1)
print(d2)
t = d2 - d1
print("Spring lasted %.1f days" % t)
#### 相应的方法
#### previous_solstice()
#### next_solstice()
######## previous_equinox()
#### next_equinox()
######## previous_vernal_equinox()
#### next_vernal_equinox()
月相d1 = ephem.next_full_moon('1984')
print(d1)
d2 = ephem.next_new_moon(d1)
print(d2)
### 朔
### previous_new_moon()
### next_new_moon()
### 上弦月
### previous_first_quarter_moon()
### next_first_quarter_moon()
### 望
### previous_full_moon()
### next_full_moon()
### 下弦月
### previous_last_quarter_moon()
### next_last_quarter_moon()1984/1/18 14:05:10
1984/2/1 23:46:25
角度转换a = ephem.degrees('180:00:00')
print(a)
a
print("180° is %f radians" % a)
h = ephem.hours('1:00:00')
deg = ephem.degrees(h)
print("1h right ascension = %s°" % deg)
## 时间和角度输入
ephem.degrees(ephem.pi / 32)
ephem.degrees('5.625')
ephem.degrees('5:37.5')
ephem.degrees('5:37:30')
ephem.degrees('5:37:30.0')
ephem.hours('0.375')
ephem.hours('0:22.5')
ephem.hours('0:22:30')
ephem.hours('0:22:30.0')180:00:00.0
180° is 3.141593 radians
1h right ascension = 15:00:00.0°#### 日期时间的输入d = ephem.Date('1997/3/9 5:13')
print(d)
d
d.triple()
d.tuple()
d + ephem.hour
print(ephem.date(d + ephem.hour))
print(ephem.date(d + 1))
### 输入日期的格式ephem.Date(35497.7197916667)
ephem.Date('1997/3/10.2197916667')
ephem.Date('1997/3/10 05.275')
ephem.Date('1997/3/10 05:16.5')
ephem.Date('1997/3/10 05:16:30')
ephem.Date('1997/3/10 05:16:30.0')
ephem.Date((1997, 3, 10.2197916667))
ephem.Date((1997, 3, 10, 5, 16, 30.0))1997/3/9 05:13:00
1997/3/9 06:13:00
1997/3/10 05:13:00
35497.71979166667
亮星列表rigel = ephem.star('Rigel')
print('%s %s' % (rigel._ra, rigel._dec))5:14:32.30 -8:12:06.0
城市列表stuttgart = ephem.city('Stuttgart')
print(stuttgart)
print(stuttgart.lon)
epoch='2000/1/1 12:00:00'
lon='9:10:50.8'
lat='48:46:37.6'
elevation=249.205185m
horizon=0:00:00.0
temp=15.0C
pressure=983.6685758505818mBar>
9:10:50.8
天文常量#### PyEphem provides constants for the dates of a few major star-atlas epochs:
#### 不同历元# B1900# B1950# J2000
### PyEphem provides, for reference, the length of four distances, all in meters:
### 天文常量print(ephem.meters_per_au)
print(ephem.earth_radius)
print(ephem.moon_radius)
print(ephem.sun_radius)
#### PyEphem provides the speed of light in meters per second:
## 光速 m/sprint(ephem.c)149597870000.0
6378160.0
1740000.0
695000000.0
299792458.0
转载本文请联系原作者获取授权,同时请注明本文来自张金龙科学网博客。
链接地址:http://blog.sciencenet.cn/blog-255662-829996.html
上一篇:《黑龙江常见野生植物图鉴》出版
下一篇:在频率直方图上添加拟合的曲线-以对数正态分布为例
python怎样使用各个日期赤纬_科学网—PyEphem基本功能介绍 - 张金龙的博文相关推荐
- python 病毒 基因_科学网—RNA病毒基因组组装指南 - 倪帅的博文
从前几年的猪流感和埃博拉,再到上个月在韩国流行的MERS, 病毒的每次爆发都能使全球陷入一阵恐慌,病毒虽然没有真正在全球爆发,但是各国在预防上消耗的资源比在治疗上消耗的还要多.殊不知,病毒是世界上最简 ...
- python 海象运算符_科学网—[转载]海象运算符 := - 龚云国的博文
PEP 572: Assignment Expressions 新增一种新语法形式::=,又称为"海象运算符"(为什么叫海象,看看这两个符号像不像颜表情),如果你用过 Go 语言, ...
- java 处理pdb文件格式_科学网—PDB文件格式说明 - 李继存的博文
2015-06-05 20:31:19 2017-01-22 20:09:21 据参考资料增补 PDB(Protein Data Bank)是一种标准文件格式, 其中包含原子的坐标等信息, 提交给 P ...
- r语言 林元震_科学网—ASReml-R之简介 - 林元震的博文
目前用于遗传分析的主要统计软件有SAS和SPSS等,并已经开发出了包括WOMBAT.MCMCglmm(R语言的程序包)等在内一系列遗传方差组份估计软件.ASReml是一个非常强大的统计软件,由NSW ...
- r语言 林元震_科学网—R语言简介 - 林元震的博文
R既是软件,也是语言,在GNU协议General Public Licence下免费发行,是1995年由新西兰奥克兰大学统计系的Ross Ihaka和Robert Gentleman基于S语言基础上共 ...
- vasp 模拟退火_科学网—vasp的分子动力学模拟 - 王达的博文
vasp做分子动力学的好处,由于vasp是近些年开发的比较成熟的软件,在做电子scf速度方面有较好的优势. 缺点:可选系综太少. 尽管如此,对于大多数有关分子动力学的任务还是可以胜任的. 主要使用的系 ...
- php课设报告致谢_科学网—博士论文致谢 - 曹墨源的博文
恍惚间,自己似乎才分别了钱塘,转眼又要离开北航.三年多的时间,弹指一瞬,令人唏嘘.想必,这时光飞逝的感觉能够印证我生活的充实.或喜悦,或迷茫,或成功,或失败,我自认在绝大多数时间里,未敢虚度光阴.北京 ...
- matlab不用科学计算法表示_科学网—MATLAB小技巧总结 - 李金磊的博文
①如何保存命令行窗口的历史命令? 打开MATLAB,进入主页:新建脚本文件,即"*.m"文件,这时会自动弹出"编辑器"窗口. 我们可以在脚本文件(编辑器)窗口中 ...
- php监考,科学网—监考与被监考 - 张珑的博文
在全区公检法系统竞职笔试中,突破常规思维,聘请18名少先队员担当"监考官",结果收到了意想不到的效果,小学生"秉公执法",当场抓住25名作弊考生.此举因&quo ...
最新文章
- POJ 2430 状压DP
- mysql8.0_grant改变-You are not allowed to create a user with GRANT
- 文件与目录权限,文件查找
- 退休老人有30万资金,如何存款最安全?
- 01背包 模板1 2 总结
- BugkuCTF-Reverse题NoString
- 平行志愿遵循分数优先php,2020平行志愿的录取规则是什么有哪些优势
- 190906描述笔记
- 【然天一】随机读写(4k)百盘天梯
- Effective C++条款05:了解C++默默编写并调用哪些函数
- OSI七层模型中的网络层与传输层
- matlab中的变换器,buck变换器介绍_buck变换器matlab仿真
- Android学习笔记--Android开发时常用控件(一)
- 20190801每日一句
- 05- 基于UDS协议的故障代码状态字节及检测机制
- 高等数值计算方法第一章引论【误差,条件数】
- 深圳中科智美3D精确数据化整形软件系统三维扫描模块
- 论文笔记:Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering
- HDU - 2024 C语言合法标识符
- 原来PWM这么简单!通过锯齿波作为载波和调制波经过比较,产生相应的PWM输出波形
热门文章
- Python控制键盘鼠标pynput的详细用法 (转载)
- Robust Pose Estimation in Crowded Scenes with Direct Pose-Level Inference 阅读笔记
- 利用c++进行程序词法分析
- 函数的单调性与曲线的凹凸性
- Milvus 社区周报- Week 12, 2020
- 判断三个数是否能构成三角形_七年级 初一下册数学三角形专题复习提纲及经典例题...
- 影响消费者行为的个人因素
- 权限系统的设计模式 ACL RBAC ABAC
- wr720n刷成网络打印_wr720n v4 折腾笔记(一):安装Openwrt
- 家用计算机按键不灵怎么修,电脑的键盘失灵了怎么办 台式电脑键盘失灵的处理步骤...