Difference between revisions of "分钟级降雨预报接口/v2.5"

From Caiyun Wiki
Jump to: navigation, search
(返回结构和说明)
Line 24: Line 24:
 
==返回结构和说明==
 
==返回结构和说明==
  
<syntaxhighlight lang="javascript">
+
<syntaxhighlight lang="yaml">
  
status:ok,
+
status: ok
    api_version:v2.5,                                                                                                                                            // 版本号
+
status: ok                                        #返回状态
    api_status:active,                                                                                                                                          // 版本号状态
+
api_status: active                                #API 服务状态
    lang:zh_CN,                                                                                                                                                  // 语言
+
api_version: v2.5                                 #API 版本号
    unit:metric,                                                                                                                                                // 单位制
+
server_time: 1586247444                            #响应时刻服务器时间
    result:{ forecast_keypoint:Cloudy here but it's raining SE 41 km away,                                                                                                      // 逐小时和逐分钟天气预报,综合自然语言描述
+
timezone: Asia/Taipei                              #时区信息
              minutely:{status:ok,                                                                                                                                // 逐日预报模块返回状态
+
tzshift: 28800                                    #时区偏移秒数
                        description:Cloudy here but it's raining SE 41 km away,                                                                                              // 逐小时天气预报,自然语言描述
+
unit: metric                                      #单位制
                        precipitation_2h:[0.0507,0.0348,0.0211,0.0104,0.0033,0.0,0.0,0.0,0.0,0.0,0.001,0.0016,0.0018,0.0016,0.001,0.0,0.0,0.0,0.0,0.0027,0.0096,0.0208,
+
lang: zh_CN                                       #语言
                                          0.0369,0.0559,0.0755,0.0934,0.1072,0.1146,0.1139,0.1068,0.0958,0.0831,0.0712,0.0625,0.0587,0.0588,0.061,0.0635,0.0646,0.0625,
+
location:
                                          0.056,0.0461,0.034,0.0214,0.0096,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0052,0.0114,0.0188,0.0279,0.0388,0.0521,0.0676,0.084,0.0996,
+
- 25.1552                                          #纬度
                                          0.1128,0.1218,0.125,0.1213,0.1121,0.0995,0.0857,0.0726,0.0625,0.0568,0.0549,0.0557,0.058,0.0606,0.0625,0.0627,0.0615,0.0593,
+
- 121.6544                                        #经度
                                          0.0567,0.0541,0.0521,0.0509,0.0502,0.0494,0.0481,0.0457,0.0417,0.0357,0.0283,0.0202,0.0123,0.0053,0.0,0.0,0.0,0.0,0.0,0.0,
+
result:
                                          0.0,0.0008,0.0011,0.001,0.0007,0.0003,0.0,0.0,0.0,0.0,0.0001,0.0002,0.0,0.0,0.0,0.0001,0.0018,0.0051,0.0104,0.0181,0.0276],        // 未来2小时,逐分钟,雷达降水强度预报
+
  minutely:
                        precipitation:[0.0507,0.0348,0.0211,0.0104,0.0033,0.0,0.0,0.0,0.0,0.0,0.001,0.0016,0.0018,0.0016,0.001,0.0,0.0,0.0,0.0,0.0027,0.0096,0.0208,
+
    status: ok
                                      0.0369,0.0559,0.0755,0.0934,0.1072,0.1146,0.1139,0.1068,0.0958,0.0831,0.0712,0.0625,0.0587,0.0588,0.061,0.0635,0.0646,0.0625,
+
    datasource: radar                              #预报依据的数据源
                                      0.056,0.0461,0.034,0.0214,0.0096,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0052,0.0114,0.0188,0.0279,0.0388,0.0521,0.0676,0.084],                // 未来1小时,逐分钟,雷达降水强度预报
+
    description: 附近正在下雨,出门还是带把伞吧~        #预报的自然语言描述
 
+
    probability:                                   #降雨概率
                        probability:[0.658591032,0.7041746378,0.5904211998,0.7576189041],                                                                                    // 未来2小时,逐半小时,雷达降水概率预报
+
    - 0.0                                          #0.0~0.5 小时间的降雨概率
                        datasource:radar},
+
    - 0.0                                          #0.5~1.0 小时间的降雨概率
                primary:0},
+
    - 0.0                                         #1.0~1.5 小时间的降雨概率
     location:[27.8943,
+
    - 0.0                                         #1.5~2.0 小时间的降雨概率
            118.1484],                                                                                                                                          // 经纬度
+
    precipitation:                                #预报的分钟级别的降雨强度 00~60 分钟
     server_time:1542700934,                                                                                                                                      // 服务器本次返回的utc时间戳
+
    - 0.0
     tzshift:28800                                                                                                                                                // 时区的偏移秒数,如东八区就是 28800 秒
+
    - 0.0
}
+
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    precipitation_2h:                                #预报的分钟级别的降雨强度 000~120 分钟
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
    - 0.0
 +
     - 0.0
 +
    - 0.0
 +
     - 0.0
 +
     - 0.0
  
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 09:02, 7 April 2020

本文版本:分钟级降雨预报接口/v2.5,当前稳定版本版本:v2.5,历史版本:v2.2v2.3,和 v2.4

授权与认证

请先至彩云开放平台注册,注册后可以获得 token 。

把您的 token 拼到 API 请求的 URL 中,如

https://api.caiyunapp.com/v2.5/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.json

其中 TAkhjf8d1nlSlspN 就是一个共用测试 token 。不要把私有token 告诉任何人!

请求样例

示例1如下

https://api.caiyunapp.com/v2.5/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.json
https://api.caiyunapp.com/v2.5/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.jsonp?callback=MYCALLBACK
token:这里是测试 token ,即 TAkhjf8d1nlSlspN
经纬度:经度在前,纬度在后,中间用半角逗号隔开,这里是 121.6544,25.1552
返回格式:json 或者 jsonp,jsonp 需提供回调函数名

示例2如下

https://api.caiyunapp.com/v2.5/TAkhjf8d1nlSlspN/118.7087,26.9582/minutely?lang=en_US
语言选项 lang:默认为简体中文(zh_CN)、繁体中文(zh_TW)、美式英语(en_US)、英式英语(en_GB)
单位制选项 unit:默认为公制(metric)、科学单位体系(SI) 、英制(imperial)
时区偏移秒数:tzshift:默认为东八区,tzshift=28800;例如:印度东5.5区,tzshift=3600*5.5==19800,v2.3之后版本,返回时区信息,使用秒是为了支持像尼泊尔这样的差 5 小时 45 分钟的地区,它们有非整齐的偏移量;考虑了欧美夏令时。

返回结构和说明

status: ok
status: ok                                         #返回状态
api_status: active                                 #API 服务状态
api_version: v2.5                                  #API 版本号
server_time: 1586247444                            #响应时刻服务器时间
timezone: Asia/Taipei                              #时区信息
tzshift: 28800                                     #时区偏移秒数
unit: metric                                       #单位制
lang: zh_CN                                        #语言
location:
- 25.1552                                          #纬度
- 121.6544                                         #经度
result:
  minutely:
    status: ok
    datasource: radar                              #预报依据的数据源
    description: 附近正在下雨,出门还是带把伞吧~        #预报的自然语言描述
    probability:                                   #降雨概率
    - 0.0                                          #0.0~0.5 小时间的降雨概率
    - 0.0                                          #0.5~1.0 小时间的降雨概率
    - 0.0                                          #1.0~1.5 小时间的降雨概率
    - 0.0                                          #1.5~2.0 小时间的降雨概率
    precipitation:                                 #预报的分钟级别的降雨强度 00~60 分钟
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    precipitation_2h:                                 #预报的分钟级别的降雨强度 000~120 分钟
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0

变量说明

逐日预报,没有逐日预报的自然语言描述字段
名称 健值路径(jsonpath) 时间粒度 地理范围 注释
短临2h降水强度 $.result.minutely.precipitation_2h[:] 雷达降水强度 逐日预报 全球 本地未来2小时逐分钟,短临降水强度预报

支持的单位制

1.目前支持的单位制包括:科学单位体系(SI,大写)、英制(imperial)、公制(不带参数&unit默认公制,公制还包括: metric:v1和metric:v2):

单位制
要素
SI(科学单位体系) imperial(英制) metric:v1(公制v1) metric:v2(公制v2) default metric(默认公制)
实况降水量 米/秒(meter/sec) 英寸/小时(in/hr) 雷达降水强度(0~1) 毫米/小时(mm/hr) 雷达降水强度(0~1)
逐分钟降水短临预报降水量 米/秒(meter/sec) 英寸/小时(in/hr) 雷达降水强度(0~1) 毫米/小时(mm/hr) 雷达降水强度(0~1)
逐小时预报降水量 米/秒(meter/sec) 英寸/小时(in/hr) 雷达降水强度(0~1) 毫米/小时(mm/hr) 毫米/小时(mm/hr)
逐日预报降水量 米/秒(meter/sec) 英寸/小时(in/hr) 雷达降水强度(0~1) 毫米/小时(mm/hr) 毫米/小时(mm/hr)
距离 米(m) 英里(mi) 公里(km) 公里(km) 公里(km)
温度 开尔文(K) 华氏度(℉) 摄氏度(℃) 摄氏度(℃) 摄氏度(℃)
气压 帕(Pa) 帕(Pa) 帕(Pa) 帕(Pa) 帕(Pa)
相对湿度 0~1 0~1 0~1 0~1 0~1
风向 从北顺时针(0~360°) 从北顺时针(0~360°) 从北顺时针(0~360°) 从北顺时针(0~360°) 从北顺时针(0~360°)
风速 米/秒(m/s) 英里/小时(mi/hr) 公里/小时(km/hr) 公里/小时(km/hr) 公里/小时(km/hr)
云量 0~1 0~1 0~1 0~1 0~1
能见度 米(m) 英里(mi) 公里(km) 公里(km) 公里(km)

unit=metric:v1时,所有类型中precipitation的单位都是:雷达降水强度(0~1)

unit=metric:v2时,所有类型中precipitation的单位都是:毫米/小时(mm/hr)

2.判断降水等级:

  • 带参数&unit=metric:v1,请求实况、分钟级、逐小时和逐日降水强度,单位都为雷达降水强度(0 ~ 1);
  • 雷达降水强度(0 ~ 1)判断降水等级:0.03~0.25 小雨(雪), 0.25~0.35 中雨(雪), 0.35~0.48大雨(雪), >0.48 暴雨(雪);
  • v2.4版本中,本地存在降水时,可以根据skycon(存在于realtime、hourly、daily字段),和skycon_08h_20h和skycon_20h_32h(存在于daily字段),中的:LIGHT_RAIN, MODERATE_RAIN, HEAVY_RAIN, STORM_RAIN(LIGHT_SNOW, MODERATE_SNOW, HEAVY_SNOW,STORM_SNOW)直接获取降水等级
  • 大暴雨(雪)和特大暴雨(雪),需要根据24小时累计公制降水量(mm/24hr)来判断,研发中...