Exemple #1
0
    def __init__(self, **kwargs):
        interface = Auth(**kwargs)
        self.gbdx_connection = interface.gbdx_connection
        self.root_url = interface.root_url
        self.logger = interface.logger

        # create and store an instance of the GBDX s3 client
        self.s3 = S3()

        # create and store an instance of the GBDX Ordering Client
        self.ordering = Ordering()

        # create and store an instance of the GBDX Catalog Client
        self.catalog = Catalog()

        # create and store an instance of the GBDX Workflow Client
        self.workflow = Workflow()

        # create and store an instance of the Idaho Client
        self.idaho = Idaho()

        self.vectors = Vectors()

        self.catalog_image = CatalogImage
        self.idaho_image = IdahoImage

        self.task_registry = TaskRegistry()
Exemple #2
0
    def __init__(self, **kwargs):
        interface = Auth(**kwargs)
        self.gbdx_connection = interface.gbdx_connection
        self.root_url = interface.root_url
        self.logger = interface.logger

        # create and store an instance of the GBDX s3 client
        self.s3 = S3()

        # create and store an instance of the GBDX Ordering Client
        self.ordering = Ordering()

        # create and store an instance of the GBDX Catalog Client
        self.catalog = Catalog()

        # create and store an instance of the GBDX Workflow Client
        self.workflow = Workflow()

        # create and store an instance of the Idaho Client
        self.idaho = Idaho()

        self.vectors = Vectors()

        self.catalog_image = CatalogImage
        self.idaho_image = IdahoImage
        self.landsat_image = LandsatImage
        self.sentinel2 = Sentinel2
        self.tms_image = TmsImage
        self.dem_image = DemImage
        self.wv03_vnir = WV03_VNIR
        self.wv02 = WV02
        self.ge01 = GE01
        self.s3_image = S3Image

        self.task_registry = TaskRegistry()
Exemple #3
0
    def test_download(self):
        location = 'nikki/gbdxtools_test_s3'
        s = S3(self.gbdx)
        s.download(location, local_dir=self._temp_path)

        assert os.path.isfile(os.path.join(self._temp_path, 'test_dir', 'model.json'))
        assert os.path.isfile(os.path.join(self._temp_path, 'model.json'))
Exemple #4
0
 def test_get_s3_creds(self):
     s = S3()
     assert s.info is not None
     assert "bucket" in s.info.keys()
     assert "prefix" in s.info.keys()
     assert "S3_secret_key" in s.info.keys()
     assert "S3_access_key" in s.info.keys()
     assert "S3_session_token" in s.info.keys()
Exemple #5
0
    def __init__(self, **kwargs):
        interface = Auth(**kwargs)
        self._base_url = '%s/workflows/v1/tasks' % interface.root_url

        # store a reference to the GBDX Connection
        self.gbdx_connection = interface.gbdx_connection

        # store a ref to the s3 interface
        self.s3 = S3()

        # the logger
        self.logger = interface.logger
Exemple #6
0
    def __init__(self, **kwargs):
        host = kwargs.get('host') if kwargs.get('host') else 'geobigdata.io'
        self.root_url = 'https://%s' % host

        if (kwargs.get('username') and kwargs.get('password')
                and kwargs.get('client_id') and kwargs.get('client_secret')):
            self.gbdx_connection = gbdx_auth.session_from_kwargs(**kwargs)
        elif kwargs.get('gbdx_connection'):
            # Pass in a custom gbdx connection object, for testing purposes
            self.gbdx_connection = kwargs.get('gbdx_connection')
        else:
            # This will throw an exception if your .ini file is not set properly
            self.gbdx_connection = gbdx_auth.get_session(
                kwargs.get('config_file'))

        # create a logger
        # for now, just log to the console. We'll replace all the 'print' statements
        # with at least logger.info or logger.debug statements
        # later, we can log to a service, file, or some other aggregator
        self.logger = logging.getLogger('gbdxtools')
        self.logger.setLevel(logging.ERROR)
        console_handler = logging.StreamHandler()
        console_handler.setLevel(logging.ERROR)
        formatter = logging.Formatter(
            '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        console_handler.setFormatter(formatter)
        self.logger.addHandler(console_handler)
        self.logger.info('Logger initialized')

        # create and store an instance of the GBDX s3 client
        self.s3 = S3(self)

        # create and store an instance of the GBDX Ordering Client
        self.ordering = Ordering(self)

        # create and store an instance of the GBDX Catalog Client
        self.catalog = Catalog(self)

        # create and store an instance of the GBDX Workflow Client
        self.workflow = Workflow(self)

        # create and store an instance of the Idaho Client
        self.idaho = Idaho(self)

        self.vectors = Vectors(self)

        self.task_registry = TaskRegistry(self)
Exemple #7
0
    def __init__(self, **kwargs):
        """Construct the Workflow instance

        Returns:
            An instance of the Workflow class.
        """
        interface = Auth(**kwargs)
        self.base_url = '%s/workflows/v1' % interface.root_url
        self.workflows_url = '%s/workflows' % self.base_url

        # store a reference to the GBDX Connection
        self.gbdx_connection = interface.gbdx_connection

        # store a ref to the s3 interface
        self.s3 = S3()

        # the logger
        self.logger = interface.logger
Exemple #8
0
 def test_bucket_init(self):
     s = S3()
     assert isinstance(s, S3)
Exemple #9
0
 def setUp(self):
     self._mock_s3 = mock_s3()
     self._mock_s3.start()
     pre_load_s3_data(self._bucket_name, self._prefix)
     self.s3 = S3()
     self.s3.info = self._info
Exemple #10
0
def test_bucket_init():
    s = S3(gbdx)
    assert isinstance(s, S3)