|
|
| (25 intermediate revisions by 2 users not shown) |
| Line 1: |
Line 1: |
| − | == 中国区域降水实况栅格图 API 说明 ==
| |
| | | | |
| − | === 1.API概述 : === | + | 使用本接口,开发者token需要额外开通权限,请联系商务:'''api@caiyunapp.com''' |
| − | * 中国区域降水实况栅格图 API 提供三种文件:降水强度图、可用区域mask图、雨雪类型mask图; | + | |
| | + | == '''API概述 :''' == |
| | + | * 区域降水实况栅格图 API 提供三种文件:降水强度图、可用区域mask图、雨雪类型mask图; |
| | * 文件名为格林威治时间,提供最近十帧(45分钟历史+当前最新),每5分钟更新1次(每小时12次,从00H:00M开始); | | * 文件名为格林威治时间,提供最近十帧(45分钟历史+当前最新),每5分钟更新1次(每小时12次,从00H:00M开始); |
| − | * 等经纬度投影,栅格分辨率 (6000 * 7500) , 纬经度分辨率近似为(0.009, 0.0105),(经度分辨率0.0105非准确值);
| + | [[Category:API 产品]] |
| − | * 数据第1维 (3.9079N ~ 57.9079N)纬度,第2维 (71.9282E ~ 150.6026E)经度;
| |
| − | * 栅格数据索引和经纬度之间的转换详见下面示例代码;
| |
| − | * 提供的数据如下:
| |
| − | * 1.降水强度图,数据uint8存储,除以255为彩云降水强度(等于0~1.0之间);
| |
| − | * 2.降水类型图,数据uint8存储,255代表此像素为雪(固态),100代表此像素为雨(液态),0代表不可用;
| |
| − | * 3.可用区域图,数据uint8存储,255代表可用(不缺测),0代表不可用。
| |
| − | | |
| − | === 2.API调用方式: ===
| |
| − | 1. API接口:(http://api.caiyunapp.com/v1/radar/cndata?token=$YOUR_TOKEN)
| |
| − | | |
| − | 2. 调用API 获取十帧图的url:降水强度图(共10张)、降水类型图(共10张)、可用区域图(共10张)
| |
| − | | |
| − | 3. 降水强度图示例:http://cdn.caiyunapp.com/weather/radar/cnmap_precp_201810250540_7bdef9f9ac.png
| |
| − | 4. 降水类型图示例:http://cdn.caiyunapp.com/weather/radar/cnmap_precptype_201810250540_7bdef9f9ac.png
| |
| − | 5. 可用区域图示例:http://cdn.caiyunapp.com/weather/radar/cnweight_raw_201810250540_7bdef9f9ac.png
| |
| − | | |
| − | ## 3.API返回示例:
| |
| − | | |
| − | ```全国降水图API返回 http://api.caiyunapp.com/v1/radar/cndata?token=$YOUR_TOKEN
| |
| − | | |
| − | 示例如下:
| |
| − | `{`
| |
| − | **status**: "ok",
| |
| − | **cndata**: [
| |
| − | {
| |
| − | ## 降水强度图(UTC+0 格林威治时间)
| |
| − | ** data_url**: "cdn.caiyunapp.com/weather/radar/
| |
| − | cnmap_precp_201810250540_7bdef9f9ac.png",
| |
| − | ** **## 降水类型图(UTC+0 格林威治时间)
| |
| − | **data_type_url**: "cdn.caiyunapp.com/weather/radar/
| |
| − | cnmap_precptype_201810250540_7bdef9f9ac.png",
| |
| − | ** **## 可用区域图(UTC+0 格林威治时间)
| |
| − | **weight_url**: "cdn.caiyunapp.com/weather/radar/
| |
| − | cnweight_raw_201810250540_7bdef9f9ac.png",
| |
| − | ** datatime**: 1540446000, # 降雨图的时间戳(UTC+0 格林威治时间)
| |
| − | ** lat**: [3.9079,57.9079], # 纬度范围
| |
| − | ** lng**: [71.9282,150.6026], # 经度范围
| |
| − | ** unit**: "grey scale" # 灰度单位,降雨图数据除以255为彩云降水强度;
| |
| − | # 可用范围数据中,255代表可用,0代表不可用
| |
| − | },
| |
| − | ...
| |
| − | ]
| |
| − | }
| |
| − | ```
| |
| − | | |
| − | ## 4.参考代码:
| |
| − | | |
| − | ```
| |
| − | ##根据用户经纬度,获取彩云降水*(雪)*强度**
| |
| − | ##lat_interval, lng_interval = 0.009, 0.0105**
| |
| − | from scipy.misc import imread
| |
| − | VALID = 255
| |
| − | NORM = 255
| |
| − | lats = [3.9079, 57.9079]
| |
| − | lngs = [71.9282, 150.6026]
| |
| − | lat_size, lng_size = 6000, 7500
| |
| − | | |
| − | def latlng2xy(lat, lng):
| |
| − | y = int((lng - lngs[0]) / (lngs[1] - lngs[0]) * lng_size)
| |
| − | x = int((lats[1] - lat) / (lats[1] - lats[0]) * lat_size)
| |
| − | return x, y
| |
| − | | |
| − | data = imread('[cnmap_precp_201810250540_7bdef9f9ac.png](http://cdn.caiyunapp.com/weather/radar/cnmap_precp_201807101700_fff3451c8a.png)')
| |
| − | weight = imread('[cnweight_raw_](http://cdn.caiyunapp.com/weather/radar/cnweight_raw_201807101700_fff3451c8a.png)[201810250540_7bdef9f9ac.png](http://cdn.caiyunapp.com/weather/radar/cnmap_precp_201807101700_fff3451c8a.png)')
| |
| − | lat_size, lng_size = data.shape ##(6000, 7500)
| |
| − | lat, lng = 40.35, 116.31 ##查询用户位置降水情况
| |
| − | x, y = latlng2xy(lat, lng)
| |
| − | if weight[x, y] == VALID:
| |
| − | result = float(data[x,y]) / NORM
| |
| − | ```
| |
| − | | |
| − | ## 5.图示:
| |
| − | | |
| − | 1. 中国区域降水强度图:
| |
| − | | |
| − | http://cdn.caiyunapp.com/weather/radar/cnmap_precp_201810250540_7bdef9f9ac.png
| |
| − | [Image: image.png]
| |
| − | | |
| − | | |
| − | | |
| − | | |
| − | 2.降水可用区域图:
| |
| − | http://cdn.caiyunapp.com/weather/radar/cnweight_raw_201810250540_7bdef9f9ac.png
| |
| − | | |
| − | [Image: image.png]
| |
| − | | |
| − | | |
| − | | |
| − | 3.降水类型图:
| |
| − | http://cdn.caiyunapp.com/weather/radar/cnmap_precptype_201810250540_7bdef9f9ac.png
| |
| − | [Image: image.png]
| |
| − | | |
| − | | |
| − | | |
| − | | |
| − | | |
| − | 4.NMC降水预报,降水强度图和 降水类型图,可用区域图,时次2018-10-25-12H:20M:
| |