How to use the gbdxtools.auth.Auth function in gbdxtools

To help you get started, we’ve selected a few gbdxtools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DigitalGlobe / gbdxtools / gbdxtools / ordering.py View on Github external
def __init__(self, **kwargs):
        '''Instantiate the GBDX Ordering Interface

           Returns:
               An instance of the Ordering interface.
        '''
        interface = Auth(**kwargs)
        self.base_url = '%s/orders/v2' % interface.root_url
        self.gbdx_connection = interface.gbdx_connection
        self.logger = interface.logger
github DigitalGlobe / gbdxtools / gbdxtools / ipe / interface.py View on Github external
def __getattr__(self, name):
        return Op(name=name, interface=Auth())
github DigitalGlobe / gbdxtools / gbdxtools / workflow.py View on Github external
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
github DigitalGlobe / gbdxtools / gbdxtools / images / catalog_image.py View on Github external
def __init__(self, cat_id, band_type="MS", node="toa_reflectance", **kwargs):
        self.interface = Auth()
        self.vectors = Vectors()
        self._gid = cat_id
        self._band_type = band_type
        self._pansharpen = kwargs.get('pansharpen', False)
        self._acomp = kwargs.get('acomp', False)
        if self._pansharpen:
            self._node_id = 'pansharpened'
        else:
            self._node_id = node
        self._level = kwargs.get('level', 0)
        if 'proj' in kwargs:
            self._proj = kwargs['proj']
        if '_ipe_graphs' in kwargs:
            self._ipe_graphs = kwargs['_ipe_graphs']
        else:
            self._ipe_graphs = self._init_graphs()
github DigitalGlobe / gbdxtools / gbdxtools / images / util / image.py View on Github external
def is_available(cat_id):
    """
      Checks to see if a CatalogID is ingested in RDA and available to GBDXtools

      Args:
        catalogID (str): The catalog ID from the platform catalog.
      Returns:
        (bool): Whether or not the image is available in RDA
    """
    # checking for RDA metadata is the most authorative way to make
    # sure an image is available from RDA

    # TODO align with metadata fetch

    url = 'https://rda.geobigdata.io/v1/stripMetadata/{}'.format(cat_id)
    auth = Auth()
    r = _req_with_retries(auth.gbdx_connection, url)
    if r is not None:
        return r.status_code == 200
    return False
github DigitalGlobe / gbdxtools / gbdxtools / images / ipe_image.py View on Github external
def __init__(self, ipe_graph, gid, node="toa_reflectance", **kwargs):
        self.interface = Auth()
        self._gid = gid
        self._node_id = node
        self._dtype = kwargs.get("dtype", "float32")
        if self._node_id == "pansharpened":
            self._dtype = "uint16"
        if "proj" in kwargs:
            self._proj = kwargs["proj"]
        self._ipe_graphs = ipe_graph
        self._tile_size = kwargs.get("tile_size", 256)
        self._cfg = self._config_dask()
        super(IpeImage, self).__init__(**self._cfg)
        bounds = self._parse_geoms(**kwargs)
        if bounds is not None: 
            _cfg = self._aoi_config(bounds)
            super(IpeImage, self).__init__(**_cfg)
github DigitalGlobe / gbdxtools / gbdxtools / rda / interface.py View on Github external
def __getattr__(self, name):
        return Op(name=name, interface=Auth())
github DigitalGlobe / gbdxtools / gbdxtools / interface.py View on Github external
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()
github DigitalGlobe / gbdxtools / gbdxtools / images / browse_image.py View on Github external
def __init__(self, catalog_id, bbox=None):
        self._interface = Auth() 
        self.catalog_id = catalog_id
        self._get_image()
        self.metadata = self._get_metadata()
        self.shape = self.image.shape
        self.geom = self._get_geometry()
        self.xmin, self.ymin, self.xmax, self.ymax = self.geom.bounds
        self.cell_width = (self.xmax - self.xmin)/self.shape[1]
        self.cell_height = (self.ymax - self.ymin)/self.shape[0]
        self.bbox = bbox

        if self.bbox is not None:
            # find which cells intersect the bbox
            bbox_xmin, bbox_ymin, bbox_xmax, bbox_ymax = self.bbox
            window_xmin = int(np.floor((bbox_xmin - self.xmin)/self.cell_width))
            window_xmax = int(np.ceil((bbox_xmax - self.xmin)/self.cell_width))
            window_ymax = self.shape[0]-int(np.floor((bbox_ymin - self.ymin)/self.cell_height))
github DigitalGlobe / gbdxtools / gbdxtools / answerfactory.py View on Github external
def __init__(self, **kwargs):
        '''
        Construct an instance of an AnswerFactory Project

        Args:
            **kwargs

        Returns:
            An instance of a Project.

        '''
        interface = Auth(**kwargs)
        self.base_url = 'https://vector.geobigdata.io/answer-factory-project-service/api/project'
        self.gbdx_connection = interface.gbdx_connection
        self.logger = interface.logger