Skip to main content

sdf-logo

Scientific Data Format for Python

SDF is a Python package to read, write and interpolate multi-dimensional data. The Scientific Data Format is an open file format based on HDF5 to store multi-dimensional data such as parameters, simulation results or measurements. It supports...

  • very large files
  • up to 32 dimensions
  • hierarchical structure
  • units, comments and custom meta-information

For detailed information see the SDF specification.

Installation

To install the latest release from PyPI or update an existing installation:

python -m pip install --upgrade sdf

Tutorial

Import the SDF and NumPy packages:

>>> import sdf
>>> import numpy as np

Create the data arrays:

>>> t = np.linspace(0, 10, 51)
>>> v = np.sin(t)

Create the datasets:

>>> ds_t = sdf.Dataset('t', data=t, unit='s', is_scale=True, display_name='Time')
>>> ds_v = sdf.Dataset('v', data=v, unit='V', scales=[ds_t])

Create the root group and write the file:

>>> g = sdf.Group('/', comment='A sine voltage', datasets=[ds_t, ds_v])
>>> sdf.save('sine.sdf', g)

Read the dataset from the SDF file asserting the correct unit of the dataset and scale:

>>> ds_v2 = sdf.load('sine.sdf', '/v', unit='V', scale_units=['s'])

Get the meta info and data array from the dataset:

>>> ds_v2.unit
'V'
>>> ds_v2.data.shape
(51,)

Get the scale for the first dimension:

>>> ds_t2 = ds_v2.scales[0]
>>> ds_t2.unit
's'

License

The code is released under the 2-Clause BSD license.


Release files for SDF 0.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for SDF 0.3.8
File Interpreter ABI Platform
sdf-0.3.8-py3-none-any.whl Python 3 none any Details

Release files / sdf-0.3.8-py3-none-any.whl

Download URL sdf-0.3.8-py3-none-any.whl
Size 343.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d51a175ae21b01466ffa6d0d56ffdc3224988d5d551cd1747b23b53fbefee58
BLAKE2b-256 checksum
How to use checksums
07a4116c2d80f9384d856906a36efdeff3bfdc4c2154f9812037edd679ca5763
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.3.8 This release

1 release file

0.3.7

1 release file

0.3.6

1 release file

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page