rrrcn 0.2.1
A Python package for getting rainfall data from China Meteorological Administration and local meteorological bureaus.
Requires Python: >=3.6
Keywords: rainfall,china,river,reservoir

# RRRCN - Rainfall, River and Reservoir Collecter for China

![](https://img.shields.io/github/v/tag/Doradx/rrrcn) ![](https://img.shields.io/pypi/pyversions/rrrcn) [![](https://img.shields.io/pypi/wheel/rrrcn)](https://pypi.org/project/rrrcn/) ![](https://img.shields.io/github/license/Doradx/rrrcn)
[![](https://img.shields.io/github/stars/Doradx/rrrcn?logo=github)](https://github.com/Doradx/rrrcn/stargazers) [![](https://img.shields.io/github/forks/Doradx/rrrcn?logo=github)](https://github.com/Doradx/rrrcn/network) [![](https://img.shields.io/github/last-commit/Doradx/rrrcn?logo=github)](https://github.com/Doradx/rrrcn/commits) [![](https://img.shields.io/badge/blog-%40Dorad-blue)](http://blog.cuger.cn)

A python script for hydrological data collection, integrating some APIs from the Chinese Ministry of Water Resources and Hubei Hydrological Bureau.

# Usage

## Installation

```bash
pip install rrrcn
```

## Eaxamples

### Featch the latest river data from MWR

```python
import rrrcn.Hubei as Hubei
import rrrcn.MWR as MWR

if __name__ == '__main__':
    print("Test Hubei...")
    for s in [
        Hubei.PopularStationReport(),
        Hubei.RiverStationReport(),
        Hubei.ReservoirStationReport(),
        Hubei.RainfallStation(),
        Hubei.WeirGateStation(),
    ]:
        today_data = s.query_latest_data()
        print("Total %s data: %s" % (s.__class__.__name__, len(today_data)))
    print("Test MWR...")
    for s in [
        MWR.RainfallStation(),
        MWR.RiverStation(),
        MWR.ReservoirStation(),
    ]:
        latest_data = s.query_latest_data()
        print("Total %s latest data: %s" %
              (s.__class__.__name__, len(latest_data)))

```

## Function Lists

### [MWR](http://xxfb.mwr.cn/sq_djdh.html)

| Class                      | Funtion             | Remark                                         | URL                                                  |
| -------------------------- | ------------------- | ---------------------------------------------- | ---------------------------------------------------- |
| rrrcn.MWR.RainfallStation  | query_latest_data() | query the latest daily rianfall data from MWR  | [全国重点站实时雨情](http://xxfb.mwr.cn/sq_zdysq.html)  |
| rrrcn.MWR.ReservoirStation | query_latest_data() | query the latest daily reservoir data from MWR | [全国大型水库实时水情](http://xxfb.mwr.cn/sq_dxsk.html) |
| rrrcn.MWR.RiverStation     | query_latest_data() | query the latest daily river data from MWR     | [全国大江大河实时水情](http://xxfb.mwr.cn/sq_djdh.html) |

### [Hubei](http://113.57.190.228:8001/)

| Class                              | Funtion                             | Remark                                                    | URL                                                                                       |
| ---------------------------------- | ----------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| rrrcn.Hubei.PopularStationReport   | query_latest_data()                 | query the latest popular daily data                       | [湖北省常用水情报表](http://xxfb.mwr.cn/sq_djdh.html)                                        |
|                                    | query_data_at(datetime)             | query the daily river data at datetime                    |                                                                                           |
| rrrcn.Hubei.ReservoirStationReport | query_latest_data()                 | query the latest popular daily data                       | [湖北省大型水库水情简报](http://113.57.190.228:8001/#!/web/Report/RiverReport)               |
|                                    | query_data_at(datetime)             | query the daily reservoir data at datetime                |                                                                                           |
| rrrcn.Hubei.RiverStationReport     | query_latest_data()                 | query the latest daily river data                         | [全省各市（州、区）主要河道站实时水情](http://113.57.190.228:8001/#!/web/Report/RiverReport) |
|                                    | query_data_at(datetime)             | query the daily river data at datetime                    |                                                                                           |
| rrrcn.Hubei.RainfallStation        | query_latest_data()                 | query the latest daily rainfall data                      | [湖北省主要雨量站雨情](http://113.57.190.228:8001/#!/web/Report/RiverReport)                 |
|                                    | query_data_at(datetime)             | query the daily rainfall data at datetime                 |                                                                                           |
|                                    | query_history_data(start_at,end_at) | query the history rainfall data from start_at to end_at   |                                                                                           |
| rrrcn.Hubei.WeirGateStation        | query_latest_data()                 | query the latest daily weir gate data                     | [湖北省主要堰闸站水情](http://113.57.190.228:8001/#!/web/Report/RiverReport)                 |
|                                    | query_data_at(datetime)             | query the daily  weir gate data at datetime               |                                                                                           |
|                                    | query_history_data(start_at,end_at) | query the history  weir gate data from start_at to end_at |                                                                                           |

# Author

[Dorad](https://github.com/Doradx), xxdorad@gmail.com

# Data Source

- [全国水雨情信息 (mwr.cn)](http://xxfb.mwr.cn/sq_zdysq.html)
- [千里眼水雨情信息查询系统](http://113.57.190.228:8001/#!/web/Report/RiverReport)