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.2.tar.gz (6.7 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.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sal_xarray-0.2.2.tar.gz
  • Upload date:
  • Size: 6.7 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.2.tar.gz
Algorithm Hash digest
SHA256 2120f2c2eac76fe9ed64c93bc8745a348d07453664f2f8b458b18a6add5f4c7c
MD5 e3c9b2375763fa224d7194ca487a14f5
BLAKE2b-256 fa8f45dcaf3004362c39bb882f005bc316f9afc5e3f7504e9a67d8ef8e6605c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for sal_xarray-0.2.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: sal_xarray-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 401e3074f184e9e6209756a5957b9a80902762b422381dffe04171bbd15c214a
MD5 551d4e240903201f82992c12167469f4
BLAKE2b-256 dc2d4b1c2f96a1fe3c3807966a30caf19ffb5a7a041ae836072eafd0cba31200

See more details on using hashes here.

Provenance

The following attestation bundles were made for sal_xarray-0.2.2-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