Skip to main content

Easy access to Jua's weather & power services

Project description

Jua Python SDK

Access industry-leading weather forecasts wtih ease

Getting Started 🚀

Install

We strongly recommend using uv to manage dependencies. python>=3.11 is required. TODO: Create PyPI entry

Authentication

TODO: After installing run jua auth. This will open your webbrowser for authentication.

Alternatively, generate an API Key here and copy the file to ~/.jua/default/api-key.json.

Access the latest 20-day forecast for a specific points

import matplotlib.pyplot as plt
from jua import JuaClient
from jua.types.geo import LatLon
from jua.weather import Models, Variables

client = JuaClient()
model = client.weather.get_model(Models.EPT1_5)
zurich = LatLon(lat=47.3769, lon=8.5417)
# Get latest forecast
forecast = model.forecast.get_forecast(
    points=[zurich]
)
temp_data = forecast.to_xarray()[Variables.AIR_TEMPERATURE_AT_HEIGHT_LEVEL_2M]
temp_data.to_celcius().plot()

Plot the global forecast with 10h lead time

import matplotlib.pyplot as plt
from jua import JuaClient
from jua.types.geo import LatLon
from jua.weather import Models, Variables

client = JuaClient()
model = client.weather.get_model(Models.EPT1_5)

lead_time = 10 # hours
dataset = model.forecast.get_forecast(
    prediction_timedelta=lead_time,
    variables=[
        Variables.WIND_SPEED_AT_HEIGHT_LEVEL_10M,
    ],
)
dataset[Variables.WIND_SPEED_AT_HEIGHT_LEVEL_10M].plot()
plt.show()

Access historical data with ease

import matplotlib.pyplot as plt
from jua import JuaClient
from jua.types.geo import LatLon
from jua.weather import Models, Variables

client = JuaClient()
model = client.weather.get_model(Models.EPT1_5_EARLY)

init_time = "2024-02-01T06:00:00.000000000"
hindcast = model.hindcast.get_hindcast(
    variables=[Variables.AIR_TEMPERATURE_AT_HEIGHT_LEVEL_2M],
    init_time=init_time,
    prediction_timedelta=0,
    # Select Europe
    latitude=slice(71, 36),  # Note: slice is inverted
    longitude=slice(-15, 50),
    method="nearest",
)

data = hindcast.to_xarray()[Variables.AIR_TEMPERATURE_AT_HEIGHT_LEVEL_2M]
data.plot()
plt.show()

Development

To install all dependencies run

uv sync --all-extras

Enable pre-commit for linting and formatting:

uv run pre-commit install && uv run pre-commit install-hooks

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

jua-0.1.0.tar.gz (873.5 kB view details)

Uploaded Source

Built Distribution

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

jua-0.1.0-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file jua-0.1.0.tar.gz.

File metadata

  • Download URL: jua-0.1.0.tar.gz
  • Upload date:
  • Size: 873.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for jua-0.1.0.tar.gz
Algorithm Hash digest
SHA256 517951cbaa14227df3f8a8f7e50851e5a734737421f165614af5b94cac94889c
MD5 f0175346768f9d75fd6b3e36179cd2ca
BLAKE2b-256 74055204c618988448e5a8d7c6cf234132f1bcf9e8b779ca9debfd91776ebbbd

See more details on using hashes here.

File details

Details for the file jua-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jua-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for jua-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bedeaa2092d31d83cac412404ebd41f3211bcead444c8bc9d0f7741ec96157ba
MD5 fd18bd0283edfa3ff0e692a0100cf870
BLAKE2b-256 b2a31bf2de81d2fd263bc75e31cf6179158290b1749289734d5eccb90dcd3816

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