I am trying to download some NDVI data from USGS using the API but there seems to be a problem
!) Running the UsageExample.py seems to fail with error
3.8/bin/python /Users/henrysenyondo
/Downloads/usgs-machine-to-machine-API/UsageExample.py
Your login permissions is ['download', 'order']
Downloading:
The file size of LandsatLook Quality Image with entityId=LC81590152020212LGN00 is 2963678 bytes
Traceback (most recent call last):
File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/UsageExample.py", line 108, in <module>
main()
File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/UsageExample.py", line 99, in main
results = otherMethods.download(api, datasetName=datasetName, entityIds=entityId, productName=productName,
TypeError: download() got an unexpected keyword argument 'entityIds'
- Trying to search for all Landsat datasets
LANDSAT_8
instead of LANDSAT_8_C1
fails
#datasetName = 'LANDSAT_8_C1'
datasetName = 'LANDSAT_8'
3.8/bin/python /Users/henrysenyondo
/Downloads/usgs-machine-to-machine-API/UsageExample.py
Your login permissions is ['download', 'order']
{'requestId': 709498086, 'version': 'stable', 'sessionId': 133247086, 'data': None, 'errorCode': 'DATASET_INVALID', 'errorMessage': 'An invalid dataset has been provided'}
Traceback (most recent call last):
File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/UsageExample.py", line 108, in <module>
main()
File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/UsageExample.py", line 78, in main
sceneSearchResult = api.sceneSearch(datasetName=datasetName, maxResults=1, startingNumber=None,
File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/usgsMethods.py", line 759, in sceneSearch
_check_response(response)
File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/checkResponse.py", line 7, in _check_response
_check_usgs_error(response)
File "/Users/henrysenyondo/Downloads/usgs-machine-to-machine-API/checkResponse.py", line 94, in _check_usgs_error
raise usgsErrors.DATASET_INVALID(f'{errorCode}: {errorMessage}')
usgsErrors.DATASET_INVALID: DATASET_INVALID: An invalid dataset has been provided
- I tried to create a Region of interest, but the program returns
'recordsReturned': 0,
import shapely
import shapely.geometry
import shapely.geometry
import shapely.wkt
from pprint import pprint
site_points = shapely.geometry.Point((31.937769, -109.08029)).buffer(1)
site_polygon = shapely.geometry.Polygon(site_points)
points_string = str(site_polygon)[10:-2]
point_as_truple = points_string.split(",")
temp = [i.strip().split(" ") for i in point_as_truple]
ROI =[[[float(i[0]), float(i[1])] for i in temp]]
.
.....
results
/Downloads/usgs-machine-to-machine-API/UsageExample.py
Your login permissions is ['download', 'order']
{'data': {'isCustomized': False,
'nextRecord': 0,
'numExcluded': 0,
'recordsReturned': 0,
'results': [],
'startingNumber': 0,
'totalHits': 0,
'totalHitsAccuracy': 'calculated'},
'errorCode': None,
'errorMessage': None,
'requestId': 709518713,
'sessionId': 133248151,
'version': 'stable'}
Any help is much appreciated.