Closed BaptisteVandecrux closed 3 years ago
At first glance, why is the header written to disk, when NEAD standard is that the header is in the file? If you're creating a function to generate a header from existing data in memory, I think the header should remain in memory (as a string or some easy-to-generate data structure like a dictionary). Then the writer should take that variable, as opposed to a file on disk.
If you have to use a file on disk for some reason, it should be cleaned up afterward. It doesn't look like the INI file is removed.
I did that because when working on the nead.write
function we agreed that:
Overall I think this is the right way to handle it - make the user define a header and then apply it. It makes the code much simpler.
But if I am simply adding few columns (like in the example) it is tedious to prepare manually the ini file and make sure it has the right number of fields and fields attributes.
The ini file was saved on disk to allow the user to make a first draft using the nead.write_header
and potentially to add info manually before writing files with nead.write
. When producing a new NEAD file, offering the possibility to write the header from the xarray metadata but alternatively to use an existing ini file makes sure that every cases are possible. Maybe it should be integrated to nead.write
or be renamed as nead.header_drafter
.
Simple header writer.
Test:
should produce 'processed_header.ini':
and sample_processed.csv: