# Buggy code
def _parse_parameter_file(self):
    """Read in metadata describing the overall data on-disk."""
    f = self._handle
    bp = self.base_path
    mp = self.meshes_path

    self.unique_identifier = 0
    self.parameters = 0
    self.periodicity = np.zeros(3, dtype=np.bool)
    self.refine_by = 1
    self.cosmological_simulation = 0

    try:
        shapes = {}
        left_edges = {}
        right_edges = {}
        for mesh in f[bp + mp].keys():
            if type(f[bp + mp + mesh]) is h5.Group:
                shape = np.asarray(
                    f[bp + mp + mesh + "/" + list(f[bp + mp + mesh].keys())[0]].shape
                )
            else:
                shapes[mesh] = np.asarray(f[bp + mp + mesh].shape)
            spacing = np.asarray(f[bp + mp + mesh].attrs["gridSpacing"])
            offset = np.asarray(f[bp + mp + mesh].attrs["gridGlobalOffset"])
            unit_si = np.asarray(f[bp + mp + mesh].attrs["gridUnitSI"])
            le = offset * unit_si
            re = le + shape * unit_si * spacing
            shapes[mesh] = shape
            left_edges[mesh] = le
            right_edges[mesh] = re
        lowest_dim = np.min([len(i) for i in shapes.values()])
        shapes = np.asarray([i[:lowest_dim] for i in shapes.values()])
        left_edges = np.asarray([i[:lowest_dim] for i in left_edges.values()])
        right_edges = np.asarray([i[:lowest_dim] for i in right_edges.values()])
        fs = []
        dle = []
        dre = []
        for i in np.arange(lowest_dim):
            fs.append(np.max(shapes.transpose()[i]))
            dle.append(np.min(left_edges.transpose()[i]))
            dre.append(np.min(right_edges.transpose()[i]))
        self.dimensionality = len(fs)
        self.domain_dimensions = np.append(fs, np.ones(3 - self.dimensionality))
        self.domain_left_edge = np.append(dle, np.zeros(3 - len(dle)))
        self.domain_right_edge = np.append(dre, np.ones(3 - len(dre)))
    except ValueError:
        mylog.warning(
            "open_pmd - It seems your data does not contain meshes. Assuming domain extent of 1m^3!"
        )
        self.dimensionality = 3
        self.domain_dimensions = np.ones(3, dtype=np.float64)
        self.domain_left_edge = np.zeros(3, dtype=np.float64)
        self.domain_right_edge = np.ones(3, dtype=np.float64)

    self.current_time = f[bp].attrs["time"] * f[bp].attrs["timeUnitSI"]


# Traceback (KeyError)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-6-606762cc9ee1> in <module>()
----> 1 yt.load('./example-ptcl/hdf5/data00000400.h5')

~/miniconda3/lib/python3.6/site-packages/yt/convenience.py in load(*args, **kwargs)
84     candidates = find_lowest_subclasses(candidates)
85     if len(candidates) == 1:
---> 86         return candidates[0](*args, **kwargs)
87     if len(candidates) == 0:
88         if ytcfg.get("yt", "enzo_db") != '' \

~/miniconda3/lib/python3.6/site-packages/yt/frontends/open_pmd/data_structures.py in __init__(self, filename, dataset_type, storage_filename, units_override, unit_system, **kwargs)
385         self.storage_filename = storage_filename
386         self.fluid_types += ("openPMD",)
--> 387         particles = tuple(str(c) for c in self._handle[self.base_path + self.particles_path].keys())
388         if len(particles) > 1:
389             # Only use on-disk particle names if there is more than one species

~/miniconda3/lib/python3.6/site-packages/yt/utilities/file_handler.py in __getitem__(self, key)
43
44     def __getitem__(self, key):
---> 45         return self.handle[key]
46
47     def __contains__(self, item):

h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/h5py_1496887972496/work/h5py/_objects.c:2846)()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/h5py_1496887972496/work/h5py/_objects.c:2804)()

~/miniconda3/lib/python3.6/site-packages/h5py/_hl/group.py in __getitem__(self, name)
167                 raise ValueError("Invalid HDF5 object reference")
168         else:
--> 169             oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
170
171         otype = h5i.get_type(oid)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/h5py_1496887972496/work/h5py/_objects.c:2846)()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/h5py_1496887972496/work/h5py/_objects.c:2804)()

h5py/h5o.pyx in h5py.h5o.open (/Users/ilan/minonda/conda-bld/h5py_1496887972496/work/h5py/h5o.c:3740)()

KeyError: "Unable to open object (Object 'particles' doesn't exist)"

# Fixed code
def _parse_parameter_file(self):
    """Read in metadata describing the overall data on-disk."""
    f = self._handle
    bp = self.base_path
    mp = self.meshes_path

    self.unique_identifier = 0
    self.parameters = 0
    self.periodicity = np.zeros(3, dtype=np.bool)
    self.refine_by = 1
    self.cosmological_simulation = 0

    try:
        shapes = {}
        left_edges = {}
        right_edges = {}
        meshes = f[bp + mp]
        for mname in meshes.keys():
            mesh = meshes[mname]
            if type(mesh) is h5.Group:
                shape = np.asarray(mesh[list(mesh.keys())[0]].shape)
            else:
                shape = np.asarray(mesh.shape)
            spacing = np.asarray(mesh.attrs["gridSpacing"])
            offset = np.asarray(mesh.attrs["gridGlobalOffset"])
            unit_si = np.asarray(mesh.attrs["gridUnitSI"])
            le = offset * unit_si
            re = le + shape * unit_si * spacing
            shapes[mname] = shape
            left_edges[mname] = le
            right_edges[mname] = re
        lowest_dim = np.min([len(i) for i in shapes.values()])
        shapes = np.asarray([i[:lowest_dim] for i in shapes.values()])
        left_edges = np.asarray([i[:lowest_dim] for i in left_edges.values()])
        right_edges = np.asarray([i[:lowest_dim] for i in right_edges.values()])
        fs = []
        dle = []
        dre = []
        for i in np.arange(lowest_dim):
            fs.append(np.max(shapes.transpose()[i]))
            dle.append(np.min(left_edges.transpose()[i]))
            dre.append(np.min(right_edges.transpose()[i]))
        self.dimensionality = len(fs)
        self.domain_dimensions = np.append(fs, np.ones(3 - self.dimensionality))
        self.domain_left_edge = np.append(dle, np.zeros(3 - len(dle)))
        self.domain_right_edge = np.append(dre, np.ones(3 - len(dre)))
    except KeyError:
        if self.standard_version <= StrictVersion("1.1.0"):
            self.dimensionality = 3
            self.domain_dimensions = np.ones(3, dtype=np.float64)
            self.domain_left_edge = np.zeros(3, dtype=np.float64)
            self.domain_right_edge = np.ones(3, dtype=np.float64)
        else:
            raise

    self.current_time = f[bp].attrs["time"] * f[bp].attrs["timeUnitSI"]