Renamed to_yaml() as serialize_metadata() and introduce input parameter output_format, which allows yaml or json.

This commit is contained in:
2024-09-26 16:23:09 +02:00
parent 85b0e5ab74
commit 96dad0bfb1
2 changed files with 59 additions and 23 deletions

View File

@ -178,7 +178,7 @@ def read_txt_files_as_dict(filename: str, instruments_dir: str = None, work_with
#if numerical_variables:
dataset = {}
dataset['name'] = 'data_table'#_numerical_variables'
dataset['data'] = utils.dataframe_to_np_structured_array(df) #df_numerical_attrs.to_numpy()
dataset['data'] = utils.convert_dataframe_to_np_structured_array(df) #df_numerical_attrs.to_numpy()
dataset['shape'] = dataset['data'].shape
dataset['dtype'] = type(dataset['data'])
#dataset['data_units'] = file_obj['wave']['data_units']
@ -191,7 +191,7 @@ def read_txt_files_as_dict(filename: str, instruments_dir: str = None, work_with
for column_name in df.columns:
column_attr_dict = description_dict['table_header'].get(column_name,
{'note':'there was no description available. Review instrument files.'})
dataset['attributes'].update({column_name: utils.parse_attribute(column_attr_dict)})
dataset['attributes'].update({column_name: utils.convert_attrdict_to_np_structured_array(column_attr_dict)})
#try:
# dataset['attributes'] = description_dict['table_header'].copy()