Skip to main content

Python API for the Global Precipitation Mission Data Archive

Project description

📦 Welcome to GPM-API

Deployment PyPI Conda
Activity PyPI Downloads Conda Downloads
Python Versions Python Versions
Supported Systems Linux macOS Windows
Project Status Project Status
Build Status Tests Lint Docs
Linting Black Ruff Codespell
Code Coverage Coveralls Codecov
Code Quality Codefactor Codebeat Codacy Codescene
Code Review pyOpenSci OpenSSF Best Practices
License License
Community Slack GitHub Discussions
Citation DOI

Slack | Docs

The GPM-API is still in development. Feel free to try it out and to report issues or to suggest changes.

🚀 Quick start

GPM-API provides an easy-to-use python interface to download, read, process and visualize most of the products of the Global Precipitation Measurement Mission (GPM) data archive.

The list of available products can be retrieved using:

import gpm_api

gpm_api.available_products(product_types="RS")  # research products
gpm_api.available_products(product_types="NRT") # near-real-time products

Before starting using GPM-API, we highly suggest to save into a configuration file:

  1. your credentials to access the NASA Precipitation Processing System (PPS) servers
  2. the directory on the local disk where to save the GPM dataset of interest.

To facilitate the creation of the configuration file, you can run the following script:

import gpm_api

username = "<your PPS username>" # likely your mail
password = "<your PPS password>" # likely your mail
gpm_base_dir = "<path/to/directory/GPM"  # path to the directory where to download the data
gpm_api.define_configs(username_pps=username,
                       password_pps=password,
                       gpm_base_dir=gpm_base_dir)

# You can check that the config file has been correctly created with:
configs = gpm_api.read_configs()
print(configs)

📥 Download GPM data

Now you can either start to download GPM data within python:

import gpm_api
import datetime

product = "2A-DPR"
product_type = "RS"
version = 7

start_time = datetime.datetime(2020,7, 22, 0, 1, 11)
end_time = datetime.datetime(2020,7, 22, 0, 23, 5)

gpm_api.download(product=product,
                 product_type=product_type,
                 version=version,
                 n_threads=2,
                 start_time=start_time,
                 end_time=end_time)

or from the terminal using i.e. download_daily_gpm_data <product> <year> <month> <day>:

    download_daily_gpm_data 2A-DPR 2022 7 22

💫 Open GPM files into xarray

A GPM granule can be opened in python using:

import gpm_api

ds = gpm_api.open_granule(<path_to_granule>)

while multiple granules over a specific time period can be opened using:

import gpm_api
import datetime

product = "2A-DPR"
product_type = "RS"
version = 7

start_time = datetime.datetime(2020,7, 22, 0, 1, 11)
end_time = datetime.datetime(2020,7, 22, 0, 23, 5)
ds = gpm_api.open_dataset(product=product,
                          product_type=product_type,
                          version=version
                          start_time=start_time,
                          end_time=end_time)

📖 Explore the GPM-API documentation

To discover all GPM-API download, manipulation, analysis and plotting utilities, or how to contribute your custom retrieval to GPM-API:


🛠️ Installation

pip

GPM-API can be installed via pip on Linux, Mac, and Windows. On Windows you can install WinPython to get Python and pip running. Prior installation of GPM-API, to avoid GEOS library version incompatibilities when installing the Cartopy package, we highly suggest to install first Cartopy using conda install cartopy>=0.21.0.

Then, install the GPM-API package by typing the following command in the command terminal:

pip install gpm_api

To install the latest development version via pip, see the documentation.

conda [NOT YET AVAILABLE]

GPM-API can be installed via conda on Linux, Mac, and Windows. Install the package by typing the following command in a command terminal:

conda install gpm_api

In case conda forge is not set up for your system yet, see the easy to follow instructions on conda forge.

💭 Feedback and Contributing Guidelines

If you aim to contribute your data or discuss the future development of GPM-API, we highly suggest to join the GPM-API Slack Workspace

Feel free to also open a GitHub Issue or a GitHub Discussion specific to your questions or ideas.

Citation

You can cite the GPM-API software by:

Ghiggi Gionata & XXXX . ghiggi/gpm_api. Zenodo. https://doi.org/10.5281/zenodo.7753488

If you want to cite a specific software version, have a look at the Zenodo site.

License

The content of this repository is released under the terms of the MIT license.

Tutorials

The documentation also includes some [tutorials][tut_link], showing the most important use cases of GPM-API. These tutorial are also available as Jupyter Notebooks and in Google Colab:

The associated python scripts are also provided in the tutorial folder.

Requirements:

Optional

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

gpm_api-0.2.11.tar.gz (215.2 kB view details)

Uploaded Source

Built Distribution

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

gpm_api-0.2.11-py3-none-any.whl (261.9 kB view details)

Uploaded Python 3

File details

Details for the file gpm_api-0.2.11.tar.gz.

File metadata

  • Download URL: gpm_api-0.2.11.tar.gz
  • Upload date:
  • Size: 215.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for gpm_api-0.2.11.tar.gz
Algorithm Hash digest
SHA256 c18aa4e546f238356cc100337d0db42217f8bd2ff9d7825fcaa3aabffea73540
MD5 1df594a48f131b0263525cfc2524bed4
BLAKE2b-256 c0363b1390c483d792e18ca0af92becdf5b37e26d36bcd9521604591436e0918

See more details on using hashes here.

File details

Details for the file gpm_api-0.2.11-py3-none-any.whl.

File metadata

  • Download URL: gpm_api-0.2.11-py3-none-any.whl
  • Upload date:
  • Size: 261.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for gpm_api-0.2.11-py3-none-any.whl
Algorithm Hash digest
SHA256 fe1fc9958bca9159264004fb3008e12cf8d053854589cefcefc25c2d96f8e0e9
MD5 a54bf64414b1cea4f2a6bb986223ff0b
BLAKE2b-256 6005c3dad1899c49a1fec66d8760dca0017fd0408a52be7d4170a8258621eacf

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