Skip to content

Commit

Permalink
Add README, LICENCE, dynamic version
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Jul 29, 2024
1 parent 0005e00 commit 883f70a
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,6 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf

# Generated version file
src/sdf_xarray/_version.py
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.15...3.27)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C)

project(${SKBUILD_PROJECT_NAME}
LANGUAGES C
VERSION ${SKBUILD_PROJECT_VERSION}
)

add_subdirectory(SDF/C)

Expand Down
28 changes: 28 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Copyright 2024, Peter Hill

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# sdf-xarray

`sdf-xarray` provides a backend for [xarray](https://xarray.dev) to
read SDF files as created by the [EPOCH](https://epochpic.github.io)
plasma PIC code.

## Installation

Until this is on PyPI, please install directly from this repo:

```
pip install git+https://github.com/PlasmaFAIR/sdf-xarray.git@main
```

or from a local checkout:

```
git clone https://github.com/PlasmaFAIR/sdf-xarray.git
cd sdf-xarray
pip install .
```

## Usage

`sdf-xarray` is a backend for xarray, and so is usable directly from
xarray:

```python
import xarray as xr

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

print(df["Electric Field/Ex"])

# <xarray.DataArray 'Electric Field/Ex' (X_x_px_deltaf/electron_beam: 16)> Size: 128B
# [16 values with dtype=float64]
# Coordinates:
# * X_x_px_deltaf/electron_beam (X_x_px_deltaf/electron_beam) float64 128B 1...
# Attributes:
# units: V/m
```
17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
[build-system]
requires = [
"scikit-build-core",
"scikit-build-core>=0.3",
"setuptools_scm",
"numpy>=2.0.0",
]
build-backend = "scikit_build_core.build"

[project]
name = "sdf-xarray"
version = "0.0.1"
dynamic = ["version"]
license = {file = "LICENCE"}
readme = "README.md"
authors = [
{name = "Peter Hill", email = "[email protected]"}
]
requires-python = ">=3.9"
dependencies = [
"numpy>=2.0.0",
Expand All @@ -29,3 +35,10 @@ lint = ["ruff"]

[project.entry-points."xarray.backends"]
sdf_engine = "sdf_xarray:SDFEntrypoint"

[tool.scikit-build]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.include = ["src/sdf_xarray/_version.py"]

[tool.setuptools_scm]
write_to = "src/sdf_xarray/_version.py"

0 comments on commit 883f70a

Please sign in to comment.