Skip to main content

Downloader for EnMAP data products with STAC

Project description

Downloader for EnMAP data products with STAC

Status

Pipelines Coverage Documentation

See also the latest coverage report and the pytest HTML report.

Feature overview

The EnMAP Downloader is a Python-based tool designed to streamline access to hyperspectral imagery from the Earth Observation Center (EOC). It provides a flexible and efficient interface for searching, downloading, and preparing EnMAP data tailored to user-defined spatial and temporal criteria.

🌐 Download Hyperspectral EnMAP Data

  • Fetches .tif hyperspectral datasets (EnMAP L2A) directly from the EOC archive.

🗺️ User-Defined Spatial Parameters

  • Accepts a a single GeoJSON, or a folder of multiple GeoJSON files — each is handled automatically and clipped to the defined area.

🕒 User-Defined Temporal Filtering

  • Specify a date range to download only the scenes captured within that timeframe.

Multithreaded Downloads

  • Utilizes parallel downloading to significantly speed up large or batch operations on e.g. clusters.

📂 Batch Processing of Multiple AOIs

  • Efficiently processes multiple areas of interest in one go, especially useful for regional or project-wide data collection.

💾 Flexible Output Formats

  • Outputs data as GeoTIFFs (.tif) or NumPy arrays (.npy)—choose based on your workflow.

🔐 Authentication & Config File Support

  • Includes authentication checks and a customizable config file for repeatable, automated use.

Typical Use Cases

  • 🛰️ Collecting hyperspectral scenes for machine learning and remote sensing projects

  • 🗃️ Handling a large folder of AOIs automatically for environmental or urban monitoring

  • 🔄 Automating scheduled or repeatable data collection workflows

History / Changelog

You can find the protocol of recent changes in the EnMAP Downloader package here.

Credentials

To access the EnMAP data, you need to have a valid EOC account. You can register for an account at the EOC website. When running the code for the first time, a .env file will be created in the root directory of the package. This file will contain the following variables:

USERNAME=USERNAME
PASSWORD=PASSWORD

You can edit this file to securely add your EOC credentials. The package will automatically read the credentials from this file when executing the code.

Important: This file contains sensitive information. To protect your credentials, keep it private and do not share it with others.

The package requires valid credentials to function properly. If the credentials are missing or incorrect, you will receive an error message.

Once saved, your credentials will be stored in the .netrc file in your home directory. This means you won’t need to enter them again for future runs.

Quick Installation

To install the package, clone it into a local directory and run the following command:

python -m pip install .

Alternatively you can create a conda environment and install the package with its dependencies:

conda env create -f environment_enmap_downloader.yml
conda activate enmap_downloader
pip install .

Make sure to create a config.json file in the config directory. You can use the provided example file as a template. The config.json file should contain the following information:

{
"search_settings": {
    "collections": [
    "ENMAP_HSI_L2A"
    ],
    "catalog_link" : "https://geoservice.dlr.de/eoc/ogc/stac/v1/",
    "aoi_settings": {
        "bounding_box": "./config/geojson",
        "start_date": "",
        "end_date": ""
    }
},
"result_settings": {
    "results_dir": "./downloads",
    "result_format": "npy",
    "download_data": true,
    "download_metadata": false,
    "logging_level": "INFO",
    "logging_dir": "./logs"
}

Configuration Options

Below is a description of the configurable parameters in the configuration file used by this project.

AOI Settings

These settings define the area of interest (AOI) and the time window for data selection.

"aoi_settings": {
    "bounding_box": "./config/geojson",
    "start_date": "",
    "end_date": ""
}
  • bounding_box (str): Path to a GeoJSON file that defines the spatial bounding box for the area of interest.

  • start_date (str, optional): Start date for the data query, in YYYY-MM-DD format. Leave empty to ignore.

  • end_date (str, optional): End date for the data query, in YYYY-MM-DD format. Leave empty to ignore.

Result Settings

These settings control how the results are processed, saved, and logged.

"result_settings": {
    "crop_data": true,
    "results_dir": "./downloads",
    "result_format": "npy",
    "download_data": true,
    "download_metadata": false,
    "logging_level": "INFO",
    "logging_dir": "./logs"
}
  • crop_data (bool): If true, the data will be spatially cropped to the area defined by the AOI bounding box. If false, the entire source TIFF will be saved without cropping.

  • results_dir (str): Directory path where result files will be saved.

  • result_format (str): Format in which results are stored. Supported options: “npy” (NumPy array), “tif” (GeoTIFF).

  • download_data (bool): If true, the raw data will be downloaded, in the defined result_format.

  • download_metadata (bool): If true, associated metadata files will also be downloaded.

  • logging_level (str): Logging verbosity level. Typical values: “DEBUG”, “INFO”, “WARNING”, “ERROR”.

  • logging_dir (str): Directory where log files are saved.

Then you can use the package by running the following code block:

import os

from enmap_downloader.config import loadConfiguration, Config
from enmap_downloader.enmap_downloader import enmapDownloader

if __name__ == "__main__":

    config_file = os.path.abspath("config/config.json")
    config = loadConfiguration(path=config_file)
    Config(**config)

    enmapDownloader(config, in_parallel=True)

The function enmapDownloader has the following parameters:

  • config (Config): The configuration object containing all settings.

  • in_parallel (bool, optional): If True, the downloader will run in parallel mode, downloading multiple files simultaneously. Default is True.

  • num_workers (int, optional): Number of worker threads used by the ThreadPoolExecutor when in_parallel is True. Default is None, which uses the number of available CPU cores.

  • limit (int, optional): Maximum number of items to download per query. If None, all items matching the query will be downloaded. Default is None.

The downloader will search for EnMAP data products based on the configuration provided, download the data, and save it in the specified format and directory. The downloaded files will be logged in the specified logging directory.

Developed by

enmap_downloader has been developed by the Global Land Monitoring group and FERN.Lab at the GFZ Helmholtz Centre for Geosciences.

Credits

This package was created with Cookiecutter and the fernlab/cookiecutter-py-package project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enmap_downloader-0.5.1.tar.gz (43.5 kB view details)

Uploaded Source

File details

Details for the file enmap_downloader-0.5.1.tar.gz.

File metadata

  • Download URL: enmap_downloader-0.5.1.tar.gz
  • Upload date:
  • Size: 43.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for enmap_downloader-0.5.1.tar.gz
Algorithm Hash digest
SHA256 4fa9096add8f358e632558082a18d7276332a1d02927e7fed8c96407c4acdb6c
MD5 2525bcde583beb2228294757ecc012dc
BLAKE2b-256 44762481ad1a5c5617d7d759e0da9a41b3f71a1541e4e6dcdb060b9e40596350

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page