Exemplo n.º 1
0
def test_find_drizzle(
    drizzle_cat_file,
    is_rain,
    falling,
    droplet,
    cold,
    melting,
    insect,
    radar,
    lidar,
    clutter,
    molecular,
    attenuated,
    v_sigma,
):
    obj = drizzle.DrizzleClassification(drizzle_cat_file)
    obj.is_rain = is_rain
    obj.category_bits["falling"] = falling
    obj.category_bits["droplet"] = droplet
    obj.category_bits["cold"] = cold
    obj.category_bits["melting"] = melting
    obj.category_bits["insect"] = insect
    obj.quality_bits["radar"] = radar
    obj.quality_bits["lidar"] = lidar
    obj.quality_bits["clutter"] = clutter
    obj.quality_bits["molecular"] = molecular
    obj.quality_bits["attenuated"] = attenuated
    obj.is_v_sigma = v_sigma
    expected = np.array([[1, 1, 0, 0], [1, 1, 0, 0], [1, 1, 0, 0],
                         [1, 1, 0, 0]])
    testing.assert_array_almost_equal(obj._find_drizzle(), expected)
Exemplo n.º 2
0
def test_find_would_be_drizzle(drizzle_cat_file, is_rain, warm, falling,
                               melting, insect, radar, clutter, molecular):
    obj = drizzle.DrizzleClassification(drizzle_cat_file)
    obj.is_rain = is_rain
    obj.warm_liquid = warm
    obj.category_bits["falling"] = falling
    obj.category_bits["melting"] = melting
    obj.category_bits["insect"] = insect
    obj.quality_bits["radar"] = radar
    obj.quality_bits["clutter"] = clutter
    obj.quality_bits["molecular"] = molecular
    expected = np.array([[0, 1, 1, 0], [0, 1, 1, 0], [0, 1, 1, 0],
                         [0, 1, 1, 0]])
    testing.assert_array_almost_equal(obj._find_would_be_drizzle(), expected)
Exemplo n.º 3
0
def test_find_would_be_drizzle(drizzle_cat_file, is_rain, warm, falling,
                               melting, insect, radar, clutter, molecular):
    obj = drizzle.DrizzleClassification(drizzle_cat_file)
    obj.is_rain = is_rain
    obj.warm_liquid = warm
    obj.category_bits['falling'] = falling
    obj.category_bits['melting'] = melting
    obj.category_bits['insect'] = insect
    obj.quality_bits['radar'] = radar
    obj.quality_bits['clutter'] = clutter
    obj.quality_bits['molecular'] = molecular
    compare = np.array([[0, 1, 1, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 1, 1,
                                                                   0]])
    testing.assert_array_almost_equal(obj._find_would_be_drizzle(), compare)
Exemplo n.º 4
0
def test_find_drizzle(drizzle_cat_file, is_rain, falling, droplet, cold,
                      melting, insect, radar, lidar, clutter, molecular,
                      attenuated, v_sigma):
    obj = drizzle.DrizzleClassification(drizzle_cat_file)
    obj.is_rain = is_rain
    obj.category_bits['falling'] = falling
    obj.category_bits['droplet'] = droplet
    obj.category_bits['cold'] = cold
    obj.category_bits['melting'] = melting
    obj.category_bits['insect'] = insect
    obj.quality_bits['radar'] = radar
    obj.quality_bits['lidar'] = lidar
    obj.quality_bits['clutter'] = clutter
    obj.quality_bits['molecular'] = molecular
    obj.quality_bits['attenuated'] = attenuated
    obj.is_v_sigma = v_sigma
    compare = np.array([[1, 1, 0, 0], [1, 1, 0, 0], [1, 1, 0, 0], [1, 1, 0,
                                                                   0]])
    testing.assert_array_almost_equal(obj._find_drizzle(), compare)
Exemplo n.º 5
0
def class_objects(drizzle_source_file, drizzle_cat_file):
    drizzle_source = drizzle.DrizzleSource(drizzle_source_file)
    drizzle_class = drizzle.DrizzleClassification(drizzle_cat_file)
    spectral_w = drizzle.SpectralWidth(drizzle_cat_file)
    return [drizzle_source, drizzle_class, spectral_w]
Exemplo n.º 6
0
def test_find_cold_rain(drizzle_cat_file):
    obj = drizzle.DrizzleClassification(drizzle_cat_file)
    expected = np.array([0, 1])
    testing.assert_array_almost_equal(obj._find_cold_rain(), expected)
Exemplo n.º 7
0
def test_find_warm_liquid(drizzle_cat_file):
    obj = drizzle.DrizzleClassification(drizzle_cat_file)
    obj.category_bits["droplet"] = np.array([0, 0, 0, 1, 1, 1, 0], dtype=bool)
    obj.category_bits["cold"] = np.array([1, 1, 0, 0, 1, 0, 1], dtype=bool)
    expected = np.array([0, 0, 0, 1, 0, 1, 0], dtype=bool)
    testing.assert_array_almost_equal(obj._find_warm_liquid(), expected)
Exemplo n.º 8
0
def test_find_v_sigma(drizzle_cat_file):
    obj = drizzle.DrizzleClassification(drizzle_cat_file)
    expected = np.array([[1, 0, 1], [1, 1, 1]], dtype=bool)
    testing.assert_array_almost_equal(obj._find_v_sigma(drizzle_cat_file),
                                      expected)
Exemplo n.º 9
0
def test_find_warm_liquid(drizzle_cat_file):
    obj = drizzle.DrizzleClassification(drizzle_cat_file)
    obj.category_bits['droplet'] = np.array([0, 0, 0, 1, 1, 1, 0], dtype=bool)
    obj.category_bits['cold'] = np.array([1, 1, 0, 0, 1, 0, 1], dtype=bool)
    compare = np.array([0, 0, 0, 1, 0, 1, 0], dtype=bool)
    testing.assert_array_almost_equal(obj._find_warm_liquid(), compare)