def copy_and_sort_node(hdf_temp, hdf_data, table_name='groundparticles',
    progress=False):
    """Sort the data in the tables by the x column

    This speeds up queries to select data based on the x column.

    """
    target_root = hdf_data.get_node('/')
    source_table = hdf_temp.get_node('/', table_name)
    if progress:
        print('Creating the sorted HDF5 file.')
    source_table.copy(newparent=target_root, sortby='x', propindexes=True)
    hdf_temp.copy_node_attrs('/', target_root)
