You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use the jupyter-execute directive to display maps using Google earth engine based images.
My main issue is that authenticating to GEE is a complex function that I need to set at the start of every single directive:
# only do the initialization if the credential are missingifnotee.data._credentials:
# if the credentials token is asved in the environment use itif"EARTHENGINE_TOKEN"inos.environ:
# write the token to the appropriate folderee_token=os.environ["EARTHENGINE_TOKEN"]
credential_folder_path=Path.home() /".config"/"earthengine"credential_folder_path.mkdir(parents=True, exist_ok=True)
credential_file_path=credential_folder_path/"ee-private-key.json"credential_file_path.write_text(ee_token)
# connect to the service accountcredentials=ee.ServiceAccountCredentials("", str(credential_file_path))
ee.Initialize(credentials=credentials, http_transport=httplib2.Http())
else:
# with suppress(Exception):AuthEE().authenticate("earth-engine-ldc-rs-test")
Is there a way to make it once and for all (e.g. in index.rst) and make sure I use the same kernel everywhere ?
A minimal example would be to share a variable between 2 executions:
.. jupyter-execute::
a = 5
a
.. jupyter-execute::
a += 5
a
Thanks for your help
The text was updated successfully, but these errors were encountered:
I believe that using a standard logic for evaluation of code is a useful design constraint for us. So far jupyter-sphinx follows the concept of "like a notebook" sequential execution, which makes it easy to understand. In your minimal example, I believe, the state will be shared if the two directives happen within the same document (or more specifically within the same jupyter-kernel directive in one document.
My own solution for initialization code that goes into all documents would be some flavor of the following:
Defining a script and adding from tools import initialize_notebook; initialize_notebook() hidden to the start of each notebook.
Doing the same but in an .rst file and .. includeing it everywhere.
If either of the above is too verbose, writing an own mini-extension that adds this code in the begining of each document, although I think I'd rather tolerate the copy-paste.
I would like to use the jupyter-execute directive to display maps using Google earth engine based images.
My main issue is that authenticating to GEE is a complex function that I need to set at the start of every single directive:
Is there a way to make it once and for all (e.g. in index.rst) and make sure I use the same kernel everywhere ?
A minimal example would be to share a variable between 2 executions:
Thanks for your help
The text was updated successfully, but these errors were encountered: