Exemple #1
0
def test_parse_goes_header():
    """imfv283_test.IMFV283Parser_test.test_parse_goes_header()
    """
    goes_data = IMFV283Parser()._process_ness_block(
        IMFV283_EXAMPLE_VIC, imfv283_codes.OBSERVATORIES["VIC"], 191)
    goes_header = IMFV283Parser()._parse_goes_header(goes_data)
    assert_equal(goes_header["day"], 23)
Exemple #2
0
def test_parse_goes_header_STJ():
    """imfv283_test.IMFV283Parser_test.test_parse_goes_header_STJ()"""
    goes_data = IMFV283Parser()._process_ness_block(
        IMFV283_EXAMPLE_STJ, imfv283_codes.OBSERVATORIES["STJ"], 191)
    actual_goes_header = IMFV283Parser()._parse_goes_header(goes_data)

    expected_header = {
        "day": 259,
        "minute": 12,
        "offset": bytearray(b"\x97x\xb8\xbe"),
        "orient": 0.0,
        "scale": [1, 1, 1, 1],
    }

    assert_equal(actual_goes_header, expected_header)
    assert_equal(type(actual_goes_header["minute"]), int)
Exemple #3
0
def test_parse_msg_header():
    """imfv283_test.IMFV283Parser_test.test_parse_msg_header()

    Call the _parse_header method with a header.
    Verify the header name and value are split at the correct column.
    """
    header = IMFV283Parser()._parse_msg_header(IMFV283_EXAMPLE_VIC)
    assert_equal(header["obs"], "VIC")
Exemple #4
0
def test_parse_msg_header():
    """imfv283_test.IMFV283Parser_test.test_parse_msg_header()

    Call the _parse_header method with a header.
    Verify the header names and values are split at the correct columns.
    """
    header = IMFV283Parser()._parse_msg_header(IMFV283_EXAMPLE_VIC)
    assert_equal(header["daps_platform"], b"75C2A3A8")
    assert_equal(header["obs"], "VIC")
    assert_equal(header["transmission_time"], b"14023012741")
    assert_equal(header["data_len"], 191)
Exemple #5
0
def test_estimate_data_time__incorrect_doy():
    """imfv283_test.IMFV283Parser_test.test_estimate_data_time__correct_doy()

    Use example goes packet from BLC station, with incorrect goes doy value.
    """
    parser = IMFV283Parser()
    # BLC aka 1999 rollover gps issue
    transmission = b"17274013241"
    day = 46
    minute = 78
    (data_time, transmit_time,
     corrected) = parser._estimate_data_time(transmission, day, minute)
    assert_equal(data_time, UTCDateTime("2017-10-01T01:18:00Z"))
    assert_equal(transmit_time, UTCDateTime("2017-10-01T01:32:41Z"))
    assert_equal(corrected, True)
Exemple #6
0
def test_estimate_data_time__correct_doy():
    """imfv283_test.IMFV283Parser_test.test_estimate_data_time__correct_doy()

    Use example goes packet from BOU station, with correct goes doy value.
    """
    parser = IMFV283Parser()
    # BOU aka normal
    transmission = b"17274013121"
    day = 274
    minute = 72
    (data_time, transmit_time,
     corrected) = parser._estimate_data_time(transmission, day, minute)
    assert_equal(data_time, UTCDateTime("2017-10-01T01:12:00Z"))
    assert_equal(transmit_time, UTCDateTime("2017-10-01T01:31:21Z"))
    assert_equal(corrected, False)