> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tilebox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sample notebooks

> Get started quickly with ready-to-run Jupyter notebooks that demonstrate common satellite data access and analysis workflows using the Tilebox Python SDK.

To quickly become familiar with the Python client, you can explore some sample notebooks. Each notebook can be executed standalone from top to bottom.

## Sample notebooks

You can access the sample notebooks on [<Icon icon="google-drive" /> Google Drive](https://drive.google.com/drive/folders/1I7G35LLeB2SmKQJFsyhpSVNyZK9uOeJt).

<Tip>
  Right click a notebook in Google Drive and select `Open with -> Google Colaboratory` to open it directly in the browser using [Google Colab](https://colab.research.google.com/).
</Tip>

More examples can be found throughout the docs.

### Notebook overview

<AccordionGroup>
  <Accordion title="ERS Opendata Access">
    This notebook demonstrates how to use to query metadata from the ERS-SAR Opendata dataset. It shows how to filter results by geographical location and download product data for a specific granule.

    [<Icon icon="arrow-up-right-from-square" /> Open in
    Colab](https://colab.research.google.com/drive/1LTYhLKy8m9psMhu0DvANs7hyS3ViVpas)
  </Accordion>

  <Accordion title="S5P Tropomi Methane Data Access">
    This notebook illustrates how to query the S5P Tropomi Opendata dataset for methane products. It also explains how to filter results based on geographical location and download product data for a specific granule.

    [<Icon icon="arrow-up-right-from-square" /> Open in
    Colab](https://colab.research.google.com/drive/1eVYARNFnTIeQqBs6gqeay01EDvRk2EI4)
  </Accordion>

  <Accordion title="MODIS-based Dataset Ingestion">
    This notebook demonstrates how to ingest data into a Dataset. In this case it's using a prepared sample dataset from the [MODIS instrument](https://lpdaac.usgs.gov/products/mcd12q1v006/).

    [<Icon icon="arrow-up-right-from-square" /> Open in
    Colab](https://colab.research.google.com/drive/1QS-srlWPMJg4csc0ycn36yCX9U6mvIpW)
  </Accordion>

  <Accordion title="Sentinel-2 Cloud-free Mosaic">
    Created with Tilebox Workflows, this 10m resolution mosaic highlights distributed, auto-parallelizing capabilities.
    Data from `Copernicus Dataspace` was reprojected on `CloudFerro` (intermediate products on AWS S3), and the final composite was built locally using auto-parallelized team notebooks.

    [<Icon icon="arrow-up-right-from-square" /> Open the Mosaic](https://examples.tilebox.com/sentinel2_mosaic)

    [<Icon icon="arrow-up-right-from-square" /> Open in
    Github](https://github.com/tilebox/examples/tree/main/s2-cloudfree-mosaic)
  </Accordion>

  <Accordion title="Generate VCI and FPAR visualizations">
    A workflow for calculating the Vegetation Condition Index (VCI) from FPAR data. It can be run on one or more local machines or on a cloud cluster.

    [<Icon icon="arrow-up-right-from-square" /> View on YouTube](https://youtu.be/s4wzyX9adWo)

    [<Icon icon="arrow-up-right-from-square" /> Open in
    Github](https://github.com/tilebox/fpar-based-vci-example)
  </Accordion>
</AccordionGroup>

Execute cells one by one using `Shift+Enter`. Most commonly used libraries are pre-installed.

<Note>All demo notebooks require Python 3.10 or higher.</Note>

## Interactive environments

Jupyter, Google Colab, and JetBrains Datalore are interactive environments that simplify the development and sharing of algorithmic code. They allow users to work with notebooks, which combine code and rich text elements like figures, links, and equations. Notebooks require no setup and can be easily shared.

<AccordionGroup>
  <Accordion title="Jupyter">
    [Jupyter notebooks](https://jupyter.org/) are the original interactive environment for Python. They are useful but require local installation.
  </Accordion>

  <Accordion title="Google Colab">
    [Google Colab](https://colab.research.google.com/) is a free tool that provides a hosted interactive Python environment. It easily connects to local Jupyter instances and allows code sharing using Google credentials or within organizations using Google Workspace.
  </Accordion>

  <Accordion title="JetBrains Datalore">
    [JetBrains Datalore](https://datalore.jetbrains.com/) is a free platform for collaborative testing, development, and sharing of Python code and algorithms. It has built-in secret management for storing credentials. Datalore also features advanced JetBrains syntax highlighting and autocompletion. Currently, it only supports Python 3.8, which is not compatible with the Tilebox Python client.
  </Accordion>
</AccordionGroup>

Since Colab is a hosted free tool that meets all requirements, including Python ≥3.10, it's recommended for use.

## Installing packages

Within your interactive environment, you can install missing packages using pip in "magic" cells, which start with an exclamation mark.

```bash theme={"system"}
# pip is already installed in your interactive environment
!pip3 install ....
```

All APIs or commands that require authentication can be accessed through client libraries that hide tokens, allowing notebooks to be shared without exposing personal credentials.

## Executing code

Execute code by clicking the play button in the top left corner of the cell or by pressing `Shift + Enter`. While the code is running, a spinning icon appears. When the execution finishes, the icon changes to a number, indicating the order of execution. The output displays below the code.

## Authorization

When sharing notebooks, avoid directly sharing your Tilebox API key. Instead, use one of two methods to authenticate the Tilebox Python client in interactive environments: through environment variables or interactively.

```python Using environment variables to store your API key theme={"system"}
# Define an environment variable "TILEBOX_API_KEY" that contains your API key
import os
token = os.getenv("TILEBOX_API_KEY")
```

**Interactive** authorization is possible using the built-in `getpass` module. This prompts the user for the API key when running the code, storing it in memory without sharing it when the notebook is shared.

```python Interactively providing your API key theme={"system"}
from getpass import getpass
token = getpass("API key:")
```
