本文整理汇总了Python中skyfield.timelib.JulianDate类的典型用法代码示例。如果您正苦于以下问题:Python JulianDate类的具体用法?Python JulianDate怎么用?Python JulianDate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JulianDate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_iso_of_leap_second_with_fraction
def test_iso_of_leap_second_with_fraction():
jd = JulianDate(utc=(1973, 12, 31, 23, 59, 60.12349))
assert jd.utc_iso(places=0) == "1973-12-31T23:59:60Z"
assert jd.utc_iso(places=1) == "1973-12-31T23:59:60.1Z"
assert jd.utc_iso(places=2) == "1973-12-31T23:59:60.12Z"
assert jd.utc_iso(places=3) == "1973-12-31T23:59:60.123Z"
assert jd.utc_iso(places=4) == "1973-12-31T23:59:60.1235Z"
示例2: test_iso_of_decimal_that_rounds_up
def test_iso_of_decimal_that_rounds_up():
jd = JulianDate(utc=(1915, 12, 2, 3, 4, 5.6786786))
assert jd.utc_iso(places=0) == "1915-12-02T03:04:06Z"
assert jd.utc_iso(places=1) == "1915-12-02T03:04:05.7Z"
assert jd.utc_iso(places=2) == "1915-12-02T03:04:05.68Z"
assert jd.utc_iso(places=3) == "1915-12-02T03:04:05.679Z"
assert jd.utc_iso(places=4) == "1915-12-02T03:04:05.6787Z"
示例3: test_iso_of_decimal_that_rounds_down
def test_iso_of_decimal_that_rounds_down():
jd = JulianDate(utc=(2014, 12, 21, 6, 3, 1.234234))
assert jd.utc_iso(places=0) == "2014-12-21T06:03:01Z"
assert jd.utc_iso(places=1) == "2014-12-21T06:03:01.2Z"
assert jd.utc_iso(places=2) == "2014-12-21T06:03:01.23Z"
assert jd.utc_iso(places=3) == "2014-12-21T06:03:01.234Z"
assert jd.utc_iso(places=4) == "2014-12-21T06:03:01.2342Z"
示例4: test_stftime_of_date_array
def test_stftime_of_date_array():
jd = JulianDate(utc=(1973, 12, 31, 23, 59, np.arange(59.0, 61.1, 1.0)))
assert jd.utc_strftime('%Y %m %d %H %M %S') == [
'1973 12 31 23 59 59',
'1973 12 31 23 59 60',
'1974 01 01 00 00 00',
]
示例5: test_jpl_format
def test_jpl_format():
jd = JulianDate(utc=(range(-300, 301, 100), 7, 1))
assert jd.utc_jpl() == [
"B.C. 0301-Jul-01 00:00:00.0000 UT",
"B.C. 0201-Jul-01 00:00:00.0000 UT",
"B.C. 0101-Jul-01 00:00:00.0000 UT",
"B.C. 0001-Jul-01 00:00:00.0000 UT",
"A.D. 0100-Jul-01 00:00:00.0000 UT",
"A.D. 0200-Jul-01 00:00:00.0000 UT",
"A.D. 0300-Jul-01 00:00:00.0000 UT",
]
示例6: test_iso_of_array_showing_fractions
def test_iso_of_array_showing_fractions():
jd = JulianDate(utc=(1973, 12, 31, 23, 59, np.arange(58.75, 63.1, 0.5)))
assert jd.utc_iso(places=2) == [
"1973-12-31T23:59:58.75Z",
"1973-12-31T23:59:59.25Z",
"1973-12-31T23:59:59.75Z",
"1973-12-31T23:59:60.25Z",
"1973-12-31T23:59:60.75Z",
"1974-01-01T00:00:00.25Z",
"1974-01-01T00:00:00.75Z",
"1974-01-01T00:00:01.25Z",
"1974-01-01T00:00:01.75Z",
]
示例7: test_iso_of_array_showing_whole_seconds
def test_iso_of_array_showing_whole_seconds():
jd = JulianDate(utc=(1973, 12, 31, 23, 59, np.arange(58.75, 63.1, 0.5)))
assert jd.utc_iso(places=0) == [
"1973-12-31T23:59:59Z",
"1973-12-31T23:59:59Z",
"1973-12-31T23:59:60Z",
"1973-12-31T23:59:60Z",
"1974-01-01T00:00:00Z",
"1974-01-01T00:00:00Z",
"1974-01-01T00:00:01Z",
"1974-01-01T00:00:01Z",
"1974-01-01T00:00:02Z",
]
示例8: Calculate
def Calculate(earth,planet,stri,lat,long):
#boston = earth.topos('50.833639 N', '4.018829 E')
boston = earth.topos(lat+' N', long+' E')
startDate = datetime.datetime( 2015, 11, 1,22,00,00,0, pytz.UTC )
endDate = datetime.datetime( 2016, 4, 1,22,00,00,0, pytz.UTC )
dayDelta = datetime.timedelta( days=1 )
momentList = []
while startDate < endDate:
startDate += dayDelta
date = JulianDate(startDate)
position = boston.at(date).observe(planet)
momentList.append(Print(position,stri,date.utc_datetime()))
return momentList
示例9: test_appendix_c_satellite
def test_appendix_c_satellite():
lines = appendix_c_example.splitlines()
sat = EarthSatellite(lines, earth)
jd_epoch = sat._sgp4_satellite.jdsatepoch
three_days_later = jd_epoch + 3.0
jd = JulianDate(tt=three_days_later)
jd.ut1 = array(three_days_later)
# First, a crucial sanity check (which is, technically, a test of
# the `sgp4` package and not of Skyfield): are the right coordinates
# being produced by our Python SGP4 propagator for this satellite?
rTEME, vTEME = sat._position_and_velocity_TEME_km(jd)
assert abs(-9060.47373569 - rTEME[0]) < 1e-8
assert abs(4658.70952502 - rTEME[1]) < 1e-8
assert abs(813.68673153 - rTEME[2]) < 1e-8
assert abs(-2.232832783 - vTEME[0]) < 1e-9
assert abs(-4.110453490 - vTEME[1]) < 1e-9
assert abs(-3.157345433 - vTEME[2]) < 1e-9
示例10: test_astimezone
def test_astimezone():
jd = JulianDate(utc=(1969, 7, 20, 20, 18))
tz = timezone("US/Eastern")
dt = jd.astimezone(tz)
assert dt == tz.localize(datetime(1969, 7, 20, 16, 18, 0, 0))
示例11: test_early_utc
def test_early_utc():
jd = JulianDate(utc=(1915, 12, 2, 3, 4, 5.6786786))
assert abs(jd.tt - 2420833.6283317441) < epsilon
assert jd.utc_iso() == "1915-12-02T03:04:06Z"
示例12: test_stftime_of_single_date
def test_stftime_of_single_date():
jd = JulianDate(utc=(1973, 12, 31, 23, 59, 60))
assert jd.utc_strftime("%Y %m %d %H %M %S") == "1973 12 31 23 59 60"
示例13: test_utc_datetime_and_leap_second
def test_utc_datetime_and_leap_second():
jd = JulianDate(utc=(1969, 7, 20, 20, 18))
dt, leap_second = jd.utc_datetime_and_leap_second()
assert dt == datetime(1969, 7, 20, 20, 18, 0, 0, utc)
assert leap_second == 0
示例14: test_utc_datetime
def test_utc_datetime():
jd = JulianDate(utc=(1969, 7, 20, 20, 18))
dt = jd.utc_datetime()
assert dt == datetime(1969, 7, 20, 20, 18, 0, 0, utc)
示例15: test_astimezone_and_leap_second
def test_astimezone_and_leap_second():
jd = JulianDate(utc=(1969, 7, 20, 20, 18))
tz = timezone("US/Eastern")
dt, leap_second = jd.astimezone_and_leap_second(tz)
assert dt == tz.localize(datetime(1969, 7, 20, 16, 18, 0, 0))
assert leap_second == 0