def _set_attributes(segy, rootgrp):
    """Copy the file headers (binary and text) to the NetCDF file."""
    rootgrp.bin = str(segy.bin)
    rootgrp.text = segy.text[0].decode(errors='replace')
    if segy.ext_headers:
        rootgrp.ext_headers = segy.text[1].decode(errors='replace')
