Skip to content

Repository files navigation

Insula API and Insula AI Jupyter Examples

A set of Jupyter Notebooks showing the usage of Insula's APIs, in particular:

Requirements

Each notebook has a line containing a pip install command with only the packages required to run it. If you prefer to install them all they are listed inside the file requirements.txt:

pip install -r requirements.txt

Create a Virtual Environment inside Jupyter

If you want these packages to survive Jupyter server reboots a virtual environment can be created. To do it open a terminal inside Jupyter and use the following commands:

# Create a new environment:
python -m venv /home/jovyan/InsulaNotebookEnv

# Make it active:
source /home/jovyan/InsulaNotebookEnv/bin/activate

# Install the required packages:
pip install -r requirements.txt

# Enable the environment for usage in a notebook’s kernel
pip install ipykernel
ipython kernel install --user --name=InsulaNotebookEnv

How to switch Insula instance

The first block will always be the one which generates the authorization and connects to the desired endpoint. Just change the values with the ones below to use it on another instance:

  • ESA-MAAP:
BASE_URL="https://biomass.pal.maap.eo.esa.int"
insulaAuth: InsulaOpenIDConnect = InsulaOpenIDConnect(
        authorization_endpoint="https://identity.pal.maap.eo.esa.int/realms/biomass/protocol/openid-connect/auth",
        token_endpoint="https://identity.pal.maap.eo.esa.int/realms/biomass/protocol/openid-connect/token",
        redirect_uri="http://localhost:9207/auth",
        client_id="api-client"
    )
  • DESP:
BASE_URL="https://insula.e2e-2.desp.space"
insulaAuth: InsulaOpenIDConnect = InsulaOpenIDConnect(
        authorization_endpoint="https://iam.e2e-2.desp.space/realms/desp/protocol/openid-connect/auth",
        token_endpoint="https://iam.e2e-2.desp.space/realms/desp/protocol/openid-connect/token",
        redirect_uri="https://broker.datawkfl.e2e-2.desp.space",
        client_id="hda-broker-public"
    )
  • FS-TEP:
BASE_URL="https://foodsecurity-explorer.insula.earth/"
insulaAuth: InsulaOpenIDConnect = InsulaOpenIDConnect(
        authorization_endpoint="https://identity.insula.earth/realms/foodsecurity-tep/protocol/openid-connect/auth",
        token_endpoint="https://identity.insula.earth/realms/foodsecurity-tep/protocol/openid-connect/token",
        redirect_uri="http://localhost:9207/auth",
        client_id="api-client"
    )
  • PHISAT2: Remember that the Phisat2 instance requires a mail verification. Before using the API be sure to log-in via ui at least once and complete the verification process.
BASE_URL="https://phisat2.insula.earth"
insulaAuth: InsulaOpenIDConnect = InsulaOpenIDConnect(
        authorization_endpoint="https://identity.insula.earth/realms/phisat2/protocol/openid-connect/auth",
        token_endpoint="https://identity.insula.earth/realms/phisat2/protocol/openid-connect/token",
        redirect_uri="http://localhost:9207/auth",
        client_id="api-client"
    )

About

Sample Jupyter Notebooks to access Insula APIs

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages