示例#1
0
 def test_geolocation_from_source_file(self):
     temp_file = NamedTemporaryFile()
     meta_without_geolocation = {"name": "Kumpula", "altitude": 34}
     rpg.rpg2nc(FILEPATH, temp_file.name, meta_without_geolocation)
     nc = netCDF4.Dataset(temp_file.name)
     for key in ("latitude", "longitude"):
         assert key in nc.variables
         assert nc.variables[key][:] > 0
     nc.close()
示例#2
0
 def test_uuid_from_user(self):
     test_uuid = 'abc'
     uuid, _ = rpg.rpg2nc(self.file_path,
                          self.temp_file.name,
                          self.site_meta,
                          date='2020-10-23',
                          uuid=test_uuid)
     assert uuid == test_uuid
示例#3
0
 def test_uuid_from_user(self):
     temp_file = NamedTemporaryFile()
     test_uuid = "abc"
     uuid, _ = rpg.rpg2nc(FILEPATH,
                          temp_file.name,
                          self.site_meta,
                          date="2020-10-23",
                          uuid=test_uuid)
     assert uuid == test_uuid
示例#4
0
 def test_handling_of_corrupted_files(self):
     temp_dir = TemporaryDirectory()
     copy_tree(self.file_path, temp_dir.name)
     with open(f'{temp_dir.name}/foo.LV1', 'w') as f:
         f.write('kissa')
     _, files = rpg.rpg2nc(temp_dir.name,
                           self.temp_file.name,
                           self.site_meta,
                           date='2020-10-22')
     assert len(files) == 2
示例#5
0
 def test_handling_of_corrupted_files(self):
     temp_dir = TemporaryDirectory()
     temp_file = NamedTemporaryFile()
     copy_tree(FILEPATH, temp_dir.name)
     with open(f"{temp_dir.name}/foo.LV1", "w") as f:
         f.write("kissa")
     _, files = rpg.rpg2nc(temp_dir.name,
                           temp_file.name,
                           self.site_meta,
                           date="2020-10-22")
     assert len(files) == 2
示例#6
0
 def test_processing_of_no_files(self):
     _, files = rpg.rpg2nc(self.file_path,
                           self.temp_file.name,
                           self.site_meta,
                           date='2020-10-24')
     assert len(files) == 0
示例#7
0
 def test_default_date_validation(self):
     _, files = rpg.rpg2nc(self.file_path,
                           self.temp_file.name,
                           self.site_meta,
                           date='2020-10-22')
     assert len(files) == 2
示例#8
0
 def test_default_processing(self):
     uuid, files = rpg.rpg2nc(self.file_path, self.temp_file.name,
                              self.site_meta)
     assert len(files) == 3
     assert len(uuid) == 32