Difference between revisions of "逐分钟降水短临预报接口/v2.2"
Liuzhonghua (talk | contribs) (→示例2如下) |
Liuzhonghua (talk | contribs) (→变量说明) |
||
(30 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
<code> | <code> | ||
− | https://api.caiyunapp.com/v2/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.json | + | <nowiki>https://api.caiyunapp.com/v2/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.json</nowiki> |
</code> | </code> | ||
Line 15: | Line 15: | ||
=== '''示例1如下''' === | === '''示例1如下''' === | ||
− | <blockquote><code>https://api.caiyunapp.com/v2/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.json</code> | + | <blockquote><code><nowiki>https://api.caiyunapp.com/v2/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.json</nowiki></code> |
− | < | + | |
− | </blockquote><blockquote>'''token:'''这里是测试 token ,即 <code>TAkhjf8d1nlSlspN</code></blockquote><blockquote>'''经纬度:'''经度在前,纬度在后,中间用半角逗号隔开,这里是 <code>121.6544,25.1552</code></blockquote><blockquote>'''返回格式:'''json 或者 jsonp,jsonp 需提供回调函数名</blockquote> | + | </blockquote><blockquote><nowiki>https://api.caiyunapp.com/v2/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.jsonp?callback=MYCALLBACK</nowiki></blockquote><blockquote>'''token:'''这里是测试 token ,即 <code>TAkhjf8d1nlSlspN</code></blockquote><blockquote>'''经纬度:'''经度在前,纬度在后,中间用半角逗号隔开,这里是 <code>121.6544,25.1552</code></blockquote><blockquote>'''返回格式:'''json 或者 jsonp,jsonp 需提供回调函数名</blockquote> |
=== '''示例2如下''' === | === '''示例2如下''' === | ||
− | <blockquote>< | + | <blockquote><nowiki>https://api.caiyunapp.com/v2/TAkhjf8d1nlSlspN/118.7087,26.9582/minutely?lang=en_US&getplacename=True</nowiki></blockquote><blockquote>'''经纬度附近地址中英文名称 getplacename:'''True</blockquote><blockquote>'''语言选项 lang:'''默认为简体中文(zh_CN)、繁体中文(zh_TW)、美式英语(en_US)、英式英语(en_GB)</blockquote><blockquote>'''单位制选项 unit:'''默认为公制(metric)、科学单位体系(SI) 、英制(imperial)</blockquote><blockquote>'''时区偏移秒数:tzshift:'''默认为东八区,tzshift=28800;例如:印度东5.5区,tzshift=3600*5.5==19800,v2.3之后版本,返回时区信息,使用秒是为了支持像尼泊尔这样的差 5 小时 45 分钟的地区,它们有非整齐的偏移量</blockquote><blockquote> |
==返回结构和说明== | ==返回结构和说明== | ||
+ | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | { status:ok, | |
− | + | api_version:v2.2, // 版本号 | |
− | + | api_status:active, // 版本号状态 | |
− | + | lang:zh_CN, // 语言 | |
− | + | unit:metric, // 单位制 | |
− | + | result:{ forecast_keypoint:Cloudy here but it's raining SE 41 km away, // 逐小时和逐分钟天气预报,综合自然语言描述 | |
− | + | minutely:{status:ok, // 逐日预报模块返回状态 | |
+ | description:Cloudy here but it's raining SE 41 km away, // 逐小时天气预报,自然语言描述 | ||
+ | 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, | ||
+ | 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, | ||
+ | 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, | ||
+ | 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, | ||
+ | 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, | ||
+ | 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小时,逐分钟,雷达降水强度预报 | ||
+ | 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, | ||
+ | 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, | ||
+ | 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小时,逐分钟,雷达降水强度预报 | ||
− | + | probability:[0.658591032,0.7041746378,0.5904211998,0.7576189041], // 未来2小时,逐半小时,雷达降水概率预报 | |
− | + | probability_4h:[0.7041746378,0.7576189041,0.764185369,0.6725049615], // 未来4小时,逐一小时,雷达降水概率预报 | |
− | + | datasource:radar}, | |
− | + | primary:0}, | |
− | + | location:[27.8943, | |
− | + | 118.1484], // 经纬度 | |
− | + | placename:Unnamed Road, Wanli District, New Taipei City, Taiwan 207, // 经纬度处地址 | |
− | + | server_time:1542700934, // 服务器本次返回的utc时间戳 | |
− | + | tzshift:28800 // 时区的偏移秒数,如东八区就是 28800 秒 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | location:[ | ||
− | |||
− | placename:Unnamed Road, Wanli District, New Taipei City, Taiwan 207, | ||
− | server_time: | ||
− | tzshift: | ||
} | } | ||
Line 86: | Line 63: | ||
! 健值路径(jsonpath) !! 量 !! 时间粒度 !! 地理范围 !! 注释 | ! 健值路径(jsonpath) !! 量 !! 时间粒度 !! 地理范围 !! 注释 | ||
|- | |- | ||
− | ! | + | ! 短临2h降水强度 |
− | | $.result. | + | | $.result.minutely.precipitation_2h[:] || 雷达降水强度 || 逐日预报 || 全球 || 本地未来2小时逐分钟,短临降水强度预报 |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | ! | + | ! 短临4h降水强度 |
− | | $.result. | + | | $.result.minutely.probability_4h[:] || 雷达降水强度 || 逐日预报 || 全球 || 本地未来2小时逐30钟,短临降水强度预报 |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
Line 202: | Line 73: | ||
{{Template:彩云天气 API/支持的单位制}} | {{Template:彩云天气 API/支持的单位制}} | ||
+ | |||
+ | [[Category:API 产品]] |
Latest revision as of 05:04, 30 November 2018
本文版本:逐分钟降水短临预报接口/v2.2,当前稳定版本版本:v2.5,历史版本:v2.2,v2.3,和 v2.4。
授权与认证
请先至彩云开放平台注册,注册后可以获得 token 。
把您的 token 拼到 API 请求的 URL 中,如
https://api.caiyunapp.com/v2/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.json
其中 TAkhjf8d1nlSlspN 就是一个共用测试 token 。不要把私有token 告诉任何人!
请求样例
示例1如下
https://api.caiyunapp.com/v2/TAkhjf8d1nlSlspN/121.6544,25.1552/minutely.json
https://api.caiyunapp.com/v2/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/TAkhjf8d1nlSlspN/118.7087,26.9582/minutely?lang=en_US&getplacename=True
经纬度附近地址中英文名称 getplacename:True
语言选项 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, api_version:v2.2, // 版本号 api_status:active, // 版本号状态 lang:zh_CN, // 语言 unit:metric, // 单位制 result:{ forecast_keypoint:Cloudy here but it's raining SE 41 km away, // 逐小时和逐分钟天气预报,综合自然语言描述 minutely:{status:ok, // 逐日预报模块返回状态 description:Cloudy here but it's raining SE 41 km away, // 逐小时天气预报,自然语言描述 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, 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, 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, 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, 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, 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小时,逐分钟,雷达降水强度预报 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, 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, 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小时,逐分钟,雷达降水强度预报 probability:[0.658591032,0.7041746378,0.5904211998,0.7576189041], // 未来2小时,逐半小时,雷达降水概率预报 probability_4h:[0.7041746378,0.7576189041,0.764185369,0.6725049615], // 未来4小时,逐一小时,雷达降水概率预报 datasource:radar}, primary:0}, location:[27.8943, 118.1484], // 经纬度 placename:Unnamed Road, Wanli District, New Taipei City, Taiwan 207, // 经纬度处地址 server_time:1542700934, // 服务器本次返回的utc时间戳 tzshift:28800 // 时区的偏移秒数,如东八区就是 28800 秒 }变量说明
逐日预报,没有逐日预报的自然语言描述字段
名称 健值路径(jsonpath) 量 时间粒度 地理范围 注释 短临2h降水强度 $.result.minutely.precipitation_2h[:] 雷达降水强度 逐日预报 全球 本地未来2小时逐分钟,短临降水强度预报 短临4h降水强度 $.result.minutely.probability_4h[:] 雷达降水强度 逐日预报 全球 本地未来2小时逐30钟,短临降水强度预报 支持的单位制
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)来判断,研发中...