Skip to main content

SAL backend for xarray

Project description

sal-xarray

An xarray backend for SAL (Simple Access Layer) that enables seamless integration of SAL data sources with the xarray ecosystem.

Overview

sal-xarray provides a backend plugin for xarray that allows you to access SAL data sources using xarray's familiar API. It automatically handles the conversion of SAL signals to xarray DataArrays and Datasets, making it easy to work with SAL data in scientific Python workflows.

Features

  • xarray Integration: Access SAL data using xarray's open_dataset function
  • Automatic Conversion: Converts SAL signals to xarray DataArrays with proper coordinates and metadata
  • Status Mask Handling: Includes status mask data alongside signal data
  • URI-based Access: Simple URI scheme (sal://pulse/<shot_number>/<signal_name>) for accessing data

Installation

pip install sal-xarray

Or using uv:

uv pip install sal-xarray

JET data access requires a VPN connection to the JDC. You will also require a config file at ~/.sal/credentials with the following content:

[https://sal.jetdata.eu]
user=<user-name>
password=<password>

Usage

Open a SAL dataset using xarray:

import xarray as xr

# Open a SAL signal by name and shot number
ds = xr.open_dataset("sal://pulse/87737/ppf/signal/jetppf/magn/ipla", engine="sal")

# Access the data
data = ds["data"]
status = ds["status"]

# The dataset includes time coordinates
time = ds["time"]

# Access metadata
units = ds["data"].attrs["units"]
signal_name = ds["data"].attrs["sal_name"]

The URI format is: sal://pulse/<shot_number>/<signal_name>

Data Structure

When you open a SAL dataset, sal-xarray creates an xarray Dataset with:

  • data: The signal data as a DataArray
  • status: The status data as a DataArray
  • time: Time coordinates (dimension)
  • attrs: Metadata including units and SAL signal name

Development

Setup

Clone the repository and install development dependencies:

git clone https://github.com/samueljackson92/sal-xarray.git
cd sal-xarray
uv sync

Running Tests

uv run pytest tests/

Code Quality

The project uses ruff for linting and formatting, and pylint for additional checks:

# Run ruff
uv run ruff check sal_xarray tests
uv run ruff format sal_xarray tests

# Run pylint
uv run pylint sal_xarray

# Run ty
uv run ty check sal_xarray

Contributing

Contributions are welcome! Please ensure:

  1. Tests pass for any new functionality
  2. Code follows the project's style guidelines (ruff and pylint)
  3. Documentation is updated as needed

License

MIT License

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

sal_xarray-0.2.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

sal_xarray-0.2.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file sal_xarray-0.2.1.tar.gz.

File metadata

  • Download URL: sal_xarray-0.2.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sal_xarray-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ac841e1d79e43c36d6ab0a887df33b54bc22086b367d2e9fe0394d8d60d28831
MD5 0b816054742c0ee4bb7783e933e70a31
BLAKE2b-256 b26df0751e2302faaa0bf25084fe307439190b62c32fdd229dceea604416eb31

See more details on using hashes here.

Provenance

The following attestation bundles were made for sal_xarray-0.2.1.tar.gz:

Publisher: publish.yml on samueljackson92/sal-xarray

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sal_xarray-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sal_xarray-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sal_xarray-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80858e425e31647b67fea02f761899bea03a995f9f1047ec7794dac5e225960e
MD5 4dce712365175fc303d231847f84d17d
BLAKE2b-256 339f338d9d8f0b62dc0aac394af8a16ea868f5c67421c638d911e6b1b2256372

See more details on using hashes here.

Provenance

The following attestation bundles were made for sal_xarray-0.2.1-py3-none-any.whl:

Publisher: publish.yml on samueljackson92/sal-xarray

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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