Skip to main content

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.
  • Uses GES DISC OTF subset download with Earthdata credentials.
  • 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
  • GES DISC OTF subset download using Earthdata credentials
  • 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)

Four-Point Point Download

For point rainfall, you can download only the tiny subset around the four surrounding IMERG grid points and choose nearest or linear interpolation:

import imergpy

excel_path, records = imergpy.get_precipitation_four_points(
    lat=6.9,
    lon=79.8,
    start_datetime="2025-11-25",
    end_datetime="2025-11-25",
    username="EARTHDATA_USERNAME",
    password="EARTHDATA_PASSWORD",
    run_type="late",
    freq="daily",
    method="linear",
)

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 uses the NASA GES DISC OTF subset service. It writes Earthdata credentials to .netrc/_netrc and downloads the small requested subset instead of the global file.

IMERG V08 Transition Note

NASA is transitioning IMERG products from V07 to V08. In this package:

  • V07B is tried first, then V07C and V07A.
  • V07 Final Run is available only through 2025-09-30.
  • For dates after 2025-09-30, use run_type="early" or run_type="late" until V08 Final is available.

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.

Metadata

Release files for imergpy 1.2.4

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

Source distribution (sdist)

Source distribution for imergpy 1.2.4
File Size Uploaded Provenance Actions
imergpy-1.2.4.tar.gz 176.0 kB Without provenance Details for imergpy-1.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for imergpy 1.2.4
File Interpreter ABI Platform Actions
imergpy-1.2.4-py3-none-any.whl Python 3 none any Details for imergpy-1.2.4-py3-none-any.whl

Total release size: 345.3 kB

Release files / imergpy-1.2.4.tar.gz

Download URL imergpy-1.2.4.tar.gz
Size 176.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e2996a2cf443b65578d4b6820c7ae24c948da9c04f76c9d466bc57b3dabddf74
BLAKE2b-256 checksum
How to use checksums
793545c9c5912df5a75e66bcb771ea00134933deb8a90db56d42013785dd3e91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / imergpy-1.2.4-py3-none-any.whl

Download URL imergpy-1.2.4-py3-none-any.whl
Size 169.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cddb5a6db54b37e9ff23f2e42c997af175d52d82b01e5cda7cde43f8399c4667
BLAKE2b-256 checksum
How to use checksums
e524bc6a9503b0d78371b1b2c30172648a959bac4745d24b21c948e0ff895243
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for imergpy 1.2.4

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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