Skip to main content

Coding (Experiment)

After entering your credentials and signing in, you will see following message:

A screenshot of a computer Description automatically generated

For details on the different environment please refer to the JupyterHub — JupyterHub documentation Additional templates specific for each Initiative may be provided.

After selecting an environment, a message like the following will appear:

A screenshot of a computer Description automatically generatedThis process aims at provisioning resources typically takes only a few seconds, but it may take up to a minute to complete.

Once the provisioning or connection process is finished, you will be directed to the main server interface. This interface will provide you with various options to manage your private server and access your data storage:

A screenshot of a computer Description automatically generated

Supercharge your EO development within PAL’s familiar interface, by leveraging our integrated code environment, built on JupyterHub and Jupyter notebooks, to seamlessly integrate advanced Python libraries like GDAL, Rasterio, and xarray.

Collaborate and share your findings with ease, fostering a data-driven approach to Earth observation.

PAL’s code environment unlocks powerful capabilities, empowering you to extract the deepest insights from our planet’s data.

If the user needs to change the environment, he must first stop the running environment and return to the home page where he can select a different environment. This can be done by selecting File->Hub Control Panel and clicking Stop My Server. Then clicking Start My Server will redirect the user to the Server Options page where he can select a different environment.

The following pages provide a guidance to the Experiment services and capabilities.

Using the Python API

The Python API is a set of functions and methods that allows developers to interact with Python applications and libraries. These APIs are used to perform a wide range of tasks, such as retrieving data, sending commands, and integrating with other systems.

Python APIs are typically implemented as modules or packages that can be imported into Python code. Once an API is imported, developers can use the functions and methods provided by the API to interact with the application or library.

Some examples of popular Python APIs that will be available in the Code Experiment:

  • Requests: A library for making HTTP requests

  • NumPy: A library for scientific computing

  • Pandas: A library for data analysis and manipulation

  • Scikit-learn: A library for machine learning

  • GDAL: A library which is a set of Python bindings for the GDAL geospatial data abstraction library. GDAL is a translator library for raster and vector geospatial data formats.

To use a Python API, developers typically need to:

  • Install the API module or package. This is optional if the list of packages needed to the user is already available in the default installation.

  • Import the API into their Python code and/or notebooks.

Use the functions and methods provided by the API to interact with the application or library.

Default list of packages

You can retrieve the list of pre-installed packages by:

  • Opening a Terminal,

  • Typing the command conda list.

Install new packages

When installing new packages, you can leverage Python environments.

The following steps create an environment, install an arbitrary package and make it available to be used in a Notebook.

Create a new environment

python -m venv /home/jovyan/my_env

Activate it

source /home/jovyan/my_env/bin/activate

Install a new package

pip install dvc # dvc is an arbitrary package in this example.

Enable the environment for usage in a notebook’s kernel

  • Type:

pip install ipykernel
python -m venv /home/jovyan/my_env
ipython kernel install --user --name=my_env
  • Refresh the browser.

Going Deep: Ensuring Reproducible Results

A dedicated Python environment is essential for achieving reproducible results with your Python notebooks. Here’s how it helps:

  • Isolated Dependencies: An environment allows you to manage the specific versions of libraries and packages required for your notebook. This prevents conflicts with other projects or system-wide installations that might have different dependencies.

  • Repeatability Across Systems: By capturing the exact set of packages and their versions within the environment, you can ensure your notebook executes consistently, regardless of the machine or environment it’s run on. This is crucial for sharing notebooks with colleagues or replicating your work later.

Consider this scenario:

Without an environment, you might have several versions of libraries installed on your system. If your notebook relies on a specific version of a library (e.g., pandas==1.4.1), running it on another machine with a different version (e.g., pandas==1.5.0) could lead to unexpected behavior or errors.

Using a Python environment solves this issue by guaranteeing a consistent set of dependencies for your notebook, promoting reliable and reproducible results.