Skip to main content

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

Project description

PyGMRT

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.0.tar.gz (9.7 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.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pygmrt-0.1.0.tar.gz
  • Upload date:
  • Size: 9.7 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.0.tar.gz
Algorithm Hash digest
SHA256 0ec02b410697699b3b296d6d0f44c32ca5adb0f1282b28f5026ec3f4525a535b
MD5 cf87d01ceaf1927555a938ce1ee9202f
BLAKE2b-256 5ce2ce2d23d744025ba800aac1f6bd67963363ffae9f24b807b342df6b54b06c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pygmrt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f1598c00bb24719dee271a8f197fb6e9612e885c8cf31b7d59c14ce542b27b4
MD5 3ce3ec59aa6cbb2b53c857ef4eafb728
BLAKE2b-256 c2081a350a6f3f478efbcac3c27ce92c957f41c0ec68930dbea8237464523e5a

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