从中获取和读取荷兰天气数据的Python模块气象服务器.nl
meteoserver的Python项目详细描述
气象服务器
从中获取和读取荷兰天气数据的Python模块气象服务器.nl. 代码由开发 Marc van der Sluys来自Radboud天体物理系 荷兰奈亨大学应用能源系 荷兰阿纳姆的科学。在
安装
此软件包可以使用pip install meteoserver
安装。这将自动安装
依赖包pandas
和{
您需要在Meteoserver.nl获得一个(免费)帐户和API密钥才能下载 来自Meteoserver API的数据。在
示例使用
"""Example Python script using the Meteoserver module."""importmeteoserverasmeteomyKey='a123456789'# My Meteoserver API key - put your OWN key here!myLocation='De Bilt'# My location# Weather forecast ################################################################################## Print some help:meteo.print_help_weatherforecast()location='Unknown'# Ensure we always have a location 'name' to write to file.# Read weather-forecast data from file:# data = meteo.read_json_file_weatherforecast('WeatherForecast1.json', full=True) # Option 1: HARMONIE/HiRLAM (48 (42?) hours)# data = meteo.read_json_file_weatherforecast('WeatherForecast2.json') # Option 2: GFS (4/10 days), useful columns only, no location# Option 2, with ALL columns and location; don't convert to numerical format, to allow writing to file later:# data, location = meteo.read_json_file_weatherforecast('WeatherForecast2.json', full=True, loc=True, numeric=False)# Get weather-forecast data from server:# data = meteo.read_json_url_weatherforecast(myKey, myLocation, model='HARMONIE') # Option 1: HARMONIE/HiRLAM# data = meteo.read_json_url_weatherforecast(myKey, myLocation) # Option 2 (default): GFS, useful columns only, no location# Option 2, with ALL columns and location; don't convert to numerical format, to allow writing to file later:data,location=meteo.read_json_url_weatherforecast(myKey,myLocation,full=True,loc=True,numeric=False)# Print the data:print(data)# Write the downloaded data to a json file:meteo.write_json_file_weatherforecast('WeatherForecast3.json',location,data)# Sun forecast ###################################################################################### Print some help:meteo.print_help_sunData()# Read a Meteoserver Sun-data JSON file from disc:# current, forecast = meteo.read_json_file_sunData('SunData.json')# Return the location; don't convert to numerical format, to allow writing to file later:# current, forecast, location = meteo.read_json_file_sunData('SunData.json', loc=True, numeric=False)# Get Meteoserver Sun data from the server for the given location (and key):# current, forecast = meteo.read_json_url_sunData(myKey, myLocation)# Return the location; don't convert to numerical format, to allow writing to file later:current,forecast,location=meteo.read_json_url_sunData(myKey,myLocation,loc=True,numeric=False)# Print the current-weather and forecast dataframes:print("\nCurrent Sun/weather observation from a nearby station:")print(current)print("\nSun/weather forecast for the selected location/region:")print(forecast)# Write the downloaded data to a json file:meteo.write_json_file_sunData('SunData1.json',location,current,forecast)
Meteoserver页面
- Pypi:Meteoserver Python包
- GitHub:Meteoserver源代码
- ReadTheDocs:Meteoserver文档
作者和许可证
- 作者:马克·范德斯吕斯
- 联系人:http://han.vandersluys.nl/en/
- 许可证:GPLv3+
参考文献
- 数据、API密钥和API文档可从Meteoserver.nl获取
- 项目
标签: