Skip to main content

Cloud Free Image Downloader

A small tool to download cloud free images from GEE. Also serves as an example that projects in the DLR MF-DAS organization should follow. You should copy the CI/CD set-up and other practices for your repository.

Installation

This tool relies on Google Earth Engine's Python API which cannot be installed automatically as a dependency. You need to install it from conda-forge in your conda environment:

conda install -c conda-forge earthengine-api

This is assuming you already have a conda environment activated. To install from source code you can do the following:

git clone git@github.com:DLR-MF-DAS/gee_downloader.git
cd gee_downloader
pip install -e .

Or if you don't want the source code you can do:

pip install git+git@github.com:DLR-MF-DAS/gee_downloader.git

Usage

Authenticate to Google Earth Engine (note that authentication mode should be set to notebook)

earthengine authenticate --auth_mode notebook

Then you can run the script by executing the module with the -m flag.

python3 -m gee_downloader --help

Which will tell you what the options for the script are.

Usage: python -m gee_downloader [OPTIONS]

Options:
  -i, --geojson TEXT      Area of interest in the GeoJSON format  [required]
  -s, --start-date TEXT   Starting date for the composite (yyyy-mm-dd)
                          [required]
  -e, --end-date TEXT     End date for the composite (yyyy-mm-dd)  [required]
  -o, --output-file TEXT  File to write the results to  [required]
  --help                  Show this message and exit.

For designing command line interfaces I recomment the click library for Python - https://click.palletsprojects.com/. The implementation of the script can be found under src/gee_downloader/__main__.py. Please consider following this structure if your project requires you to provide an executable script.

To download some actual data you can try the following arguments from inside the repository file structure of this project.

python3 -m gee_downloader -i test/munich.json -s 2019-01-01 -e 2019-04-01 --output-file test.tiff

Which should result in a 13 band image part of which looks like this.

munich

CI/CD Setup

Testing

For testing you should use https://docs.pytest.org/. The GitHub Actions workflow file that runs the tests is located under gee_downloader/.github/workflows/python-app.yml. Use it and the tests under the test/ subdirectory as an example for your own projects.

Documentation

The documentation for this library is automatically built and uploaded to GitHub Pages on each commit. The workflow responsible for this is defined at gee_downloader/.github/workflows/pdoc.yml. I prefer to use pdoc for documentation building (over sphinx which is in my view an outdated abomination) but if you prefer to use something more complex the idea behind building and publishing it stays the same.

You can find the documentation here: https://dlr-mf-das.github.io/gee_downloader/

Publishing

Metadata

Release files for gee-downloader 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gee-downloader 0.0.1
File Size Uploaded
gee_downloader-0.0.1.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gee-downloader 0.0.1
File Interpreter ABI Platform
gee_downloader-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / gee_downloader-0.0.1.tar.gz

Download URL gee_downloader-0.0.1.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d703a229a87a4a56b4cb6379992850ca3a284755bc067603ddafeb7498730978
BLAKE2b-256 checksum
How to use checksums
9a80e37ee5c566d6a7de2ae6c5f11a337eef7f802fb46730e8505b3d2841863e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.18

Release files / gee_downloader-0.0.1-py3-none-any.whl

Download URL gee_downloader-0.0.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d4cec83e96b236fded6a5ecfd45aef90b36b0dc237c4ae61edac8550c226566
BLAKE2b-256 checksum
How to use checksums
5b70664f65c953f738a5d6b291e04eaf2bccfc3496bef70a257f6566eb269ae6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page