Skip to main content

A minimal Python package for downloading bathymetry and topography tiles from GMRT

Project description

PyGMRT

PyGMRT Logo

A minimal Python package for downloading bathymetry and topography tiles from the Global Multi-Resolution Topography (GMRT) Synthesis.

Python License

Features

  • Simple API: Single function to download GMRT tiles
  • Multiple resolutions: High (1 arc-second), medium (4 arc-second), low (16 arc-second)
  • GeoTIFF format: Direct integration with rasterio and other geospatial tools
  • Antimeridian support: Handles bounding boxes that cross the 180° longitude
  • No API key required: Direct access to GMRT GridServer

Installation

Using UV (recommended)

If you don't have UV installed, follow the instructions at uv. Then install PyGMRT from PyPI:

uv add pygmrt

Or install from source

git clone https://github.com/leonard-seydoux/pygmrt.git
cd pygmrt
uv sync

Using pip

Similarly, you can either install from PyPI:

pip install pygmrt

Or install from source:

# Or install from source
git clone https://github.com/leonard-seydoux/pygmrt.git
cd pygmrt
pip install -e .

Quick Start

from rasterio.plot import show
from pygmrt.tiles import download_tiles

# Get tiles
tiles = download_tiles(bbox=[55.05, -21.5, 55.95, -20.7], resolution="low")

# Show with minimal processing
show(tiles)

Other examples

The playground notebook 02_playground.ipynb contains more advanced examples, including shaded relief visualizations with matplotlib and cartopy. The following figures were generated with that notebook.

API reference

The main function of the package is pygmrt.tiles.download_tiles, with the signature given below.

def download_tiles(
    bbox, 
    save_directory="./geotiff/",
    resolution="medium",
    overwrite=False,
):
    """
    Download tiles and return the rasterio dataset.

    Parameters
    ----------
    bbox : sequence of float
        Bounding box in WGS84 degrees as ``[west, south, east, north]``.
    save_directory : str or pathlib.Path
        Destination directory path where files will be written. Created if
        needed.
    resolution : {"low", "medium", "high"}, default "medium"
        Named resolution level; mapped internally to provider-specific datasets.
    overwrite : bool, default False
        If ``False``, reuse existing files. If ``True``, force re-download.

    Returns
    -------
    rasterio.DatasetReader
        Opened rasterio dataset for the downloaded GeoTIFF. The caller is
        responsible for closing the dataset.

    Raises
    ------
    ValueError
        If invalid argument combinations or bbox values are provided.
    PermissionError
        If the destination directory is not writable.
    RuntimeError
        If download attempts ultimately fail.
"""

Development

Setting up development environment

git clone https://github.com/leonard-seydoux/pygmrt.git
cd pygmrt

# Install in development mode with UV
uv sync --all-extras

# Or with pip
pip install -e ".[dev,docs]"

Running tests

# With UV
uv run pytest

# With pip
pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

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

pygmrt-0.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygmrt-0.1.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file pygmrt-0.1.1.tar.gz.

File metadata

  • Download URL: pygmrt-0.1.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pygmrt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 41f8954e68dfc397772ef7dfbb50c607c1d1a60a6a4273b466a39d2ba2757c67
MD5 722939f77cd114deecebe427289f6fbd
BLAKE2b-256 10f4d38dda954138e101283c424dcef15c43b89aa5259642941295eb80ea5681

See more details on using hashes here.

File details

Details for the file pygmrt-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pygmrt-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pygmrt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0cad9f17dfb082cd928ca13cb03a7dc80ca3be93aad84f5af7292acf3799b911
MD5 6d5b1254ec1d5367641276c50dac611c
BLAKE2b-256 3e7b491f74843df72d978400c180d5bc65df17a88fa60e2f3fd0b95c268bb38f

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