Add the ability to convert from/to awkward array#108
Add the ability to convert from/to awkward array#108AreWeDreaming wants to merge 17 commits intoiterorganization:developfrom
Conversation
- Wrangling works - Unwrangling awkward data needs work
|
I am holding off on running black to keep the diff clean |
| from typing import List, Tuple | ||
|
|
||
| import numpy | ||
| import awkward as ak |
There was a problem hiding this comment.
Can be removed from here and moved to actual usage..
There was a problem hiding this comment.
Moved awkwardization into the wrangler.py
| if hdf5_dim == 0: | ||
| return self.filled_data[path][()].value | ||
| else: | ||
| return ak.Array(self.recursively_convert_to_list(path, tuple(), shape[:hdf5_dim], 0)) |
There was a problem hiding this comment.
Check if awkward is available
try:
import awkward as ak
except ImportError as exc:
raise ImportError(
"awkward-array is required"
"Install it with: pip install imas-python[awkward]"
) from exc
Need to add awkward dependency in pyproject.toml
Handle version propagation more cleanly Co-authored-by: Prasad <prasad.sawantdesai@gmail.com>
Remove preference for specific version Co-authored-by: Prasad <prasad.sawantdesai@gmail.com>
…-Python into awkward_array_support
…is provided in unwrangle
|
Note that if The manually fixes this but is clearly not the desired solution. How can we get |
Could you point out setuptools and setuptools_scm version in your environment when you are using --no-build-isolation flag? |
|
To reproduce you can try these instructions: |
|
Tried locally on SDCC (myenv)$pip install wheel setuptools_scm # ensure you have wheel and setuptools_scm in installed in the environment
(myenv)$ pip list
Package Version Editable project location
-------------- ----------- --------------------------------------
packaging 26.0
pip 23.2.1
setuptools 65.5.0
setuptools-scm 10.0.5
vcs-versioning 1.1.1
wheel 0.46.3
[notice] A new release of pip is available: 23.2.1 -> 26.0.1
[notice] To update, run: pip install --upgrade pip
(myenv) [sawantp1@98dci4-srv-1005 IMAS-Python]$ pip install --no-deps --no-build-isolation -e . Obtaining file:///home/ITER/sawantp1/github/IMAS-Python
Checking if build backend supports build_editable ... done
Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: imas-python
Building editable for imas-python (pyproject.toml) ... done
Created wheel for imas-python: filename=imas_python-2.2.1.dev21-0.editable-py3-none-any.whl size=10092 sha256=fd5c022cc1e89b8ed09e038b348b0333be3f6410a67bca8d3e5668f36ca4c09d │
Stored in directory: /tmp/pip-ephem-wheel-cache-m2239qmz/wheels/a9/0d/81/e451d06713deb1130f483b94d6634714ddca7d73da76c729fb
Successfully built imas-python
Installing collected packages: imas-python
Successfully installed imas-python-2.2.1.dev21
[notice] A new release of pip is available: 23.2.1 -> 26.0.1
[notice] To update, run: pip install --upgrade pip |
The tests (
imas/test/test_wrangle.py) that I have designed are passing now.The
wrangler.pyadds two functions,wrangleandunwrangle.wranglemethod takes the flat representation of the data and wrangles into the nested IDS.unwranglemethod takes a dictionary of ids and uses theIDSTensorizerto flatten out a defined list of entries.