Skip to main content

A Python module to obtain and read Dutch weather data from Meteoserver.nl

Project description

Meteoserver

PyPI PyPI - Downloads Documentation Status PyPI - License

A Python module to obtain and read Dutch weather data from Meteoserver.nl. The code is being developped by Marc van der Sluys of the department of Astrophysics at the Radboud University Nijmegen, the Netherlands and the department of Sustainable energy of the HAN University of Applied Sciences in Arnhem, the Netherlands.

Installation

This package can be installed using pip install meteoserver. This should automatically install the dependency packages pandas and requests, if they haven't been installed already. If you are installing by hand, ensure that these packages are installed as well.

You will need to obtain a (free) account and API key at Meteoserver.nl to download data from the Meteoserver API.

Example use

"""Example Python script using the Meteoserver module."""

import meteoserver as meteo

myKey = '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 pages

  • Pypi: Meteoserver Python package
  • GitHub: Meteoserver source code
  • ReadTheDocs: Meteoserver documentation

Author and licence

References

  • Data, API key and API documentation can be obtained from Meteoserver.nl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meteoserver-0.0.14.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

meteoserver-0.0.14-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file meteoserver-0.0.14.tar.gz.

File metadata

  • Download URL: meteoserver-0.0.14.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for meteoserver-0.0.14.tar.gz
Algorithm Hash digest
SHA256 407229320d1d8d7b49f963a9092ff457d1aeb9b4a55204290379f209ebb899cc
MD5 5c02c58f6c7cbf54a78e4bd2c449193c
BLAKE2b-256 279015727b777c8b0a620cccaf301cba911e49d6dcdfb63665b6ff74f6edba34

See more details on using hashes here.

File details

Details for the file meteoserver-0.0.14-py3-none-any.whl.

File metadata

  • Download URL: meteoserver-0.0.14-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for meteoserver-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 452c5fa6ada8d003c41a0d417b8197badb5909cbe357cf2a4483091c45245646
MD5 cc28695d8b90f5dacf825d6d204974fd
BLAKE2b-256 ddf85210d30d297754d23d1bc862fc6e5765105b6988120416237723d1fdc353

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page