Esempio n. 1
0
def test_encode_cdftt2000():
    x = cdfepoch.encode(186999622360321123)
    assert x == '2005-12-04T20:19:18.176321123'
    y = cdfepoch.encode([500000000100, 123456789101112131],
                        iso_8601=False)
    assert y[0] == '01-Jan-2000 12:07:15.816.000.100'
    assert y[1] == '30-Nov-2003 09:32:04.917.112.131'
Esempio n. 2
0
def test_encode_cdfepoch():
    x = cdfepoch.encode([62285326000000.0, 62985326000000.0])
    assert x[0] == '1973-09-28T23:26:40.000'
    assert x[1] == '1995-12-04T19:53:20.000'

    y = cdfepoch.encode(62975326000002.0, iso_8601=False)
    assert y == '11-Aug-1995 02:06:40.002'
Esempio n. 3
0
def test_encode_cdfepoch16():
    '''
    cdf_encode_epoch16(dcomplex(63300946758.000000, 176214648000.00000)) in IDL
    returns 04-Dec-2005 20:39:28.176.214.654.976

    However, I believe this IDL routine is bugged.  This website:
    https://www.epochconverter.com/seconds-days-since-y0
    shows a correct answer.
    '''
    x = cdfepoch.encode(np.complex128(63300946758.000000 + 176214648000.00000j))
    assert x == '2005-12-04T20:19:18.176214648000'
    y = cdfepoch.encode(np.complex128([33300946758.000000 + 106014648000.00000j,
                                       61234543210.000000 + 000011148000.00000j]),
                        iso_8601=False)
    assert y[0] == '07-Apr-1055 14:59:18.106.014.648.000'
    assert y[1] == '12-Jun-1940 03:20:10.000.011.148.000'
Esempio n. 4
0
def test_parse_cdftt2000():
    input_time = 131415926535793238
    x = cdfepoch.encode(input_time)
    assert x == "2004-03-01T12:24:22.351793238"
    parsed = cdfepoch.parse(x)
    assert parsed == input_time

    assert cdfepoch().to_datetime(parsed) == [datetime(2004, 3, 1, 12, 24, 22, 351793)]
Esempio n. 5
0
def test_parse_cdfepoch16():
    input_time = 53467976543.0 + 543218654100j
    x = cdfepoch.encode(input_time)
    assert x == "1694-05-01T07:42:23.543218654100"
    parsed = cdfepoch.parse(x)
    assert parsed == input_time

    assert cdfepoch().to_datetime(parsed) == [datetime(1694, 5, 1, 7, 42, 23, 543218)]
Esempio n. 6
0
def test_parse_cdfepoch():
    x = cdfepoch.encode(62567898765432.0)
    assert x == "1982-09-12T11:52:45.432"
    parsed = cdfepoch.parse(x)
    assert parsed == approx(62567898765432.0)
Esempio n. 7
0
 def time_epoch_encode(self, to_np):
     cdfepoch.encode(self.epochs)