openPMD / openPMD-api

:floppy_disk: C++ & Python API for Scientific I/O
https://openpmd-api.readthedocs.io
GNU Lesser General Public License v3.0
138 stars 51 forks source link

Debugging a New File #1525

Open ax3l opened 1 year ago

ax3l commented 1 year ago

Debugging a new file output with @tsung1029 right now.

passes the validator but not yet openpmd-ls / the reference API reader. It seems it tries to open the group w/o the 0-prefixes.

ez_00000005.h5.tar.gz

We are continuing tomorrow with a new file :)

ax3l commented 1 year ago

ez_00000005.zip

ax3l commented 1 year ago

ez_00000005.zip

ax3l commented 1 year ago

The last file can be opened and read :tada:

In openPMD-viewer, this has still some issues with the GUI cc @RemiLehe due to not-recognized axisLabels.

               ATTRIBUTE "axisLabels" {
                  DATATYPE  H5T_STRING {
                     STRSIZE 100;
                     STRPAD H5T_STR_SPACEPAD;
                     CSET H5T_CSET_ASCII;
                     CTYPE H5T_C_S1;
                  }
                  DATASPACE  SIMPLE { ( 3 ) / ( 3 ) }
                  DATA {
                  (0): "r                                                                                                   ",
                  (1): "\xi                                                                                                 ",
                  (2): "                                                                                                    "
                  }
               }

leading to a ts.slider() exception of

StopIteration                             Traceback (most recent call last)
File ~/micromamba/envs/warpx-openmp-dev/lib/python3.11/site-packages/ipywidgets/widgets/widget_selection.py:133, in findvalue(array, value, compare)
    132 try:
--> 133     return next(x for x in array if compare(x, value))
    134 except StopIteration:

StopIteration: 

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
File ~/micromamba/envs/warpx-openmp-dev/lib/python3.11/site-packages/ipywidgets/widgets/widget_selection.py:242, in _Selection._validate_value(self, proposal)
    241 try:
--> 242     return findvalue(self._options_values, value, self.equals) if value is not None else None
    243 except ValueError:

File ~/micromamba/envs/warpx-openmp-dev/lib/python3.11/site-packages/ipywidgets/widgets/widget_selection.py:135, in findvalue(array, value, compare)
    134 except StopIteration:
--> 135     raise ValueError('%r not in array'%value)

ValueError: 'y' not in array
ax3l commented 1 year ago
import h5py

f = h5py.File("ez_00000005.h5")

f["/data/5/fields/ez"]
# <HDF5 dataset "ez": shape (512, 512), type "<f8">

list(f["/data/5/fields/ez"].attrs)
['LONG_NAME',
 'UNITS',
 'axisLabels',
 'dataOrder',
 'geometry',
 'geometryParameters',
 'gridGlobalOffset',
 'gridSpacing',
 'gridUnitSI',
 'position',
 'time',
 'timeOffset',
 'unitDimension',
 'unitSI']

f["/data/5/fields/ez"].attrs["geometry"]
# b'cartesian'

# this will be fixed next to have two arguments only
f["/data/5/fields/ez"].attrs["axisLabels"]
# array([b'r', b'\\xi', b''], dtype='|S100')
ax3l commented 1 year ago

New file: readable, openPMD-viewer plotting in time series not yet showing a plot, but recognizing the field already: ez_00000005.zip