Skip to main content

Download, extract, average, plot, and analyze NASA GPM IMERG precipitation data from Python or a local web UI.

Project description

imergpy

imergpy is a Python package and local web interface for downloading NASA GPM IMERG precipitation data through NASA Earthdata/GES DISC. It can extract point rainfall time series and compute grid-cell average rainfall for selected countries or square areas.

Download NASA Rainfall Data With 2 Lines

  • Download NASA IMERG satellite rainfall as a time series.
  • Excel file is saved automatically.
  • Use Point, Country Average, or Square Region Average.
  • Available from 1998-01-01 to today, depending on NASA product availability.
  • Supports half-hourly, daily, and monthly data.
  • If the normal NASA download server is blocked, imergpy can fall back to NASA S3 on Python 3.10+.
  • No Linux or advanced technical knowledge needed.

Two-Line Python Download

After installation, download point rainfall with:

import imergpy
excel_path, records = imergpy.get_precipitation(6.9271, 79.8612, "2025-11-27 00:00", "2025-11-27 23:30", "EARTHDATA_USERNAME", "EARTHDATA_PASSWORD", run_type="late", freq="hhr")

Replace EARTHDATA_USERNAME and EARTHDATA_PASSWORD with your NASA Earthdata login. The result is saved as an Excel file.

Quick Start(MacOS/Windows/Linux)

Install:

pip install imergpy

Open the web app:

python -m imergpy.cli

Your browser should open automatically. Enter your NASA Earthdata username/password in the local page and choose a point, country, or square area.

Two Ways To Use

  • Method 1: Use Python code.
  • Method 2: Use the local web interface.
  • Both methods save Excel output automatically.

Features

  • Local web UI launched with python -m imergpy.cli
  • Python API for scripted workflows
  • Point, country, and square-area selection in the web map
  • Grid-cell average precipitation for country and square-area selections
  • Half-hourly, daily, and monthly IMERG products
  • Early, Late, and Final IMERG run types where available
  • Automatic NASA S3 fallback when the GES DISC subset server is unreachable
  • Excel export with separate Start Time and End Time columns
  • Basic rainfall plotting and statistics utilities

Web UI

python -m imergpy.cli

Python API Example

import imergpy

excel_path, records = imergpy.get_precipitation(
    lat=6.9271,
    lon=79.8612,
    start_datetime="2025-11-27 00:00",
    end_datetime="2025-11-27 23:30",
    username="EARTHDATA_USERNAME",
    password="EARTHDATA_PASSWORD",
    run_type="late",
    freq="hhr",
    interp_method="nearest",
)

print(excel_path)

Example Files

  • examples/point_download.py
  • examples/country_japan_average.py
  • examples/square_area_average.py
  • examples/ATTRIBUTE_REFERENCE.txt

Accepted date formats:

  • YYYY-MM
  • YYYY-MM-DD
  • YYYY-MM-DD HH:MM

NASA Earthdata Credentials

You need a free NASA Earthdata account. After creating the account, authorize GES DISC under Earthdata authorized applications.

For the easiest first test, replace EARTHDATA_USERNAME and EARTHDATA_PASSWORD directly in the examples above. For shared scripts, keep credentials private and avoid uploading passwords to GitHub.

NASA Download Method

imergpy first tries the standard NASA GES DISC subset download. If that server connection is blocked or reset, it automatically tries NASA S3 using earthaccess on Python 3.10 or newer.

If S3 fallback is needed but earthaccess is missing, run:

pip install earthaccess

Legal And Data Use Notice

imergpy is an independent open-source tool. It is not developed, endorsed, or certified by NASA, GES DISC, or the GPM mission team.

Users are responsible for:

  • creating and using their own NASA Earthdata account,
  • accepting and following NASA/GES DISC data access terms,
  • citing NASA GPM IMERG data correctly in reports, papers, and products,
  • checking data quality, latency, and suitability before operational or scientific use,
  • keeping Earthdata usernames, passwords, and tokens private.

This software is provided under the MIT License without warranty.

Development

For local development:

git clone https://github.com/LakshithaSenavirathna/imergpy.git
cd imergpy
pip install -e ".[dev]"

Run tests:

pytest

Build package files:

python -m build

Publishing instructions are in PUBLISHING.md.

Upgrade

To upgrade to a newer imergpy version:

pip install --upgrade imergpy

License

MIT License. Developed by Lakshitha S. Senavirathna.

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

imergpy-1.1.8.tar.gz (173.5 kB view details)

Uploaded Source

Built Distribution

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

imergpy-1.1.8-py3-none-any.whl (166.4 kB view details)

Uploaded Python 3

File details

Details for the file imergpy-1.1.8.tar.gz.

File metadata

  • Download URL: imergpy-1.1.8.tar.gz
  • Upload date:
  • Size: 173.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for imergpy-1.1.8.tar.gz
Algorithm Hash digest
SHA256 102a64e92b2c58ca8eac5b09c48e69bd39fce83745f812e63f010160756fa5b4
MD5 820fb12bb871e3179aa6dd53f57f9aaa
BLAKE2b-256 9d2a083112caf862ad247c25db23124629deedce5dc852e9f3d9884170e6f9f6

See more details on using hashes here.

File details

Details for the file imergpy-1.1.8-py3-none-any.whl.

File metadata

  • Download URL: imergpy-1.1.8-py3-none-any.whl
  • Upload date:
  • Size: 166.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for imergpy-1.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 befdef883e9a0ec24587931f38d704e34468712d4f8e4f8b550356b42c787aa7
MD5 815aa8c47aeac9712e2d90596c176dbb
BLAKE2b-256 90a42f083de726373bd127d67d63933cdf5b9dd3fe3a8f1cfbe88891398a8d56

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