Metadata-Version: 2.4
Name: jua
Version: 0.1.0
Summary: Easy access to Jua's weather & power services
Project-URL: Documentation, https://docs.jua.ai
Project-URL: Source, https://github.com/juaAI/jua-python-sdk
Author-email: "Jua.ai AG" <contact@jua.ai>
License-Expression: MIT
License-File: LICENSE
Keywords: energy,energy trading,forecast,hindcast,power,trading,weather,weather forecast
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.11
Requires-Dist: aiohttp>=3.11.18
Requires-Dist: dask>=2025.4.1
Requires-Dist: fsspec>=2025.3.2
Requires-Dist: pandas>=2.2.3
Requires-Dist: pydantic-settings>=2.8.1
Requires-Dist: pydantic>=2.10.6
Requires-Dist: requests>=2.32.3
Requires-Dist: types-requests>=2.32.0.20250328
Requires-Dist: xarray>=2025.4.0
Requires-Dist: zarr>=3.0.0
Provides-Extra: examples
Requires-Dist: ipykernel>=6.29.5; extra == 'examples'
Provides-Extra: plotting
Requires-Dist: matplotlib>=3.8.0; extra == 'plotting'
Description-Content-Type: text/markdown

# Jua Python SDK

Access industry-leading weather forecasts wtih ease

## Getting Started 🚀

### Install

We strongly recommend using [uv](https://docs.astral.sh/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](https://app.jua.sh/api-keys) and copy the file to `~/.jua/default/api-key.json`.

### Access the latest 20-day forecast for a specific points

```python
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

```python
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

```python
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
```
