Beispiel #1
0
 def test_nostatid_false(self):
     current = dict(variable='temperature', date='20000101')
     ret = process_request(current, output_dir, config['data_dir'], wmo_regions)
     with zipfile.ZipFile(ret, 'r') as f:
         x = f.namelist()
         self.assertTrue(len(x) > 100, msg=str(ret) + str(current))
     clean_output_dir()
Beispiel #2
0
 def test_format_csv_true(self):
     current = update_request('format', 'csv', **self.default_request)
     ret = process_request(current, output_dir, config['data_dir'], wmo_regions)
     with zipfile.ZipFile(ret, 'r') as f:
         x = f.namelist()
         h = pd.read_csv(f.open(x[0]), index_col=0)
         self.assertTrue('ta' in h.columns, msg=str(ret) + str(current))
     clean_output_dir()
Beispiel #3
0
 def test_all_variables_true(self):
     current = update_request('variable', self.default_variables, **self.default_request)
     ret = process_request(current, output_dir, config['data_dir'], wmo_regions)
     with zipfile.ZipFile(ret, 'r') as f:
         x = f.namelist()
         for ivar in self.default_variables:
             with self.subTest(ivar=ivar):
                 self.assertTrue(any([self.default_cdmname[ivar] in ifile for ifile in x]),
                                 msg='Missing: %s (%s) %s' % (ivar, self.default_cdmname[ivar], str(x)))
     clean_output_dir()
Beispiel #4
0
 def test_data_true(self):
     current = update_request('fbstats', self.default_variables, **self.default_request)
     ret = process_request(current, output_dir, config['data_dir'], wmo_regions)
     with zipfile.ZipFile(ret, 'r') as f:
         x = f.namelist()
         hf = io.BytesIO(f.read(x[0]))
         h = h5py.File(hf, 'r')
         for ivar in self.default_variables:
             with self.subTest(ivar=ivar):
                 self.assertTrue(ivar in h.keys(), msg=ivar + ' not found ' + str(h.keys()))
     clean_output_dir()
Beispiel #5
0
 def test_an_true(self):
     current = update_request('fbstats', ['obs_minus_an'], **self.default_request)
     ret = process_request(current, output_dir, config['data_dir'], wmo_regions)
     self.assertTrue(ret == dzip, msg=str(ret) + str(current))
     clean_output_dir()
Beispiel #6
0
 def test_temperature_true(self):
     ret = process_request(self.default_request, output_dir, config['data_dir'], wmo_regions)
     self.assertTrue(ret == dzip, msg=str(ret) + str(self.default_request))
     clean_output_dir()
Beispiel #7
0
 def test_50000_true(self):
     current = update_request('pressure_level', 50000, **self.default_request)
     ret = process_request(current, output_dir, config['data_dir'], wmo_regions)
     self.assertTrue(ret == dzip, msg=str(ret) + str(current))
     clean_output_dir()