Skip to main content

Python API for the Global Precipitation Mission Data Archive

Project description

Welcome to GPM-API

DOI PyPI version Conda Version Tests Coverage Status Documentation Status Code style: black License

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_type="RS")  # research products
gpm_api.available_products(product_type="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(gpm_username=username,
                       gpm_password=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)

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

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)

Look at the Tutorials to learn how to analyse and visualize the GPM products !

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.

Documentation for GPM-API

You can find the documentation under gpm_api.readthedocs.io

Tutorials and Examples

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.

Citation

If you are using GPM-API in your publication please cite our paper:

TODO: GMD

You can cite the Zenodo code publication of GPM-API by:

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

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

Requirements:

Optional

License

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

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.5.tar.gz (194.2 kB view hashes)

Uploaded Source

Built Distribution

gpm_api-0.2.5-py3-none-any.whl (237.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page