def write(self, group, quantities='all', copy=True, absolute_paths=False, compression=True, wall_dtype=float, physics_dtype=float):
        '''
        Write out the AMR grid

        Parameters
        ----------
        group : h5py.Group
            The HDF5 group to write the grid to
        quantities : 'all' or list
            Which physical quantities to write out. Use 'all' to write out all
            quantities or a list of strings to write only specific quantities.
        copy : bool
            Whether to copy external links, or leave them as links.
        absolute_paths : bool
            If copy is False, then this indicates whether to use absolute or
            relative paths for links.
        compression : bool
            Whether to compress the arrays in the HDF5 file
        wall_dtype : type
            The datatype to use to write the wall positions
        physics_dtype : type
            The datatype to use to write the physical quantities
        '''

        # Create HDF5 groups if needed

        if 'Geometry' not in group:
            g_geometry = group.create_group('Geometry')
        else:
            g_geometry = group['Geometry']

        if 'Quantities' not in group:
            g_quantities = group.create_group('Quantities')
        else:
            g_quantities = group['Quantities']

        g_geometry.attrs['grid_type'] = np.string_('amr'.encode('utf-8'))
        g_geometry.attrs['nlevels'] = len(self.levels)

        # Self-consistently check geometry and physical quantities
        self._check_array_dimensions()

        # Write out physical quantities

        # Loop over levels
        for ilevel, level in enumerate(self.levels):

            # Read in level
            level_path = 'level_%05i' % (ilevel + 1)
            g_level = g_geometry.create_group(level_path)
            q_level = g_quantities.create_group(level_path)
            g_level.attrs['ngrids'] = len(level.grids)

            # Loop over grids
            for igrid, grid in enumerate(level.grids):

                # Read in grid
                grid_path = 'grid_%05i' % (igrid + 1)
                g_grid = g_level.create_group(grid_path)
                q_grid = q_level.create_group(grid_path)

                # Write real-world grid boundaries
                g_grid.attrs['xmin'] = grid.xmin
                g_grid.attrs['xmax'] = grid.xmax
                g_grid.attrs['ymin'] = grid.ymin
                g_grid.attrs['ymax'] = grid.ymax
                g_grid.attrs['zmin'] = grid.zmin
                g_grid.attrs['zmax'] = grid.zmax

                # Wrote grid dimensions
                g_grid.attrs['n1'] = grid.nx
                g_grid.attrs['n2'] = grid.ny
                g_grid.attrs['n3'] = grid.nz

                # Write out physical quantities
                for quantity in grid.quantities:
                    if quantities == 'all' or quantity in quantities:
                        if isinstance(grid.quantities[quantity], h5py.ExternalLink):
                            link_or_copy(q_grid, quantity, grid.quantities[quantity], copy, absolute_paths=absolute_paths)
                        else:
                            q_grid.create_dataset(quantity, data=grid.quantities[quantity],
                                                  compression=compression,
                                                  dtype=physics_dtype)

        g_geometry.attrs['geometry'] = np.string_(self.get_geometry_id().encode('utf-8'))
dataset/ETHPy150Open hyperion-rt/hyperion/hyperion/grid/amr_grid.py/AMRGrid.write/original