DigitalGlobe / gbdxtools

(Deprecated) Python SDK for using GBDX
MIT License
74 stars 57 forks source link

Instantiating CatalogImage using idahoImageId does not work #818

Closed Embi closed 4 years ago

Embi commented 4 years ago

Local envritonment:

python: 3.6.7 gbdxtools: 0.17.0

import gbdxtools
gbdxtools.CatalogImage('7a8eb8e5-a4c7-4088-bc2c-69a809839bd0')

fails on:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
    gbdxtools.CatalogImage('7a8eb8e5-a4c7-4088-bc2c-69a809839bd0')
  File "/home/...../lib/python3.6/site-packages/gbdxtools/images/catalog_image.py", line 60, in __new__
    raise ImageNotAvailable(msg)
gbdxtools.rda.error.ImageNotAvailable: 
7a8eb8e5-a4c7-4088-bc2c-69a809839bd0 is not available in RDA. Order the image, or wait for an order to complete and finish ingestion into RDA

When executing:

import gbdxtools
c = gbdxtools.Catalog()
c.get('7a8eb8e5-a4c7-4088-bc2c-69a809839bd0')

c.get() returns:

{'identifier': '7a8eb8e5-a4c7-4088-bc2c-69a809839bd0',
 'properties': {'acquisitionDate': '2018-02-06T09:48:46.220Z',
                'bucketName': 'rda-images-1',
                'catalogID': '105001000E383200',
                'cloudCover': 8,
                'colorInterpretation': 'BGRN',
                'dataType': 'UNSIGNED_SHORT',
                'epsgCode': 4326,
                'footprintWkt': 'MULTIPOLYGON(((16.39330174 49.99372972, '
                                '16.169886 49.9931278, 16.14935829 '
                                '49.83626595, 16.36990138 49.83573822, '
                                '16.39330174 49.99372972)))',
                'groundSampleDistanceMeters': 1.946,
                'idahoImageId': '7a8eb8e5-a4c7-4088-bc2c-69a809839bd0',
                'imageHeight': 7988,
                'imageWidth': 9376,
                'nativeTileFileFormat': 'TIF',
                'numBands': 4,
                'numXTiles': 37,
                'numYTiles': 32,
                'offNadirAngle': 23.8,
                'platformName': 'GEOEYE01',
                'pniirs': 2.9,
                'profileName': 'dg_1b',
                'satAzimuth': 64.0,
                'satElevation': 63.5,
                'sensorName': '4-band (Blue, Green, Red, NIR) Multispectral',
                'sensorPlatformName': 'GEOEYE01',
                'sunAzimuth': 159.1,
                'sunElevation': 22.3,
                'tileBucketName': 'rda-images-1',
                'tilePartition': '0000',
                'tileXOffset': 0,
                'tileXSize': 0,
                'tileYOffset': 0,
                'tileYSize': 0,
                'timestamp': '2018-02-06T09:48:46.220Z',
                'vendor': 'DigitalGlobe',
                'vendorDatasetIdentifier': 'LV1B:011734563010_01_P003:105001000E383200:A01001056E578800',
                'vendorName': 'DigitalGlobe, Inc.',
                'version': 1.1},
 'type': ['GBDXCatalogRecord', 'IDAHOImage', 'DigitalGlobeProduct', 'GE01']}

When using gbdxtools==0.16.7 it works just fine.

Embi commented 4 years ago

Also executing

import gbdxtools
gbdxtools.IdahoImage('7a8eb8e5-a4c7-4088-bc2c-69a809839bd0')

fails on

Traceback (most recent call last):
  File "<input>", line 1, in <module>
    gbdxtools.IdahoImage('7a8eb8e5-a4c7-4088-bc2c-69a809839bd0')
  File "/home/..../lib/python3.6/site-packages/gbdxtools/images/base.py", line 10, in __new__
    self = super(RDABaseImage, cls).__new__(cls, cls.__driver__.payload, **kwargs)
  File "/home/...../lib/python3.6/site-packages/gbdxtools/images/rda_image.py", line 128, in __new__
    cls.__geo__ = RDAGeoAdapter(op.metadata, dfp=cls._default_proj)
  File "/home/..../lib/python3.6/site-packages/gbdxtools/rda/interface.py", line 60, in metadata
  File "/home/..../lib/python3.6/site-packages/gbdxtools/rda/interface.py", line 207, in graph
  File "/home/..../lib/python3.6/site-packages/gbdxtools/rda/graph.py", line 69, in get_rda_metadata
    except:
gbdxtools.rda.error.BadRequest: RDA error: java.lang.NullPointerException. RDA Graph: c1ea6e5dc78bd784c2abca2556d33c58e344cc4ded13c24572e9910bd8051e31
drwelby commented 4 years ago

Because of deprecations to the Idaho service and to the RDA Graph API you will need to provide CatalogImage with a Catalog ID. So if you are starting with an Idaho ID, you will need to query the catalog to find its Catalog ID first.

drwelby commented 4 years ago

Following up after some troubleshooting:

img = IdahoImage('7a8eb8e5-a4c7-4088-bc2c-69a809839bd0', bucket="rda-images-1")

Embi commented 4 years ago

Hi @drwelby - just to be sure - are we safe to use IdahoImage after April 27?

e.g.:

IdahoImage('7a8eb8e5-a4c7-4088-bc2c-69a809839bd0', bucket="rda-images-1") 
drwelby commented 4 years ago

@Embi in GBDXtools 0.17+ IdahoImage has been migrated to use the Template API and will not be affected by the Graph API deprecation.

drwelby commented 4 years ago

Fixed in 0.17.0.post1