githubEdit

JuaDataset

JuaDataset

The JuaDataset is the primary container for weather data in the Jua Python SDK. When you request weather forecasts or hindcasts from any Jua model, the results are returned as a JuaDataset object.

Overview

JuaDataset serves as a specialized wrapper around xarrayarrow-up-right Datasets, providing:

  • Extensions to xarray functionality for weather-specific operations

  • Convenient methods to save data to disk in Zarr format

  • Memory usage information and management

Working with JuaDataset

Getting a JuaDataset

from datetime import datetime

from jua import JuaClient
from jua.weather import Models

client = JuaClient()

# Get the forecast for all of Switzerland from the 1st of January 2024
model = client.weather.get_model(Models.EPT2)
forecast_data = model.get_forecasts(  # Returns a JuaDataset
    init_time=datetime(2024, 1, 1, 0),
    latitude=slice(45, 48),
    longitude=slice(5, 11),
)

Accessing Variables

You can access variables directly using dictionary syntax:

Working with xarray

JuaDataset seamlessly integrates with xarray's functionality:

Saving Data

JuaDataset can be saved to disk in Zarr format for later use:

Obtaining Statistics from Ensemble Models

Ensemble statistics can be obtained from EPT-2e. The default behavior of get_forecasts is to simply return the ensemble mean. To obtain forecast statistics, specify which ones are needed.

Statistics can then be accessed through the stat coordinate:

Best Practices

  1. Use Variables enum for type-safe access to variables

  2. Convert to xarray for complex operations and analysis

  3. Save large datasets to disk for repeated use

Complete Example

Last updated