FABDEM
Download FABDEM data: a DEM with forests and buildings removed using ML.
FABDEM homepage: https://data.bris.ac.uk/data/dataset/s5hqmjcdj8yo2ibzi9b4ew3sn
Installation
To install the package using pip
pip install fabdem
Usage
FABDEM can be used either as a Python library or from the command line.
Python library
Import the package and call download() with geographic bounds in EPSG:4326:
import fabdem
bounds = (1, 30, 5, 35)
fabdem.download(bounds, output_path="dem.tif")
The bounds tuple is:
(west, south, east, north)
Example:
import fabdem
bounds = (35.35, -1.49, 36.48, -0.23)
fabdem.download(bounds, output_path="narok_dem.tif")
output_path may point to any raster format supported by GDAL, such as .tif.
Optional arguments
You can also control caching and progress display:
import fabdem
from pathlib import Path
bounds = (35.35, -1.49, 36.48, -0.23)
fabdem.download(
bounds,
output_path="narok_dem.tif",
cache=Path("./fabdem-cache"),
show_progress=True,
)
Common keyword arguments:
bounds:(west, south, east, north)in longitude/latitude.output_path: output raster path.cache: optional directory used to store downloaded ZIP archives and extracted tiles.show_progress: show progress output in terminal or notebook.
In notebooks
In Jupyter notebooks, progress output uses an ipywidgets widget to avoid flickering from repeated cell output refreshes. If ipywidgets is not available, the code falls back to plain text output and logs a warning.
Command-line interface
The module can also be run directly from the command line.
Basic usage:
python fabdem.py WEST SOUTH EAST NORTH OUTPUT_PATH
Example:
python fabdem.py 35.35 -1.49 36.48 -0.23 narok_dem.tif
With optional arguments:
python fabdem.py 35.35 -1.49 36.48 -0.23 narok_dem.tif \
--cache ./fabdem-cache \
--log-level INFO
Available CLI options:
--cache PATH: use a custom cache directory.--hide-progress: disable progress output.--clear-cache: clear the selected cache before downloading.--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}: configure logging verbosity.
You can also inspect the built-in help:
python fabdem.py --help
Notes
- Coordinates must be given in EPSG:4326 longitude/latitude.
- The package automatically determines which FABDEM tiles intersect the requested bounds.
- Downloaded data may be reused from cache when available.
- The output raster is created by merging all intersecting tiles for the requested area.
Development
1. Clone the repository
git clone https://github.com/jantomec/fabdem.git
cd fabdem
2. Create and activate an environment
2.1 Using conda
conda env create -f fabdem.yml
conda activate fabdem
If the environment already exists, update it instead:
conda env update -f fabdem.yml --prune
conda activate fabdem
2.2 Using venv on macOS or Linux
python -m venv .venv
source .venv/bin/activate
2.3 Using venv on Windows
python -m venv .venv
.venv\Scripts\activate
3. Install the package in editable mode
With flit:
flit install --symlink
4. Publish to PyPI:
flit publish
TODO:
- Create a conda-forge package.
- Download only part of a zip.
- Add a CLI tool
Resources:
Metadata
Release files for fabdem 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fabdem-0.2.2.tar.gz | 24.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fabdem-0.2.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 46.5 kB
Release files / fabdem-0.2.2.tar.gz
| Download URL | fabdem-0.2.2.tar.gz |
|---|---|
| Size | 24.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af3704620e68871122d9663d8ec0f67f1aed5dd93b57c0bed84d98b87c6ed705
|
|
BLAKE2b-256 checksum How to use checksums |
affa791b8063e1045cf6bc2ad4775c5cf7e35880f863da132202a7b648737220
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / fabdem-0.2.2-py2.py3-none-any.whl
| Download URL | fabdem-0.2.2-py2.py3-none-any.whl |
|---|---|
| Size | 22.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
da43845ede47b640edc688dfc1c2a3c495c13286a1498768a1bd37b4c6112806
|
|
BLAKE2b-256 checksum How to use checksums |
53d105221c0d18228abfb676b7c55559f2943af5f094f18e3e42dc62be2558d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Security for fabdem 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.