planetlabs / notebooks

interactive notebooks from Planet Engineering
https://developers.planet.com/
Apache License 2.0
617 stars 303 forks source link

ndvi_planetscope requests API key #54

Closed robmarkcole closed 6 years ago

robmarkcole commented 6 years ago

Running the Docker container, the notebook ndvi_planetscope.ipynb requests my API key at the line !planet data download --item-type PSScene4Band --dest data --asset-type analytic,analytic_xml --string-in id 20160831_180302_0e26. It appears that the environment variable PL_API_KEY is not being set correctly. I tried setting the key within the notebook using %env PLANET_API_KEY='my_key' but this also results in the error Error: InvalidAPIKey: {"message": "Please enter your API key.", "errors": []}

The following was successful !planet --api-key my_key data download --item-type PSScene4Band --dest data --asset-type analytic,analytic_xml --string-in id 20160831_180302_0e26

Note you also don't set %matplotlib inline in this notebook

sarasafavi commented 6 years ago

@robmarkcole please double-check the API key you passed into the container via docker run.

From any Notebook, you can do this by adding a codeblock and running:

import os
print(os.getenv("PL_API_KEY"))

If the value printed is anything other than the string '12345', where 12345 is your API key, then you need to re-run docker run with the correct API key.

NOTE: your output value may be e.g., '[12345]' -- that's a common mis-reading of the README instructions. Please note that the square brackets are not part of an API key to pass in!

Note you also don't set %matplotlib inline in this notebook

This Notebook uses plt.show() to trigger inline figure displays, and likewise %matplotlib inline is not necessary:

image

robmarkcole commented 6 years ago

@sarasafavi I was indeed using the [ ]

Re the %matplotlib inline, the first time I run the cell no plot is displayed, I just see:

image

This is why I concluded %matplotlib inline is required. However on running the cell a second time, the plot is displayed..!

tarnetintern commented 4 years ago

@sarasafavi I was indeed using the [ ]

Re the %matplotlib inline, the first time I run the cell no plot is displayed, I just see:

image

This is why I concluded %matplotlib inline is required. However on running the cell a second time, the plot is displayed..!

U need use jupyter notebook. I see you using another kernel