Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 400 when try to run crop-temporal.ipynb #98

Closed
suredream opened this issue Nov 14, 2019 · 3 comments
Closed

Error 400 when try to run crop-temporal.ipynb #98

suredream opened this issue Nov 14, 2019 · 3 comments

Comments

@suredream
Copy link

https://github.com/planetlabs/notebooks/blob/master/jupyter-notebooks/temporal-analysis/crop-temporal.ipynb

I met difficulty to run the In [23]:

ERROR 11: HTTP response code: 400

The step is crucial since I have to do some download using the API (my token works in other cases.)

Any idea?

we use gdalwarp and the crop_to_cutline argument to only download the aoi portion of the COG

def _gdalwarp(input_filename, output_filename, options, verbose=False):
commands = ['gdalwarp'] + options +
['-overwrite',
input_filename,
output_filename]
if verbose: print(' '.join(commands))
subprocess.check_call(commands)

def download_scene_aoi(download_url, output_filename, geojson_filename, verbose=False):
vsicurl_url = '/vsicurl/' + download_url
options = [
'-cutline', geojson_filename,
'-crop_to_cutline',
]
_gdalwarp(vsicurl_url, output_filename, options, verbose=verbose)

%time download_scene_aoi(download_url, output_file, geojson_filename, verbose=True)

Also try to run the gdal command line in bash, same error:

$ gdalwarp -cutline data/87/aoi.geojson -crop_to_cutline -overwrite /vsicurl/https://api.planet.com/data/v1/download?token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJKTEgzM1VsU2h4aGJXMUw5VWxwZUlHOGFWNXoyOEtmZVdTUE04Zk4wTStaWmsrRTNITFlRb3BJaTk2SklUT05EMTY1ME51ajl4RkhKM3FzbXZSbUZ1Zz09IiwiaXRlbV90eXBlX2lkIjoiUFNTY2VuZTRCYW5kIiwidG9rZW5fdHlwZSI6InR5cGVkLWl0ZW0iLCJleHAiOjE1MzAwNTQyMzMsIml0ZW1faWQiOiIyMDE3MDgxOF8xOTA2MjlfMTA1MCIsImFzc2V0X3R5cGUiOiJhbmFseXRpY19zciJ9.FkxnWYQgyXfnmkQlgacssXuVvVuUe9RQuo1xkxYNcXkE64TGy4P7Z6OqWGeARp1mXHK8ENyEODGwEJtXFLSaHw data/87/20170818_190629_1050.tif

@jreiberkyle
Copy link
Contributor

Hmm.. I am getting the same error. I will investigate further.

@jreiberkyle
Copy link
Contributor

Oh! That download token is likely no longer valid. You should make sure to activate the scene right before downloading it. The activation is performed in the section above the download section you are referencing here.

@jreiberkyle
Copy link
Contributor

I found this step is still failing, but due to build issues in the current docker image. This failure is documented in #101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants