Пример #1
0
 def download(self, scenes):
     """Download Function from Google Storage 
     Args:
       SceneID {data_tye: List}
     Retruns:
       Tarred landsat data files
     """
     self.google = landsat.settings.GOOGLE_STORAGE
      
      # Check for the validity of SceneID
     for scene in scenes:
         # An empty list in accordance to landsat unique ID
         scene_anatomy = {
              'path': None,
              'row': None,
              'sat': None,
              'scene': scene
              }
         if isinstance(scene, str) and len(scene) == 21:
                  scene_anatomy['path'] = scene[3:6]
                  scene_anatomy['row'] = scene[6:9]
                  scene_anatomy['sat'] = 'L' + scene[2:3]
         else:
             raise IncorrectSceneId('Bad List')
         # Create a folder to download tarred landsat Scenes
         path = check_create_folder(self.download_dir)
         filename = scene + '.tar.bz'        
         print path
         print scene_anatomy
         # Builds the URL to a google storage file
         url = url_builder([self.google,scene_anatomy['sat'], scene_anatomy['path'], scene_anatomy['row'],filename])
         print url
         # Downloads and save at the location defined under path    
         fetch(url,path)
  
         return path
    def test_check_create_folder(self):
        new_path = utils.check_create_folder(self.temp_folder_test)

        self.assertEqual(new_path, self.temp_folder_test)
Пример #3
0
    def test_check_create_folder(self):
        new_path = utils.check_create_folder(self.temp_folder_test)

        self.assertEqual(new_path, self.temp_folder_test)