コード例 #1
0
def test_Argo_spike_test_temperature_threshold():
    '''
    check AST temperature behavior exactly at depth threshold (500m)
    '''
    # middle value should fail the deep check but pass the shallow check;
    # at threshold, use deep criteria
    p = util.testingProfile.fakeProfile([5, 7.0001, 5],
                                        obs_utils.pressure_to_depth(
                                            [400, 500, 600], 0.0),
                                        latitude=0.0)
    qc = qctests.Argo_spike_test.test(p, None)
    truth = numpy.zeros(3, dtype=bool)
    truth[1] = True
    assert numpy.array_equal(
        qc, truth
    ), 'failing to flag a positive spike just above threshold. (threshold)'

    # as above, but passes just above 500m
    p = util.testingProfile.fakeProfile([5, 7.0001, 5],
                                        obs_utils.pressure_to_depth(
                                            [400, 499, 600], 0.0),
                                        latitude=0.0)
    qc = qctests.Argo_spike_test.test(p, None)
    truth = numpy.zeros(3, dtype=bool)
    assert numpy.array_equal(
        qc, truth
    ), 'flagged a spike using deep criteria when shallow should have been used. (threshold)'
コード例 #2
0
ファイル: obs_utils_tests.py プロジェクト: yf1412/AutoQC
def pressure_to_depth_test():
    '''
    implements the checkvalue suggested in the original implementation.
    '''

    # for scalars
    assert np.round(outils.pressure_to_depth(10000, 30.0)*1000) == 9712653

    # for numpy arrays
    depths = outils.pressure_to_depth(np.array([10000, 10000, 10000]), np.array([30.0, 30.0, 30.0]))
    for i in range(len(depths)):
        assert np.round(depths[i]*1000) == 9712653
コード例 #3
0
ファイル: obs_utils_tests.py プロジェクト: BillMills/AutoQC
def pressure_to_depth_test():
    """
    implements the checkvalue suggested in the original implementation.
    """

    # for scalars
    assert np.round(outils.pressure_to_depth(10000, 30.0) * 1000) == 9713735

    # for numpy arrays
    depths = outils.pressure_to_depth(np.array([10000, 10000, 10000]), np.array([30.0, 30.0, 30.0]))
    for i in range(len(depths)):
        assert np.round(depths[i] * 1000) == 9713735
コード例 #4
0
def test_Argo_gradient_test_temperature_threshold():
    ''' 
    check AGT temperature behavior exactly at depth threshold (500m)
    '''
    # middle value should fail the deep check but pass the shallow check;
    # at threshold, use deep criteria
    p = util.testingProfile.fakeProfile([2,5.0001,2], obs_utils.pressure_to_depth([400,500,600], 0.0), latitude=0.0) 
    qc = qctests.Argo_gradient_test.test(p, None)
    truth = numpy.zeros(3, dtype=bool)
    truth[1] = True 
    assert numpy.array_equal(qc, truth), 'failing to flag a positive spike just above threshold. (threshold)'      

    # as above, but passes just above 500m
    p = util.testingProfile.fakeProfile([2,5.0001,2], obs_utils.pressure_to_depth([400,499,600], 0.0), latitude=0.0) 
    qc = qctests.Argo_gradient_test.test(p, None)
    truth = numpy.zeros(3, dtype=bool)
    assert numpy.array_equal(qc, truth), 'flagged a spike using deep criteria when shallow should have been used. (threshold)' 
コード例 #5
0
def test_Argo_global_range_check_pressure():
    '''
    Make sure AGRC is flagging pressure excursions
    '''

    # should fail despite rounding
    p = util.testingProfile.fakeProfile([5], obs_utils.pressure_to_depth([-5.00000001], 0.0), latitude=0.0) 
    qc = qctests.Argo_global_range_check.test(p, None)
    truth = numpy.zeros(1, dtype=bool)
    truth[0] = True
    assert numpy.array_equal(qc, truth), 'failed to flag pressure slightly below -5 '

    # -5 OK
    p = util.testingProfile.fakeProfile([5], obs_utils.pressure_to_depth([-5], 0.0), latitude=0.0) 
    qc = qctests.Argo_global_range_check.test(p, None)
    truth = numpy.zeros(1, dtype=bool)
    assert numpy.array_equal(qc, truth), 'incorrectly flagging pressure of -5'