コード例 #1
0
 def test_remove_non_standard_fields(self):
     raw_data = ('2015022819 - METAR SBGL 281900Z 16013KT'
                 ' 9999 SCT025 FEW030TCU 29/22 Q1012=')
     expected_standard_data = ('METAR SBGL 281900Z 16013KT'
                               ' 9999 SCT025 FEW030TCU 29/22 Q1012')
     observation_time, standard_data = get_date_and_standard_metar(raw_data)
     self.assertEqual(standard_data, expected_standard_data)
コード例 #2
0
 def test_remove_non_standard_fields(self):
     raw_data = ('2015022819 - METAR SBGL 281900Z 16013KT'
                 ' 9999 SCT025 FEW030TCU 29/22 Q1012=')
     expected_standard_data = ('METAR SBGL 281900Z 16013KT'
                               ' 9999 SCT025 FEW030TCU 29/22 Q1012')
     observation_time, standard_data = get_date_and_standard_metar(raw_data)
     self.assertEqual(standard_data, expected_standard_data)
コード例 #3
0
 def test_observation_time_is_extracted_from_non_standard_field(self):
     raw_data = (
         "2015022819 - METAR SBGL 281900Z 16013KT"
         " 9999 SCT025 FEW030TCU 29/22 Q1012="
     )
     expected_observation_time = datetime(2015, 2, 28, 19, 0)
     observation_time, standard_data = get_date_and_standard_metar(raw_data)
     self.assertEqual(observation_time, expected_observation_time)
コード例 #4
0
 def test_remove_COR_modifier(self):
     """
     This modifier is not important for us, but it breaks Metar because
     REDEMET sends it in a non-standard position (Metar expects is
     after the sation, but it comes before).
     """
     raw_data = ('2017111718 - METAR COR SBAT 171800Z 28004KT '
                 '9999 SCT035 FEW040TCU 33/24 Q1008=')
     expected_observation_time = datetime(2017, 11, 17, 18, 0)
     observation_time, standard_data = get_date_and_standard_metar(raw_data)
     self.assertEqual(observation_time, expected_observation_time)
     self.assertNotIn('COR', standard_data)
コード例 #5
0
 def test_remove_COR_modifier(self):
     """
     This modifier is not important for us, but it breaks Metar because
     REDEMET sends it in a non-standard position (Metar expects is
     after the sation, but it comes before).
     """
     raw_data = ('2017111718 - METAR COR SBAT 171800Z 28004KT '
                 '9999 SCT035 FEW040TCU 33/24 Q1008=')
     expected_observation_time = datetime(2017, 11, 17, 18, 0)
     observation_time, standard_data = get_date_and_standard_metar(raw_data)
     self.assertEqual(observation_time, expected_observation_time)
     self.assertNotIn('COR', standard_data)
コード例 #6
0
 def test_observation_time_is_extracted_from_non_standard_field(self):
     raw_data = ('2015022819 - METAR SBGL 281900Z 16013KT'
                 ' 9999 SCT025 FEW030TCU 29/22 Q1012=')
     expected_observation_time = datetime(2015, 2, 28, 19, 0)
     observation_time, standard_data = get_date_and_standard_metar(raw_data)
     self.assertEqual(observation_time, expected_observation_time)