Skip to main content

Easy access to the meteoblue dataset API

Project description

meteoblue Python Dataset SDK

PyPI version

This library simplifies access to the meteoblue dataset API.

In order to use this library you need a meteoblue API key.

Features:

  • Fetch any dataset from the meteoblue environmental data archive
  • Transparently integrates job queues to query large datasets
  • Efficiently transfers data using compressed protobuf messages
  • Asynchronous interface to query data in parallel
  • Data can be used as simple floating-point arrays. No further formatting required.

Installation

  • Ensure that you are using at least Python 3.7 with python --version
  • Install the module with pip3 install 'meteoblue_dataset_sdk>=1.0.0,<2'

This module will also install the following dependencies automatically:

  • aiohttp >=3.6,<4
  • protobuf >=3.0,<4

Usage

import meteoblue_dataset_sdk

async def myFunction():
    # Query 1 year of hourly temperature for Basel from meteoblue NEMSGLOBAL
    query = {"geometry": {"type": "MultiPoint", "coordinates": [[7.57327, 47.558399, 279]], "locationNames": ["Basel"]}, "format": "json", "timeIntervals": [
            "2019-01-01T+00:00/2019-01-01T+00:00"], "queries": [{"domain": "NEMSGLOBAL", "timeResolution": "hourly", "codes": [{"code": 11, "level": "2 m above gnd"}]}]}

    client = mbdataset.Client(apikey='XXXXXXXXXXXXXXX')
    result = await client.query(query)
    # result is a structured object containing timestamps and data

    timestamps = result.geometries[0].timeIntervals[0].timestamps
    data = result.geometries[0].codes[0].timeIntervals[0].data

    print(timestamps)
    # [1546300800, 1546304400, 1546308000, 1546311600, 1546315200, ...
    print(data)
    # [2.89, 2.69, 2.549999, 2.3800001,

More detailed output:

geometries {
  domain: "NEMSGLOBAL"
  lats: 47.66651916503906
  lons: 7.5
  asls: 499.7736511230469
  locationNames: "Basel"
  nx: 1
  ny: 1
  timeResolution: "hourly"
  timeIntervals {
    timestamps: 1546300800
    timestamps: 1546304400
    timestamps: 1546308000
    timestamps: 1546311600
    timestamps: 1546315200
    timestamps: 1546318800
    timestamps: 1546322400
    timestamps: 1546326000
    timestamps: 1546329600
    timestamps: 1546333200
    timestamps: 1546336800
    timestamps: 1546340400
    timestamps: 1546344000
    timestamps: 1546347600
    timestamps: 1546351200
    timestamps: 1546354800
    timestamps: 1546358400
    timestamps: 1546362000
    timestamps: 1546365600
    timestamps: 1546369200
    timestamps: 1546372800
    timestamps: 1546376400
    timestamps: 1546380000
    timestamps: 1546383600
  }
  codes {
    code: 11
    level: "2 m above gnd"
    unit: "\302\260C"
    aggregation: "none"
    timeIntervals {
      data: 2.890000104904175
      data: 2.690000057220459
      data: 2.549999952316284
      data: 2.380000114440918
      data: 2.2699999809265137
      data: 2.119999885559082
      data: 1.9900000095367432
      data: 1.8300000429153442
      data: 1.8200000524520874
      data: 2.0999999046325684
      data: 2.430000066757202
      data: 2.9200000762939453
      data: 3.7200000286102295
      data: 3.930000066757202
      data: 3.9100000858306885
      data: 3.5299999713897705
      data: 3.130000114440918
      data: 2.880000114440918
      data: 2.6500000953674316
      data: 2.4600000381469727
      data: 2.2799999713897705
      data: 2.0299999713897705
      data: 1.690000057220459
      data: 1.3799999952316284
    }
  }
}

Developer setup

python3 -m venv env
source env/bin/activate
pip3 install -r requirements.txt

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

meteoblue_dataset_sdk-0.0.14.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meteoblue_dataset_sdk-0.0.14-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meteoblue_dataset_sdk-0.0.14.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for meteoblue_dataset_sdk-0.0.14.tar.gz
Algorithm Hash digest
SHA256 565da568039733b1776decf7d03a9e06c6452c41270ccb9f8539074743c5794c
MD5 9cfa5ff827afa2e7548576e0812e7974
BLAKE2b-256 d567d54b7a05aa5f210eaeb00a88e49601248c5498b00af0c2c6af46bb2633c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: meteoblue_dataset_sdk-0.0.14-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for meteoblue_dataset_sdk-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 277a36b6f5bc5fc488fc0c363c71e4d11d01df1ca042f930c241530b84fb3c9d
MD5 ba66594d1ff7c28b695ae5ecf55d1d2b
BLAKE2b-256 02586f9117d4f59905531516377bb1a70c0d03a38498f97f4fa8085de32dfbcd

See more details on using hashes here.

Supported by

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