Ejemplo n.º 1
0
import marstime
import datetime
import scipy
import scipy.optimize
import argparse

import test_simple_julian_offset

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Testsuite for marstime library")
    parser.add_argument("date",
                        type=str,
                        nargs="?",
                        help="Earth date in ISO format YYYY/MM/DD")
    parser.add_argument("time",
                        type=str,
                        nargs="?",
                        help="Earth time in ISO format HH:ii:ss")
    args = parser.parse_args()

    dt = args.date + " " + args.time
    jdate = test_simple_julian_offset.simple_julian_offset(
        datetime.datetime.strptime(dt, "%Y/%m/%d %H:%M:%S"))
    print marstime.equation_of_time(jdate)
Ejemplo n.º 2
0
def test_spirit_landing():
    mil = 1073137591000
    longitude=184.702
    latitude=-14.460
    jdut = marstime.julian(mil)
    assert within_error(jdut,2453008.07397,1e-3)
    
    tt_utc = marstime.utc_to_tt_offset(jdut)
    assert within_error(tt_utc,64.184,1e-3)
    
    jday_tt = marstime.julian_tt(jdut)
    assert within_error(jday_tt, 2453008.07471,1e-3)
    
    j2000_ott = marstime.j2000_offset_tt(jday_tt)
    assert within_error(j2000_ott, 1463.07471, 1e-3)

    m = marstime.Mars_Mean_Anomaly(j2000_ott)
    assert within_error(m, 66.06851,1e3)

    alpha = marstime.FMS_Angle(j2000_ott)
    assert within_error(alpha, 317.09363,1e-4)

    pbs = marstime.alpha_perturbs(j2000_ott)
    assert within_error(pbs, 0.01614, 1e-3)

    v_m = marstime.equation_of_center(j2000_ott)
    assert within_error(v_m, 10.22959, 1e-4)

    ls = marstime.Mars_Ls(j2000_ott)
    assert within_error(ls, 327.32322, 1e-4)

    eot = marstime.equation_of_time(j2000_ott)
    assert within_error(eot, -12.77557, 1e-4)

    mtc = marstime.Coordinated_Mars_Time(j2000_ott)
    assert within_error(mtc,13.16542, 1e-4)

    lmst = marstime.Local_Mean_Solar_Time(longitude,j2000_ott)
    assert within_error(lmst, 0.85196, 1e-4)

    ltst = marstime.Local_True_Solar_Time(longitude,j2000_ott)
    assert within_error(ltst, 0.00025, 1e-5)

    subsol = marstime.subsolar_longitude(j2000_ott)
    assert within_error(subsol, 4.70575,1e-4)

    dec = marstime.solar_declination(ls)
    assert within_error(dec, -13.42105,1e-2)

    rm = marstime.heliocentric_distance(j2000_ott)
    assert within_error(rm,1.47767, 1e-4)

    im = marstime.heliocentric_longitude(j2000_ott)
    assert within_error(im, 52.37469, 1e-4)

    bm = marstime.heliocentric_latitude(j2000_ott)
    assert within_error(bm, 0.08962, 1e-4)

#This is where we deviate significantly from the original marstime algorithm.
    sz = marstime.solar_zenith(longitude, latitude,j2000_ott)
    assert within_error(sz, 151.93895, 0.2)

    sa = marstime.solar_azimuth(longitude, latitude,j2000_ott)
    assert within_error(sa, 179.99225,1e-2)
Ejemplo n.º 3
0
def test_midnight_crossing():
    mil = 947116800000
    longitude=0.
    latitude=0.
    jdut = marstime.julian(mil)
    assert within_error(jdut,2451549.5,1e-3)
    
    tt_utc = marstime.utc_to_tt_offset(jdut)
    assert within_error(tt_utc,64.184,1e-3)
    
    jday_tt = marstime.julian_tt(jdut)
    assert within_error(jday_tt, 2451549.50074,1e-3)
    
    j2000_ott = marstime.j2000_offset_tt(jday_tt)
    assert within_error(j2000_ott, 4.50074, 1e-3)

    m = marstime.Mars_Mean_Anomaly(j2000_ott)
    assert within_error(m, 21.74548,1e3)

    alpha = marstime.FMS_Angle(j2000_ott)
    assert within_error(alpha, 272.74486,1e-4)

    pbs = marstime.alpha_perturbs(j2000_ott)
    assert within_error(pbs, 0.00142, 1e-3)

    v_m = marstime.equation_of_center(j2000_ott)
    assert within_error(v_m, 4.44191, 1e-4)

    ls = marstime.Mars_Ls(j2000_ott)
    assert within_error(ls, 277.18677, 1e-4)

    eot = marstime.equation_of_time(j2000_ott)
    assert within_error(eot, -5.18764, 1e-4)

    mtc = marstime.Coordinated_Mars_Time(j2000_ott)
    assert within_error(mtc,23.99431, 1e-4)

    lmst = marstime.Local_Mean_Solar_Time(longitude,j2000_ott)
    assert within_error(lmst, 23.99431, 1e-4)

    ltst = marstime.Local_True_Solar_Time(longitude,j2000_ott)
    assert within_error(ltst, 23.64847, 1e-4)

    subsol = marstime.subsolar_longitude(j2000_ott)
    assert within_error(subsol, 174.72703,1e-4)

    dec = marstime.solar_declination(ls)
    assert within_error(dec, -25.22838,1e-4)

    rm = marstime.heliocentric_distance(j2000_ott)
    assert within_error(rm, 1.39358, 1e-4)

    im = marstime.heliocentric_longitude(j2000_ott)
    assert within_error(im, 2.26270, 1e-4)

    bm = marstime.heliocentric_latitude(j2000_ott)
    assert within_error(bm, -1.35959, 1e-4)

    sz = marstime.solar_zenith(longitude, latitude,j2000_ott)
    assert within_error(sz, 154.26182, 1e-4)

    sa = marstime.solar_azimuth(longitude, latitude,j2000_ott)
    assert within_error(sa, 191.03687,1e-4)
Ejemplo n.º 4
0
def test_equation_of_time():
    assert within_error(marstime.equation_of_time(0.0), -4.44596,1e-5)
    assert within_error(marstime.equation_of_time(1000.0), 2.17244,1e-5)
Ejemplo n.º 5
0
mpl.rc("xtick", labelsize=10)
mpl.rc("ytick", labelsize=10)
mpl.rc("legend", fontsize=10)
import pylab as pl
import numpy as np
import marstime

#define mars solar days to use in the plot
start_j2000_ott = 151.27365  # sometime in May 2000, start of MY25

msd = np.linspace(0, 669, 120)
#calculate the j2000 offset dates
j2000_offsets = marstime.j2000_from_Mars_Solar_Date(
    msd + marstime.Mars_Solar_Date(start_j2000_ott))

eot_axis = marstime.equation_of_time(
    j2000_offsets) * 60 / 15.  #convert from degrees to minutes
dec_axis = marstime.solar_declination(
    marstime.Mars_Ls(j2000_offsets))  #takes Ls, not MSD

pl.figure(figsize=(4, 6))
pl.subplots_adjust(left=0.15)
pl.plot(eot_axis, dec_axis, marker='.', ls='none', color='k')
pl.plot(eot_axis[::10], dec_axis[::10], marker='.', ls='none', color='r')
pl.ylim(-28, 28)
pl.xlim(-55, 45)
pl.xticks(np.arange(-50, 50, 10))
pl.yticks(np.arange(-30, 30, 5))
pl.ylabel("Declination (degrees)")
pl.xlabel("Equation of Time (minutes)")
pl.savefig("analemma.png")
Ejemplo n.º 6
0
import matplotlib as mpl
mpl.use("Agg")
mpl.rc("axes",labelsize=10)
mpl.rc("xtick",labelsize=10)
mpl.rc("ytick",labelsize=10)
mpl.rc("legend",fontsize=10)
import pylab as pl
import numpy as np
import marstime

#define mars solar days to use in the plot
start_j2000_ott = 151.27365 # sometime in May 2000, start of MY25

msd = np.linspace(0,669,120)
#calculate the j2000 offset dates
j2000_offsets = marstime.j2000_from_Mars_Solar_Date(msd + marstime.Mars_Solar_Date(start_j2000_ott))

eot_axis = marstime.equation_of_time(j2000_offsets)*60/15. #convert from degrees to minutes
dec_axis = marstime.solar_declination(marstime.Mars_Ls(j2000_offsets)) #takes Ls, not MSD

pl.figure(figsize=(4,6))
pl.subplots_adjust(left=0.15)
pl.plot(eot_axis, dec_axis, marker='.', ls='none',color='k')
pl.plot(eot_axis[::10], dec_axis[::10], marker='.', ls='none',color='r')
pl.ylim(-28,28)
pl.xlim(-55,45)
pl.xticks(np.arange(-50,50,10))
pl.yticks(np.arange(-30,30,5))
pl.ylabel("Declination (degrees)")
pl.xlabel("Equation of Time (minutes)")
pl.savefig("analemma.png")