Package: weather_provider_api
Weather Provider Library and APIThis API is intended to help you fetch weather data from different data sources in an efficient and uniform way.
By just supplying a list of locations and a time window you can get data for a specific source immediately.This project can currently be found on the following location:https://github.com/alliander-opensource/Weather-Provider-APIFor more information also check out this webinar:The project uses a number of data sources for the acquisition of weather data. Currently being supported by this API
are the following weather data sources:DATA SOURCE #1: KNMI Historical data per day / hourConsists of the data from 35 weather stations for temperature, sun, cloud, air pressure, wind and precipitation.A full description of available weather variables is available for the data per day:http://projects.knmi.nl/klimatologie/daggegevens/selectie.cgiA full description for the data per hour consists only of a subset of the previous list:http://projects.knmi.nl/klimatologie/uurgegevens/selectie.cgiDATA SOURCE #2: KNMI prediction data (14 day prediction, per block of 6 hours)Prediction data for weather stations:
De Bilt, Den Helder(De Kooy), Groningen(Eelde), Leeuwarden, Maastricht(Beek), Schiphol, Twente en VlissingenAvailable weather variables are temperature, wind, precipitation, cape for summer, and snow for winter.An interactive graph can be found at:https://www.knmi.nl/nederland-nu/weer/waarschuwingen-en-verwachtingen/weer-en-klimaatpluimDATA SOURCE #3: KNMI prediction data (48 hour, per hour prediction)Prediction data is updated every 6 hours (00, 06, 12 and 18 UTC+00) based on the HARMONIE AROME model of KNMI.Geographical resolution is 0.037 grades west-east and 0.023 grades north-south.A full description of available weather variables is available at:https://www.knmidata.nl/data-services/knmi-producten-overzicht/atmosfeer-modeldata/data-product-1DATA SOURCE #4: KNMI current weather data()Actuele waarnemingenDATA SOURCE #5: CDS (Climate Data Store) hourly data from 1979 to presentERA5 is the fifth generation ECMWF (European Centre for Medium Range Weather Forecast)
atmospheric reanalysis of the global climate.
ERA5 data released so far covers the period from 1979 to 2-3 months before the present.
ERA5 provides worldwide data for temperature and pressure, wind (at 100 meter height),
radiation and heat, clouds, evaporation and runoff, precipitation and rain, snow, soil, etc.
The spatial resolution of the data set is approximately 80 km.A full description of available weather variables is available at:https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels?tab=overviewNOTE: The Weather Provider Library and API currently only stores only a selection of the available variables
in its archives.Input parameters to use the APIGeneral input parameterscoords: nested 3-layer list representing a list of polygon.
In case of points, they are treated as one-point polygonstart: start time of output data, for prediction data this is not neededend: end time of output data, for prediction data this is not neededdata_time: history or prediction datadata_source: KNMI, Climate Data Store(CDS, not available yet), DarkSky (not available yet)data_timestep: day, hour, or day_part (6 hour)weather_factors: list of weather factors,
default is all available weather factorsoutput_unit: org (original), human_readable or SI (International System of Units),
default is the original names and units in data sources.Case specific input parametersChoosing (a group of) weather variables for historical data from KNMIFor historical data from KNMI the value forweather_factorsin input can be a list of desired variables in random order,
indicated by their acronyms separated by ':',
for exampleTG: TN: EV24.The following acronyms are defined to indicate groups of variables:WIND = DDVEC:FG:FHX:FHX:FX-windTEMP = TG:TN:TX:T10N-temperatureSUNR = SQ:SP:Q-sunshine duration and global radiationPRCP = DR:RH:EV24-precipitation and evaporationPRES = PG:PGX-pressure at sea levelVICL = VVN:VVX:NG-visibility and cloudsMSTR = UG:UX:UN-humidityALL-all variables (default)Choosing the name and unit for outputThe output data from the four data sources of KNMI may have different names and units for the same weather variable,
which may not easy to use in analytics.This API provides an option to chose a standard name/unit for the mostly used weather variables, see table below.
The value ofoutput_unitin input can be set to:org: to keep the originally used names and unitsSI: to convert the variable-names into SI/human readable name,
and convert the units into SI unitshuman: to convert the variable-names into SI/human readable name,
and convert the units into human-readable units.Hist day nameHist day unitHist hour nameHist hour unitForecast 14d nameForecast 14d unitForecast 48h nameForecast 48h unitSI/Human readable nameSI unitHuman readable unitFG0.1 m/sFH0.1 m/swind_speedkm/uurwind_speedm/sm/sFHX0.1 m/sFX0.1 m/swind_speed_maxm/sm/sTG0.1 celsiusT0.1 celsiustemperaturecelsius2TKtemperatureKcelsiusQJ/cm2QJ/cm2GRADJ m**-2global_radiationJ/m2J/m2RH0.1 mmRH0.1 mmprecipitationmmprecipitationmmmPG0.1 hPaP0.1 hPaLSPPaair_pressurePaPaNG[1,2…9]N[1,2…9]cloud_cover[1,2…9][1,2…9]UG%U%humidity%%The CDS data uses only SI units, and as such there is no distinction betweenorgandsi.Getting started - using as a package/projectPrerequisitesThis package is supported from Python 3.8 or later. See '''requirements.txt''' for a list of dependencies.
This package works under at least Linux and Windows environments. (Other Operating Systems not tested)InstallingClone the repoNavigate to rootInstall the dependencies using conda/pip or both, depending on your environmentconda install --file requirements.txtpip install -r requirements.txtReady for use!Using as a full projectThe full API can now be run by executing:main.pyWith the exception of ERA5 Single Levels and Harmonie Arome data, every data source can now be accessed
using either the created end points or the API docs interface at the running location.
(127.0.0.1:8080 when running locally)Specific calls can now be run by executing the proper command. For examples, check out the\binfolder.Using as a wheelInstall the wheel into your project environment and import the required classes.
Usually this will be either a specific Weather Model or the Weather Controller.ContributingPlease readCONTRIBUTING.mdfor details on our code of conduct, and the process for submitting pull requests to us.ContactTo contact the project owners directly please e-mail us atweather.provider@alliander.comAuthorsThis project was initially created by:Tongyou Gu-Original API developmentJeroen van de Logt-Functions in utilitiesBas Niesink-Implementation weather REST APIRaoul Linnenbank-Active API Development, Geo positioning, CDS ERA5, caching, remodeling, Harmonie Arome and optimisationCurrently, this project is governed in an open source fashion, this is documented inPROJECT_GOVERNANCE.LicenseThis project is licensed under the Mozilla Public License, version 2.0 - see LICENSE for detailsLicenses third-party codeThis project includes third-party code, which is licensed under their own respective Open-Source licenses. SPDX-License-Identifier headers are used to show which license is applicable. The concerning license files can be found in the LICENSES directory.AcknowledgmentsThanks to team Inzicht & Analytics and Strategie & Innovatie to
make this project possible.A big thanks as well to Alliander for being the main sponsor for this open source project.And of course a big thanks to the guys of IT New Business & R&D to provide
such an easy-to-use Python environment in the cloud.