Esempio n. 1
0
 def test_idaho_create_leaflet_viewer(self):
     i = Idaho()
     catid = '10400100203F1300'
     temp_file = tempfile.mkstemp(".html",
                                  "test_idaho_create_leaflet_viewer")
     i.create_leaflet_viewer(i.get_images_by_catid(catid=catid),
                             temp_file[1])
     assert os.path.getsize(temp_file[1]) > 0
Esempio n. 2
0
 def test_idaho_get_chip(self):
     i = Idaho()
     catid = '10400100203F1300'
     result = i.get_chip([
         -105.00032901763916, 39.91207173503864, -104.99874114990234,
         39.91310862390189
     ], catid)
     assert result
Esempio n. 3
0
    def test_find_idaho_by_catid_aoi(self):

        # define the tile we wish to generate
        catID = '1040010019C0BA00'
        aoi = 'POLYGON((-122.44612884547678 37.80341457084377,-122.43866157557932 37.80341457084377,-122.43866157557932 37.79785341558664,-122.44612884547678 37.79785341558664,-122.44612884547678 37.80341457084377))'

        i = Idaho(gbdx)
        result = i.get_idaho_by_catid_and_aoi(catid=catID, aoiWKT=aoi)
        assert len(result['results']) == 2
Esempio n. 4
0
    def test_get_idaho_chip(self):

        multi_id = '98ce43c5-b4a8-45aa-8597-ae7017ecefb2'
        pan_id = '5e47dfec-4685-476a-94ec-8589e06df349'

        i = Idaho(gbdx)
        i.get_idaho_chip(bucket_name='idaho-images',
                         idaho_id=multi_id,
                         center_lat='48.8611',
                         center_lon='2.3358',
                         pan_id=pan_id,
                         output_folder=self._temp_path)
        assert os.path.isfile(os.path.join(self._temp_path, multi_id + '.tif'))
Esempio n. 5
0
    def test_get_idaho_chip(self):

        multi_id = '98ce43c5-b4a8-45aa-8597-ae7017ecefb2'
        pan_id = '5e47dfec-4685-476a-94ec-8589e06df349'

        i = Idaho(gbdx)
        i.get_idaho_chip(bucket_name='idaho-images',
                         idaho_id=multi_id,
                         center_lat='48.8611',
                         center_lon='2.3358',
                         pan_id=pan_id,
                         output_folder=self._temp_path)
        assert os.path.isfile(os.path.join(self._temp_path, multi_id+'.tif'))
Esempio n. 6
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()
Esempio n. 7
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()
Esempio n. 8
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)
Esempio n. 9
0
 def test_idaho_get_images_by_catid(self):
     i = Idaho(self.gbdx)
     catid = '10400100203F1300'
     results = i.get_images_by_catid(catid=catid)
     assert len(results['results']) == 12
Esempio n. 10
0
 def test_idaho_get_chip(self):
     i = Idaho()
     catid = '10400100203F1300'
     result = i.get_chip([-105.00032901763916, 39.91207173503864, -104.99874114990234, 39.91310862390189], catid)
     assert result
Esempio n. 11
0
 def test_idaho_get_images_by_catid_and_aoi(self):
     i = Idaho(self.gbdx)
     catid = '10400100203F1300'
     aoi_wkt = "POLYGON ((-105.0207996368408345 39.7338828628182839, -105.0207996368408345 39.7365972921260067, -105.0158751010894775 39.7365972921260067, -105.0158751010894775 39.7338828628182839, -105.0207996368408345 39.7338828628182839))"
     results = i.get_images_by_catid_and_aoi(catid=catid, aoi_wkt=aoi_wkt)
     assert len(results['results']) == 2
Esempio n. 12
0
 def test_idaho_describe_images(self):
     i = Idaho()
     catid = '10400100203F1300'
     description = i.describe_images(i.get_images_by_catid(catid=catid))
     assert description['10400100203F1300']['parts'][1]['PAN'][
         'id'] == 'b1f6448b-aecd-4d9b-99ec-9cad8d079043'
Esempio n. 13
0
 def test_idaho_get_chip2(self):
     i = Idaho()
     catid = '10400100384B1B00'
     result = i.get_chip([120.45363429504926, 30.247785383721883, 120.45511487442548, 30.249008773017273], catid)
     assert result
Esempio n. 14
0
 def test_idaho_get_images_by_catid_and_aoi(self):
     i = Idaho()
     catid = '10400100203F1300'
     aoi_wkt = "POLYGON ((-105.0207996368408345 39.7338828628182839, -105.0207996368408345 39.7365972921260067, -105.0158751010894775 39.7365972921260067, -105.0158751010894775 39.7338828628182839, -105.0207996368408345 39.7338828628182839))"
     results = i.get_images_by_catid_and_aoi(catid=catid, aoi_wkt=aoi_wkt)
     assert len(results['results']) == 2
Esempio n. 15
0
 def test_idaho_get_images_by_catid(self):
     i = Idaho()
     catid = '10400100203F1300'
     results = i.get_images_by_catid(catid=catid)
     assert len(results['results']) == 12
Esempio n. 16
0
 def test_idaho_get_tms_layer(self):
     i = Idaho()
     catid = '10400100203F1300'
     result = i.get_tms_layers(catid)
     assert len(result[0]) == 6
Esempio n. 17
0
 def test_init(self):
     c = Idaho()
     self.assertTrue(isinstance(c, Idaho))
Esempio n. 18
0
 def test_idaho_create_leaflet_viewer(self):
     i = Idaho()
     catid = '10400100203F1300'
     temp_file = tempfile.mkstemp(".html", "test_idaho_create_leaflet_viewer")
     i.create_leaflet_viewer(i.get_images_by_catid(catid=catid), temp_file[1])
     assert os.path.getsize(temp_file[1]) > 0
Esempio n. 19
0
 def test_idaho_describe_images(self):
     i = Idaho(self.gbdx)
     catid = '10400100203F1300'
     description = i.describe_images(i.get_images_by_catid(catid=catid))
     assert description['10400100203F1300']['parts'][1]['PAN']['id'] =='b1f6448b-aecd-4d9b-99ec-9cad8d079043'
Esempio n. 20
0
 def test_idaho_get_chip(self):
     i = Idaho()
     catid = '10400100203F1300'
     filename = os.path.join(self._temp_path, 'chip.tif')
     result = i.get_chip([-105.00032901763916, 39.91207173503864, -104.99874114990234, 39.91310862390189], catid, filename=filename)
     assert result
Esempio n. 21
0
def test_init():
    i = Idaho(gbdx)
    assert isinstance(i, Idaho)
Esempio n. 22
0
 def test_idaho_get_chip2(self):
     i = Idaho()
     catid = '10400100384B1B00'
     filename = os.path.join(self._temp_path, 'chip2.tif')
     result = i.get_chip([120.45363429504926, 30.247785383721883, 120.45511487442548, 30.249008773017273], catid, filename=filename)
     assert result
Esempio n. 23
0
 def setUpClass(cls):
     i = Idaho(gbdx)
     assert isinstance(i, Idaho)
     cls._temp_path = tempfile.mkdtemp()
     print("Created: {}".format(cls._temp_path))
Esempio n. 24
0
 def test_idaho_get_tms_layer(self):
     i = Idaho()
     catid = '10400100203F1300'
     result = i.get_tms_layers(catid)
     assert len(result[0]) == 6