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.
  • Uses GES DISC OTF subset download with wget and Earthdata cookies.
  • 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 wget, Earthdata credentials, and cookies
  • 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 only the NASA GES DISC OTF subset service. It calls wget with your Earthdata username/password and stores Earthdata cookies in ~/.urs_cookies.

You must have wget installed and available in your terminal path.

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.2.3.tar.gz (175.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.2.3-py3-none-any.whl (169.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: imergpy-1.2.3.tar.gz
  • Upload date:
  • Size: 175.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.2.3.tar.gz
Algorithm Hash digest
SHA256 655b6a9921e484c5046d5aebaf55edcfb3805648fba3953b7d5ff71978d65659
MD5 936dd2a645d49eedf3ea93776161fc68
BLAKE2b-256 b156998f4345b23bc0ecf3c6f02f18ce8767adb00665bf5d2f7759bf9ed57460

See more details on using hashes here.

File details

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

File metadata

  • Download URL: imergpy-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 169.0 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.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4aae00a80c11a37d624bbf8f7cd1e3b3c0689d1dfe0e6de2a4b50e8bd13eb57c
MD5 74c95ffd8c1d7298d716c56d95f1b83e
BLAKE2b-256 4d85e0006f53b88296fbcd622cc4f1ffee4c1a55188be49ebed310a95c9d2c31

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