Exemple #1
0
 def test_download_file(self):
     """ Should download the selected file and put into mapperData"""
     t = DataForTestingMappers()
     t.download_test_file("ftp://ftp.nersc.no/pub/python_test_data/ncep/gfs20120328.t00z.master.grbf00", "ncep")
     self.assertTrue("ncep" in t.mapperData)
     self.assertEqual(type(t.mapperData["ncep"]), list)
     for ifile in t.mapperData["ncep"]:
         self.assertTrue(os.path.exists(ifile))
Exemple #2
0
 def test_all_rs2_files(self):
     testData = DataForTestingMappers()
     testData.download_all_test_data()
     for rsfile in testData.mapperData['radarsat2']:
         # OBS: do not yield functions that have the word 'test' in
         # their names - these are run automatically by nose...
         yield self.incidence_angle, rsfile
         #yield self.export2thredds, rsfile
         yield self.export, rsfile
Exemple #3
0
 def test_download_file(self):
     ''' Should download the selected file and put into mapperData'''
     t = DataForTestingMappers()
     t.download_test_file(
         'ftp://ftp.nersc.no/pub/python_test_data/ncep/gfs20120328.t00z.master.grbf00',
         'ncep')
     self.assertTrue('ncep' in t.mapperData)
     self.assertEqual(type(t.mapperData['ncep']), list)
     for ifile in t.mapperData['ncep']:
         self.assertTrue(os.path.exists(ifile))
Exemple #4
0
 def test_specific_mapper(self):
     ''' Should open all downloaded files with automatically selected mapper '''
     testData = DataForTestingMappers()
     testData.download_all_test_data()
     for mapperName in testData.mapperData:
         mapperFiles = testData.mapperData[mapperName]
         for mapperFile in mapperFiles:
             print mapperName, '->', mapperFile
             # OBS: do not yield functions that have the word 'test' in
             # their names - these are run automatically by nose...
             yield self.open_with_specific_mapper, mapperFile, mapperName
Exemple #5
0
 def test_specific_mapper(self):
     """ Should open all downloaded files with automatically selected mapper """
     testData = DataForTestingMappers()
     testData.download_all_test_data()
     for mapperName in testData.mapperData:
         mapperFiles = testData.mapperData[mapperName]
         for mapperFile in mapperFiles:
             print mapperName, "->", mapperFile
             # OBS: do not yield functions that have the word 'test' in
             # their names - these are run automatically by nose...
             yield self.open_with_specific_mapper, mapperFile, mapperName
Exemple #6
0
 def test_automatic_mapper(self):
     """ Should open all downloaded files with automatically selected mapper """
     testData = DataForTestingMappers()
     testData.download_all_test_data()
     for mapper in testData.mapperData:
         mapperFiles = testData.mapperData[mapper]
         for mapperFile in mapperFiles:
             print mapperFile
             # OBS: do not yield functions that have the word 'test' in
             # their names - these are run automatically by nose...
             yield self.open_with_automatic_mapper, mapperFile
             yield self.geolocation_of_exportedNC_vs_original, mapperFile
Exemple #7
0
 def test_automatic_mapper(self):
     ''' Should open all downloaded files with automatically selected mapper '''
     testData = DataForTestingMappers()
     testData.download_all_test_data()
     for mapper in testData.mapperData:
         mapperFiles = testData.mapperData[mapper]
         for mapperFile in mapperFiles:
             print mapperFile
             # OBS: do not yield functions that have the word 'test' in
             # their names - these are run automatically by nose...
             yield self.open_with_automatic_mapper, mapperFile
             yield self.geolocation_of_exportedNC_vs_original, \
                     mapperFile
Exemple #8
0
 def test_all_rs2_files(self):
     sys.stderr.write('\ntest_all_rs2_files\n')
     testData = DataForTestingMappers()
     rs2Index = [i for i,
                 v in enumerate(testData.mapperData) if v[1] == 'radarsat2']
     for index in rs2Index:
         rsfile = testData.mapperData[index][0]
         # yield self.export2thredds, rsfile
         yield self.export, rsfile
         yield self.incidence_angle, rsfile
         yield self.export_band, rsfile
         yield self.resize, rsfile
 def setup_class(cls):
     ''' Download testing data '''
     cls.testData = DataForTestingMappers()
 def test_create_test_data(self):
     ''' should create TestData instance '''
     t = DataForTestingMappers()
     self.assertTrue(hasattr(t, 'mapperData'))
Exemple #11
0
 def test_testDataDir_exists(self):
     ''' should create TestData instance '''
     t = DataForTestingMappers()
     self.assertTrue(os.path.exists(t.testDataDir))
Exemple #12
0
 def test_testDataDir_from_env(self):
     ''' should create TestData instance '''
     fakeDir = '/fake/dir/to/test/data'
     os.environ['MAPPER_TEST_DATA_DIR'] = fakeDir
     t = DataForTestingMappers()
     self.assertEqual(t.testDataDir, fakeDir)