Skip to main content

persiann_api

The persiann_api python package was built in order to make data more readily available for data scientist, analyst, etc, that wish to work with weather data through the PERSIANN database. It is not an official API for the PERSIANN project.

The PERSIANN database is made from the "system developed by the Center for Hydrometeorology and Remote Sensing (CHRS) at the University of California, Irvine (UCI) uses neural network function classification/approximation procedures to compute an estimate of rainfall rate at each 0.25° x 0.25° pixel of the infrared brightness temperature image provided by geostationary satellites."

As our API currently download the data in the GeoTIFF format, every "pixel" in the .tiff file would be the value of the rainfall rate at the 0.25° x 0.25° space.

PERSIANN data. Screenshot taken from https://chrsdata.eng.uci.edu/ .

The screenshot above was taken from https://chrsdata.eng.uci.edu/, which is the official site for the PERSIANN project. This was taken from Brazil in the 28th of December!

Installation

Install it throught pip or Poetry, if you already have the gdal package.

pip install persiann_api
poetry add persiann_api

The gdal package is not so easy to straightforward install. Click in this link for the official guide in PyPi, click here.

There is also this guide for Ubuntu users, click here. This is the summary for Ubuntu users:

sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update
sudo apt-get update
sudo apt-get install gdal-bin

ogrinfo --version

Then, install the specific version of GDAL from the previous output.

sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal

pip install GDAL==[SPECIFIC VERSION FROM THE 'ogrinfo' OUTPUT]

Usage

The API has one main function that downloads the data inside a folder given some parameters.

from persiann_api.main import download_data
from PIL import Image

# downloads daily data and store each data from date inside the folder.
download_data(
    from_date=datetime.date(2021, 12, 28),
    to_date=datetime.date(2021, 12, 28),
    folder='data/',
    # bounding box for Brazil
    lat_bb=(-35, 6),
    lon_bb=(-69, -36)
)
# read the GeoTIFF with your favorite package
geotiff_path = 'data/2021_12_28.tiff'
arr = np.asarray(Image.open(geotiff_path, mode='r'))[::-1] # we must mirror the array for the GeoTIFF.
plt.imshow(arr)
plt.clim(0, 78)

PERSIANN data for Brazil from 28st December of 2021.

See? This is the same data as the first original data!

This is a longer example to put here, but in the notebooks folder you can find the code to generate this picture:

PERSIANN data for Brazil from 28st December of 2021.

Metadata

Release files for persiann-api 0.1.1

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

Source distribution (sdist)

Source distribution for persiann-api 0.1.1
File Size Uploaded
persiann_api-0.1.1.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for persiann-api 0.1.1
File Interpreter ABI Platform
persiann_api-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / persiann_api-0.1.1.tar.gz

Download URL persiann_api-0.1.1.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a044199d861b1e729bf78207b19e6f21f1f924198c11eda1c8ecab32d7fc9854
BLAKE2b-256 checksum
How to use checksums
9d68fb0fc9f70a90ba1196cf4136703dc8cf5681809ff1a51131aa072419452f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.8.10 Linux/5.4.0-96-generic

Release files / persiann_api-0.1.1-py3-none-any.whl

Download URL persiann_api-0.1.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0aab71e46359be4abafd8b99d476cf02ea0547e129edc370175eecce9127d10
BLAKE2b-256 checksum
How to use checksums
33894277085649ebaa127167507e0123c5494ad59bddd1fcbc85e9df5582bae2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.8.10 Linux/5.4.0-96-generic

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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