Ejemplo n.º 1
0
 def test_year_filter_none(self):
     msgs = GribMessage.messages_from_filename(self.file_path)
     chosen_messages = []
     for gmsg in msgs:
         if gmsg.sections[1]['year'] == 1958:
             chosen_messages.append(gmsg)
     cubes_msgs = list(load_pairs_from_fields(chosen_messages))
     self.assertEqual(len(cubes_msgs), 0)
Ejemplo n.º 2
0
 def test_year_filter_none(self):
     msgs = GribMessage.messages_from_filename(self.file_path)
     chosen_messages = []
     for gmsg in msgs:
         if gmsg.sections[1]['year'] == 1958:
             chosen_messages.append(gmsg)
     cubes_msgs = list(load_pairs_from_fields(chosen_messages))
     self.assertEqual(len(cubes_msgs), 0)
Ejemplo n.º 3
0
 def test_as_pairs(self):
     messages = GribMessage.messages_from_filename(self.file_path)
     cubes = []
     cube_msg_pairs = load_pairs_from_fields(messages)
     for cube, gmsg in cube_msg_pairs:
         if gmsg.sections[1]['year'] == 1998:
             cube.attributes['the year is'] = gmsg.sections[1]['year']
             cubes.append(cube)
     self.assertEqual(len(cubes), 1)
     self.assertEqual(cubes[0].attributes['the year is'], 1998)
Ejemplo n.º 4
0
 def test_as_pairs(self):
     messages = GribMessage.messages_from_filename(self.file_path)
     cubes = []
     cube_msg_pairs = load_pairs_from_fields(messages)
     for cube, gmsg in cube_msg_pairs:
         if gmsg.sections[1]['year'] == 1998:
             cube.attributes['the year is'] = gmsg.sections[1]['year']
             cubes.append(cube)
     self.assertEqual(len(cubes), 1)
     self.assertEqual(cubes[0].attributes['the year is'], 1998)