1、国家气象科学数据中心
预报数据:需要定制,收费10万+
观测数据:国家气象信息中心-中国气象数据网 (cma.cn)https://data.cma.cn/data/cdcdetail/dataCode/A.0012.0001.html
地面基本气象观测数据
滞后2天
滞后一天
路面数据同化系统,实时
国家气象信息中心-中国气象数据网 (cma.cn)https://data.cma.cn/data/detail/dataCode/NAFP_CLDAS2.0_RT.html
2、openweatherapi
Сurrent weather and forecast - OpenWeatherMaphttps://openweathermap.org/city/1796236openweatherapi访问地球上任何位置的当前天气数据,收集和处理不同来源的天气数据,例如全球和本地天气模型、卫星、雷达、和庞大的气象站网站、数据以JSON、XML或者HTML格式提供。
收费标准:
免费:
API的接口每分钟可以请求60次,一个月请求1,000,000次。当前的天气,3小时预测未来5天的,提供基础的天气地图
start up:30英镑/月
API的接口每分钟可以请求600次,一个月请求10,000,000次。当前的天气,3小时预测未来5天的,一天预测未来16天的,提供基础的天气地图
developer:140英镑/月
API的接口每分钟可以请求3,000次,一个月请求100,000,000次。当天的天气,3小时预测未来5天的,一小时预测未来4天的,一天预测未来16天的,30天气候预报,高级天气图、历史地图
professional:370英镑/月
API的接口每分钟可以请求30,000次,一个月请求1,000,000,000次。当天的天气,3小时预测未来5天的,一小时预测未来4天的,一天预测未来16天的,30天气候预报,批量下载全球各个城市的数据,高级天气图、历史地图全球降水地图
enterprise:1500英镑/月
API的接口每分钟可以请求200,000次,一个月请求5,000,000,000次。当天的天气,3小时预测未来5天的,一小时预测未来4天的,一天预测未来16天的,30天气候预报,批量下载全球各个城市的数据+美国、欧盟、英国,高级天气图、历史地图全球降水地图
注册:
采用免费的API
from tkinter import *
import requests
import json
from datetime import datetime
root =Tk()
root.geometry("400x400")
root.resizable(0,0)
root.title("天气预报APP - 爱看书的小沐")
city_value = StringVar()
def time_format_for_location(utc_with_tz):
local_time = datetime.utcfromtimestamp(utc_with_tz)
return local_time.time()
def showWeather():
#Enter you api key, copies from the OpenWeatherMap dashboard
api_key = " API " #sample API
# Get city name from user from the input field (later in the code)
city_name=city_value.get()
# API url
weather_url = 'http://api.openweathermap.org/data/2.5/weather?q=' + city_name + '&appid='+api_key
# Get the response from fetched url
response = requests.get(weather_url)
# changing response from json to python readable
weather_info = response.json()
print(weather_info)
if weather_info['cod'] == 200:
kelvin = 273 # value of kelvin
temp = int(weather_info['main'][