camilomarino / GeLaP-NILMTK-Converter

1 stars 0 forks source link

save_yaml_to_datastore function not working #1

Closed BricePetit closed 1 year ago

BricePetit commented 1 year ago

Hello Camilo !

I'm trying to include your code in the nilmtk library but it seems that "save_yaml_to_datastore(metadata_path, store)" does not work. If I use "convert_yaml_to_hdf5(metadata_path, output_filename)", it works. Do you have an explanation?

When I tried to use "save_yaml_to_datastore", the error is :

Traceback (most recent call last): File "/nilmtk/nilmtk/dataset_converters/gelap/convert_gelap.py", line 156, in convert_gelap('/Datasets/gelap', '/Datasets/gelap/gelap.h5', False) File "/nilmtk/nilmtk/dataset_converters/gelap/convert_gelap.py", line 54, in convert_gelap save_yaml_to_datastore(metadata_path, store) File "/nilm_metadata/nilm_metadata/convert_yaml_to_hdf5.py", line 96, in save_yaml_to_datastore store.save_metadata('/'+building, building_metadata) File "/nilmtk/nilmtk/docinherit.py", line 53, in f return self.mthd(obj, *args, **kwargs) File "/nilmtk/nilmtk/datastore/hdfdatastore.py", line 195, in save_metadata node._v_attrs.metadata = metadata AttributeError: 'NoneType' object has no attribute '_v_attrs'

camilomarino commented 1 year ago

Hello!

Sorry for the late reply, I'll promise to reply quickly the next time.

I think the problem is the metadata_path. I noticed that when you tried to include the code in nilmtk, you should modify metadata_paththat (see the path of the metada in redd converter: https://github.com/nilmtk/nilmtk/blob/b2c514479cef478cab872cb635056da08d5352a1/nilmtk/dataset_converters/redd/convert_redd.py#L52 ). So metadata_path should be something like this:

join(get_module_directory(), 'dataset_converters', 'gelap', 'metadata')

Please, tell me if that fixes the error.

It's a great idea to add this converter to the official NILMTK repository!

BricePetit commented 1 year ago

Hey!

You're right, it's working!