sdf-xarray

An xarray backend for reading SDF files from EPOCH

https://github.com/epochpic/sdf-xarray

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.3%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

An xarray backend for reading SDF files from EPOCH

Basic Info
Statistics
  • Stars: 8
  • Watchers: 4
  • Forks: 2
  • Open Issues: 4
  • Releases: 11
Created over 1 year ago · Last pushed 6 months ago
Metadata Files
Readme Contributing Citation

README.md

sdf-xarray

Dynamic TOML Badge Available on PyPI DOI Build/Publish Tests Read the Docs Formatted with black

sdf-xarray provides a backend for xarray to read SDF files as created by EPOCH using the SDF-C library. Part of BEAM (Broad EPOCH Analysis Modules).

Installation

Install from PyPI with:

bash pip install sdf-xarray

[!NOTE] For use within jupyter notebooks, run this additional command after installation:

bash pip install "sdf-xarray[jupyter]"

or from a local checkout:

bash git clone https://github.com/epochpic/sdf-xarray.git cd sdf-xarray pip install .

We recommend switching to uv to manage packages.

Usage

Single file loading

```python import xarray as xr

df = xr.open_dataset("0010.sdf")

print(df["ElectricFieldEx"])

Size: 128B

[16 values with dtype=float64]

Coordinates:

* Xxpxdeltafelectronbeam (Xxpxdeltafelectronbeam) float64 128B 1...

Attributes:

units: V/m

full_name: "Electric Field/Ex"

```

Multi-file loading

To open a whole simulation at once, pass preprocess=sdf_xarray.SDFPreprocess() to xarray.open_mfdataset:

```python import xarray as xr from sdf_xarray import SDFPreprocess

with xr.open_mfdataset("*.sdf", preprocess=SDFPreprocess()) as ds: print(ds)

Dimensions:

time: 301, XGridmid: 128, ...

Coordinates: (9) ...

Data variables: (18) ...

Indexes: (9) ...

Attributes: (22) ...

```

SDFPreprocess checks that all the files are from the same simulation, as ensures there's a time dimension so the files are correctly concatenated.

If your simulation has multiple output blocks so that not all variables are output at every time step, then those variables will have NaN values at the corresponding time points.

For more in depth documentation please visit: https://sdf-xarray.readthedocs.io/

Citing

If sdf-xarray contributes to a project that leads to publication, please acknowledge this by citing sdf-xarray. This can be done by clicking the "cite this repository" button located near the top right of this page.

Contributing

We welcome contributions to the BEAM ecosystem! Whether it's reporting issues, suggesting features, or submitting pull requests, your input helps improve these tools for the community.

How to Contribute

There are many ways to get involved: - Report bugs: Found something not working as expected? Open an issue with as much detail as possible. - Request a feature: Got an idea for a new feature or enhancement? Open a feature request on GitHub Issues! - Improve the documentation: We aim to keep our docs clear and helpful—if something's missing or unclear, feel free to suggest edits. - Submit code changes: Bug fixes, refactoring, or new features are welcome.

All code is automatically linted, formatted, and tested via GitHub Actions.

To run checks locally before opening a pull request, see CONTRIBUTING.md or readthedocs documentation

Broad EPOCH Analysis Modules (BEAM)

BEAM logo

BEAM is a collection of independent yet complementary open-source tools for analysing EPOCH simulations, designed to be modular so researchers can adopt only the components they require without being constrained by a rigid framework. In line with the FAIR principles — Findable, Accessible, Interoperable, and Reusable — each package is openly published with clear documentation and versioning (Findable), distributed via public repositories (Accessible), designed to follow common standards for data structures and interfaces (Interoperable), and includes licensing and metadata to support long-term use and adaptation (Reusable). The packages are as follows:

  • sdf-xarray: Reading and processing SDF files and converting them to xarray.
  • epydeck: Input deck reader and writer.
  • epyscan: Create campaigns over a given parameter space using various sampling methods.

PlasmaFAIR

PlasmaFAIR logo

Originally developed by PlasmaFAIR, EPSRC Grant EP/V051822/1

Owner

  • Name: epochpic
  • Login: epochpic
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
title: 'sdf-xarray: Read EPOCH SDF files in xarray'
message: 'If you use this software, please cite it using the metadata from this file.'
type: software
repository-code: 'https://github.com/epochpic/sdf-xarray'
authors:
  - family-names: Hill
    given-names: Peter
    orcid: 'https://orcid.org/0000-0003-3092-1858'
    affiliation: University of York
  - family-names: Adams
    given-names: Joel L.
    orcid: 'https://orcid.org/0009-0005-4889-5231'
    affiliation: University of York
  - family-names: Doherty
    given-names: Shaun
    orcid: 'https://orcid.org/0009-0005-0693-030X'
    affiliation: University of York
doi: 10.5281/zenodo.15351323
date-released: '2024-07-25'

GitHub Events

Total
  • Create event: 17
  • Issues event: 7
  • Release event: 6
  • Delete event: 12
  • Issue comment event: 18
  • Member event: 2
  • Push event: 33
  • Pull request review comment event: 29
  • Pull request event: 27
  • Pull request review event: 31
  • Fork event: 1
Last Year
  • Create event: 17
  • Issues event: 7
  • Release event: 6
  • Delete event: 12
  • Issue comment event: 18
  • Member event: 2
  • Push event: 33
  • Pull request review comment event: 29
  • Pull request event: 27
  • Pull request review event: 31
  • Fork event: 1

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 526 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 10
  • Total maintainers: 2
pypi.org: sdf-xarray

Provides a backend for xarray to read SDF files as created by the EPOCH plasma PIC code.

  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 526 Last month
Rankings
Dependent packages count: 10.1%
Average: 33.6%
Dependent repos count: 57.0%
Maintainers (2)
Last synced: 6 months ago

Dependencies

.github/workflows/build_publish.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/upload-artifact v4 composite
  • astral-sh/setup-uv v3 composite
  • pypa/cibuildwheel v2.21.3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/black.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • stefanzweifel/git-auto-commit-action v4 composite
.github/workflows/lint.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/tests.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
pyproject.toml pypi
  • numpy >=2.0.0
  • xarray >=2024.1.0
uv.lock pypi
  • accessible-pygments 0.0.5
  • alabaster 1.0.0
  • babel 2.16.0
  • bashlex 0.18
  • beautifulsoup4 4.12.3
  • bokeh 3.6.0
  • bracex 2.5.post1
  • certifi 2024.8.30
  • charset-normalizer 3.4.0
  • cibuildwheel 2.21.3
  • click 8.1.7
  • cloudpickle 3.1.0
  • colorama 0.4.6
  • contourpy 1.3.0
  • cython 3.0.11
  • dask 2024.10.0
  • dask-expr 1.1.16
  • distributed 2024.10.0
  • docutils 0.21.2
  • exceptiongroup 1.2.2
  • filelock 3.16.1
  • fsspec 2024.10.0
  • idna 3.10
  • imagesize 1.4.1
  • importlib-metadata 8.5.0
  • iniconfig 2.0.0
  • jinja2 3.1.4
  • locket 1.0.0
  • lz4 4.3.3
  • markupsafe 3.0.2
  • msgpack 1.1.0
  • numpy 2.1.2
  • packaging 24.1
  • pandas 2.2.3
  • partd 1.4.2
  • pillow 11.0.0
  • platformdirs 4.3.6
  • pluggy 1.5.0
  • psutil 6.1.0
  • pyarrow 18.0.0
  • pydata-sphinx-theme 0.16.0
  • pygments 2.18.0
  • pytest 8.3.3
  • python-dateutil 2.9.0.post0
  • pytz 2024.2
  • pyyaml 6.0.2
  • requests 2.32.3
  • ruff 0.7.1
  • sdf-xarray 0.1.dev89+g9951660.d20241028
  • six 1.16.0
  • snowballstemmer 2.2.0
  • sortedcontainers 2.4.0
  • soupsieve 2.6
  • sphinx 8.1.3
  • sphinx-argparse-cli 1.18.2
  • sphinx-autodoc-typehints 2.5.0
  • sphinx-book-theme 1.1.3
  • sphinx-inline-tabs 2023.4.21
  • sphinxcontrib-applehelp 2.0.0
  • sphinxcontrib-devhelp 2.0.0
  • sphinxcontrib-htmlhelp 2.1.0
  • sphinxcontrib-jsmath 1.0.1
  • sphinxcontrib-qthelp 2.0.0
  • sphinxcontrib-serializinghtml 2.0.0
  • tblib 3.0.0
  • tomli 2.0.2
  • toolz 1.0.0
  • tornado 6.4.1
  • typing-extensions 4.12.2
  • tzdata 2024.2
  • urllib3 2.2.3
  • uv 0.4.27
  • xarray 2024.10.0
  • xyzservices 2024.9.0
  • zict 3.0.0
  • zipp 3.20.2