sdf-xarray 0.2.4__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/PKG-INFO +1 -1
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/src/sdf_xarray/__init__.py +12 -3
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/src/sdf_xarray/_version.py +2 -2
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/test_basic.py +41 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/.github/workflows/black.yml +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/.github/workflows/build_publish.yml +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/.github/workflows/lint.yml +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/.github/workflows/tests.yml +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/.gitignore +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/.gitmodules +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/.readthedocs.yaml +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/BEAM.png +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/CITATION.cff +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/CMakeLists.txt +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/CONTRIBUTING.md +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/LICENCE +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/PlasmaFAIR.svg +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/README.md +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/.gitignore +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/_templates/custom-class-template.rst +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/_templates/custom-module-template.rst +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/api.rst +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/conf.py +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/contributing.rst +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/getting_started.rst +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/index.rst +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/key_functionality.rst +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/make.bat +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0000.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0001.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0002.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0003.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0004.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0005.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0006.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0007.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0008.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0009.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0010.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0011.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0012.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0013.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0014.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0015.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0016.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0017.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0018.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0019.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0020.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0021.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0022.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0023.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0024.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0025.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0026.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0027.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0028.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0029.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0030.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0031.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0032.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0033.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0034.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0035.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0036.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0037.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0038.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0039.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/0040.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/deck.status +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/epoch1d.dat +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/input.deck +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/normal.visit +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/tutorial_dataset_1d/restart.visit +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/docs/unit_conversion.rst +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/pyproject.toml +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/src/sdf_xarray/csdf.pxd +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/src/sdf_xarray/plotting.py +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/src/sdf_xarray/sdf_interface.pyx +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_array_no_grids/0000.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_array_no_grids/0001.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_array_no_grids/README.md +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_array_no_grids/input.deck +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_dist_fn/0000.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_dist_fn/0001.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_dist_fn/0002.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_dist_fn/input.deck +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0000.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0001.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0002.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0003.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0004.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0005.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0006.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0007.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0008.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0009.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/0010.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/README.md +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_1D/input.deck +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_2D_moving_window/0000.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_2D_moving_window/0001.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_2D_moving_window/0002.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_2D_moving_window/0003.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_2D_moving_window/0004.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_files_2D_moving_window/input.deck +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_mismatched_files/0000.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_mismatched_files/0001.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/example_mismatched_files/0002.sdf +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/test_cython.py +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/tests/test_epoch_accessor.py +0 -0
- {sdf_xarray-0.2.4 → sdf_xarray-0.2.5}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: sdf-xarray
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Provides a backend for xarray to read SDF files as created by the EPOCH plasma PIC code.
|
|
5
5
|
Author-Email: Peter Hill <peter.hill@york.ac.uk>, Joel Adams <joel.adams@york.ac.uk>, Shaun Doherty <shaun.doherty@york.ac.uk>
|
|
6
6
|
License: Copyright 2024, Peter Hill, Joel Adams, epochpic team
|
|
@@ -253,9 +253,18 @@ class SDFDataStore(AbstractDataStore):
|
|
|
253
253
|
def load(self): # noqa: PLR0912, PLR0915
|
|
254
254
|
# Drop any requested variables
|
|
255
255
|
if self.drop_variables:
|
|
256
|
+
# Build a mapping from underscored names to real variable names
|
|
257
|
+
name_map = {_rename_with_underscore(var): var for var in self.ds.variables}
|
|
258
|
+
|
|
256
259
|
for variable in self.drop_variables:
|
|
257
|
-
|
|
258
|
-
|
|
260
|
+
key = _rename_with_underscore(variable)
|
|
261
|
+
original_name = name_map.get(key)
|
|
262
|
+
|
|
263
|
+
if original_name is None:
|
|
264
|
+
raise KeyError(
|
|
265
|
+
f"Variable '{variable}' not found (interpreted as '{key}')."
|
|
266
|
+
)
|
|
267
|
+
self.ds.variables.pop(original_name)
|
|
259
268
|
|
|
260
269
|
# These two dicts are global metadata about the run or file
|
|
261
270
|
attrs = {**self.ds.header, **self.ds.run_info}
|
|
@@ -434,7 +443,7 @@ class SDFEntrypoint(BackendEntrypoint):
|
|
|
434
443
|
|
|
435
444
|
description = "Use .sdf files in Xarray"
|
|
436
445
|
|
|
437
|
-
url = "https://epochpic.github.io/documentation/visualising_output/
|
|
446
|
+
url = "https://epochpic.github.io/documentation/visualising_output/python_beam.html"
|
|
438
447
|
|
|
439
448
|
|
|
440
449
|
class SDFPreprocess:
|
|
@@ -185,3 +185,44 @@ def test_3d_distribution_function():
|
|
|
185
185
|
with xr.open_dataset(EXAMPLE_3D_DIST_FN / "0000.sdf") as df:
|
|
186
186
|
distribution_function = "dist_fn_x_px_py_Electron"
|
|
187
187
|
assert df[distribution_function].shape == (16, 20, 20)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def test_drop_variables():
|
|
191
|
+
with xr.open_dataset(
|
|
192
|
+
EXAMPLE_FILES_DIR / "0000.sdf", drop_variables=["Electric_Field_Ex"]
|
|
193
|
+
) as df:
|
|
194
|
+
assert "Electric_Field_Ex" not in df
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def test_drop_variables_multiple():
|
|
198
|
+
with xr.open_dataset(
|
|
199
|
+
EXAMPLE_FILES_DIR / "0000.sdf",
|
|
200
|
+
drop_variables=["Electric_Field_Ex", "Electric_Field_Ey"],
|
|
201
|
+
) as df:
|
|
202
|
+
assert "Electric_Field_Ex" not in df
|
|
203
|
+
assert "Electric_Field_Ey" not in df
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def test_drop_variables_original():
|
|
207
|
+
with xr.open_dataset(
|
|
208
|
+
EXAMPLE_FILES_DIR / "0000.sdf",
|
|
209
|
+
drop_variables=["Electric_Field/Ex", "Electric_Field/Ey"],
|
|
210
|
+
) as df:
|
|
211
|
+
assert "Electric_Field_Ex" not in df
|
|
212
|
+
assert "Electric_Field_Ey" not in df
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def test_drop_variables_mixed():
|
|
216
|
+
with xr.open_dataset(
|
|
217
|
+
EXAMPLE_FILES_DIR / "0000.sdf",
|
|
218
|
+
drop_variables=["Electric_Field/Ex", "Electric_Field_Ey"],
|
|
219
|
+
) as df:
|
|
220
|
+
assert "Electric_Field_Ex" not in df
|
|
221
|
+
assert "Electric_Field_Ey" not in df
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def test_erroring_drop_variables():
|
|
225
|
+
with pytest.raises(KeyError):
|
|
226
|
+
xr.open_dataset(
|
|
227
|
+
EXAMPLE_FILES_DIR / "0000.sdf", drop_variables=["Electric_Field/E"]
|
|
228
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|