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.9.tar.gz (174.2 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.9-py3-none-any.whl (166.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: imergpy-1.1.9.tar.gz
  • Upload date:
  • Size: 174.2 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.9.tar.gz
Algorithm Hash digest
SHA256 06dab9cd08243ad77deed71c3132fcc6bf64b79750bf3b03925a806ea08adf31
MD5 5cb5a4408808dc1c6052b8a479145568
BLAKE2b-256 0c17bec9a27855b47fc41d88c8f5e03595f4e711faedb5ff37d95eb45e4b0ec5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: imergpy-1.1.9-py3-none-any.whl
  • Upload date:
  • Size: 166.9 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3ce4c5ef8a88a368b7601b435e9ad2c4598e4cd87d996cbbec45b53ae02d32cd
MD5 a158a26f2dad3d81dec1228dae673b15
BLAKE2b-256 cb15b19696714be000a311d24a8b701bc3444a6b5b40705b1805e3c15a7c7af8

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