Exemple #1
0
 def test_get_ceiling(self):
     """Tests that the ceiling is properly identified from a list of clouds"""
     for clouds, ceiling in (
         ([], None),
         ([["FEW", 10], ["SCT", 10]], None),
         ([["OVC", None]], None),
         ([["VV", 5]], ["VV", 5]),
         ([["OVC", 20], ["BKN", 30]], ["OVC", 20]),
         ([["OVC", None], ["BKN", 30]], ["BKN", 30]),
         ([["FEW", 10], ["OVC", 20]], ["OVC", 20]),
     ):
         clouds = [structs.Cloud(None, *cloud) for cloud in clouds]
         if ceiling:
             ceiling = structs.Cloud(None, *ceiling)
         self.assertEqual(core.get_ceiling(clouds), ceiling)
Exemple #2
0
 def test_get_ceiling(self):
     """
     Tests that the ceiling is properly identified from a list of clouds
     """
     for clouds, ceiling in (
         ([], None),
         ([['FEW', 10], ['SCT', 10]], None),
         ([['OVC', None]], None),
         ([['VV', 5]], ['VV', 5]),
         ([['OVC', 20], ['BKN', 30]], ['OVC', 20]),
         ([['OVC', None], ['BKN', 30]], ['BKN', 30]),
         ([['FEW', 10], ['OVC', 20]], ['OVC', 20]),
     ):
         clouds = [structs.Cloud(None, *cloud) for cloud in clouds]
         if ceiling:
             ceiling = structs.Cloud(None, *ceiling)
         self.assertEqual(_core.get_ceiling(clouds), ceiling)
Exemple #3
0
def _clouds(item: str) -> [Cloud]:
    """
    Convert cloud element to a list of Clouds
    """
    clouds = item.split()
    # BASES 004 TOPS 016
    if "BASES" in clouds and "TOPS" in clouds:
        base = clouds[clouds.index("BASES") + 1]
        top = clouds[clouds.index("TOPS") + 1]
        return [structs.Cloud(item, base=base, top=top)]
    return [_core.make_cloud(cloud) for cloud in clouds]
Exemple #4
0
    def test_get_flight_rules(self):
        """
        Tests that the proper flight rule is calculated for a set visibility and ceiling

        Note: Only 'Broken', 'Overcast', and 'Vertical Visibility' are considdered ceilings
        """
        for vis, ceiling, rule in (
            (None, None, 'IFR'),
            ('10', None, 'VFR'),
            ('P6SM', ['OCV',50], 'VFR'),
            ('6', ['OVC',20], 'MVFR'),
            ('6', ['OVC',7], 'IFR'),
            ('2', ['OVC',20], 'IFR'),
            ('6', ['OVC',4], 'LIFR'),
            ('1/2', ['OVC',30], 'LIFR'),
            ('M1/4', ['OVC',30], 'LIFR'),
        ):
            vis = core.make_number(vis)
            if ceiling:
                ceiling = structs.Cloud(None, *ceiling)
            self.assertEqual(static.FLIGHT_RULES[core.get_flight_rules(vis, ceiling)], rule)
Exemple #5
0
    def test_get_flight_rules(self):
        """Tests that the proper flight rule is calculated for a set visibility and ceiling

        Note: Only 'Broken', 'Overcast', and 'Vertical Visibility' are considered ceilings
        """
        for vis, ceiling, rule in (
            (None, None, "IFR"),
            ("10", None, "VFR"),
            ("P6SM", ["OCV", 50], "VFR"),
            ("6", ["OVC", 20], "MVFR"),
            ("6", ["OVC", 7], "IFR"),
            ("2", ["OVC", 20], "IFR"),
            ("6", ["OVC", 4], "LIFR"),
            ("1/2", ["OVC", 30], "LIFR"),
            ("M1/4", ["OVC", 30], "LIFR"),
        ):
            vis = core.make_number(vis)
            if ceiling:
                ceiling = structs.Cloud(None, *ceiling)
            self.assertEqual(
                static.core.FLIGHT_RULES[core.get_flight_rules(vis, ceiling)],
                rule)