kujaku11 / mth5

Exchangeable and archivable format for magnetotelluric time series to better serve the community through FAIR principles.
https://mth5.readthedocs.io/en/latest/index.html
MIT License
16 stars 6 forks source link

mth5 filters not inheriting all properties from mt_metadata filters #32

Closed kkappler closed 3 years ago

kkappler commented 3 years ago

Specifically: The FIR filter in mt_metadata accessed via: experiment.surveys[0].filters has new properties that I am creating via the obspy mapping. In this case the property I am looking for is: decimation_input_sample_rate

However, when I access the filters via, for example: hx = run.get_channel('hx') hx.channel_response_filter.filters_list[3] I do not have the attribute available, I get instead: AttributeError: 'FIRFilter' object has no attribute 'decimation_input_sample_rate'

So we need to add this attribute. However, that is a one-off fix. The issue is more that we need a way for mth5 to get a comprehensive list of attributes from mt_metadata. Otherwise we will forever have this issue whenever adding new attrs (which could happen a few times in the next few months).

Ideally we would make a test in mt_metadata called something like: test_can_make_list_of_filter_attributes(FIRFilter): which generates a list of attrs that we expect to be populated.

The underlying list_maker there would be used in mth5.

Let's discuss.

kkappler commented 3 years ago

ah-hah! I see where the change needs to be made... it is in the _to_object() method of the filter, for example mth5/groups/filter_groups/fir_filter_group.py

Tracked this via mth5/groups/master_station_run_channel.py which has a ChannelDataset() class with a channel_response_filter property which calls f_list.append(filters_group.to_filter_object(name)) where filters_group is an instance of /mth5/groups/filters.py 's FiltersGroup()

It is that .to_filter_object() where we need to add stuff.

However, there seems to be some cross-talk between FIR and coefficient filters going on here, and the classes and functions under filter_groups need some cleanup as there are some errors in cut-and-paste documentation We basically need an interface between mt_metadata filters and filter_groups filters ... Its even possible that the filter_group notion could reside in mt_metadata.

In ancy

kujaku11 commented 3 years ago

Updated and is now in master