Difference between revisions of "逐分钟降水短临预报接口/v2.2"
Liuzhonghua (talk | contribs) (→示例2如下) |
Liuzhonghua (talk | contribs) (→返回结构和说明) |
||
Line 24: | Line 24: | ||
==返回结构和说明== | ==返回结构和说明== | ||
<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", | |
− | + | "probability":[0.658591032,0.7041746378,0.5904211998,0.7576189041], | |
− | + | "probability_4h":[0.7041746378,0.7576189041,0.764185369,0.6725049615],"datasource":"radar", | |
− | + | "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], | |
− | + | "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]}, | |
− | + | "primary":0}, | |
− | + | "location":[27.8943, | |
− | + | 118.1484], | |
− | + | "placename":"Unnamed Road, Wanli District, New Taipei City, Taiwan 207", | |
− | + | "server_time":1542700934, | |
− | + | "tzshift":28800 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | location:[ | ||
− | |||
− | placename:Unnamed Road, Wanli District, New Taipei City, Taiwan 207, | ||
− | server_time: | ||
− | tzshift: | ||
} | } | ||
Revision as of 08:06, 20 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:(简体中文(zh_CN)、繁体中文(zh_TW)、美式英语(en_US)、英式英语(en_GB))
经纬度附近地址中英文名称:getplacename=True
单位制选项 unit:(科学单位体系(SI) 、公制(metric)、英制(imperial))、(降水单位:mm/h)
时区偏移秒数:tzshift:(例如:印度东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", "probability":[0.658591032,0.7041746378,0.5904211998,0.7576189041], "probability_4h":[0.7041746378,0.7576189041,0.764185369,0.6725049615],"datasource":"radar", "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], "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]}, "primary":0}, "location":[27.8943, 118.1484], "placename":"Unnamed Road, Wanli District, New Taipei City, Taiwan 207", "server_time":1542700934, "tzshift":28800 }变量说明
逐日预报,没有逐日预报的自然语言描述字段
名称 健值路径(jsonpath) 量 时间粒度 地理范围 注释 温度 $.result.daily.temperature[max,min,avg] 温度 逐日预报 全球 地表2米气温 气压 $.result.daily.pres[max,min,avg] 气压(Pa) 逐日预报 全球 地面气压 相对湿度 $.result.daily.humidity[max,min,avg] 相对湿度(%) 逐日预报 全球 地表2米湿度 风速 $.result.daily.wind.speed[max,min,avg] 风速 逐日预报 全球 地表10米风速 本地降水强度 $.result.daily.precipitation[max,min,avg] 降水强度 逐日预报 全球 本地降水强度 云量 $.result.daily.cloudrate[max,min,avg] 云量(0.0-1.0) 逐日预报 全球 全天总云量 短波辐射 $.result.daily.dswrf[max,min,avg] 向下短波辐射通量(W/M2) 逐日预报 全球 地表向下短波辐射通量 能见度 $.result.daily.visibility[max,min,avg] 能见度 逐日预报 全球 地表水平能见度 全天主要天气现象 $.result.daily.skycon.value 天气状况 逐日预报 全球 全天主要天气现象 白天主要天气现象 $.result.daily.skycon_08h_20h.value 天气状况 逐日预报 全球 白天主要天气现象 夜晚主要天气现象 $.result.daily.skycon_20h_32h.value 天气状况 逐日预报 全球 夜晚主要天气现象 紫外线指数 $.result.daily.ultraviolet.desc 紫外线指数自然语言 逐日预报 全球 紫外线指数及其描述 舒适度指数 $.result.daily.comfort.desc 舒适度指数自然语言 逐日预报 全球 舒适度指数及其描述 洗车指数 $.result.daily.carWashing.desc 舒适度指数自然语言 逐日预报 全球 洗车指数及其描述 感冒指数 $.result.daily.coldRisk.desc 舒适度指数自然语言 逐日预报 全球 感冒指数及其描述 冷热指数 $.result.daily.dressing.desc 舒适度指数自然语言 逐日预报 全球 冷热指数及其描述 PM25浓度 $.result.daily.pm25[max,min,avg] PM25浓度(μg/m3) 逐日预报 大陆、港澳台、暂无印度 PM25浓度 AQI $.result.daily.aqi[max,min,avg] 国标AQI 逐日预报 大陆、港澳台、暂无印度 国标AQI 日出日落 $.result.astro.aqi[sunrise,sunset] 国标AQI 逐日预报 大陆、港澳台、暂无印度 日出日落(当地时区的时刻,tzshift不作用在这个变量) 天气现象
天气现象 代码 晴(白天) CLEAR_DAY 晴(夜间) CLEAR_NIGHT 多云(白天) PARTLY_CLOUDY_DAY 多云(夜间) PARTLY_CLOUDY_NIGHT 阴 CLOUDY 大风 WIND 雾霾 HAZE 雨 RAIN 雪 SNOW 支持的单位制
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)来判断,研发中...