Dear obspy users,
I’m working on some magnitude estimates and I would like do create a subclass inheriting from “magnitude.Magnitude” obspy object. At this point I just want to have the same attributes as the parent class plus some very simple new attributes such as “corner frequency”, “omega_0”…
I just did the following:
class Magnitude_User(_Magnitude):
def init(self,*args, **kwargs):
initialization code
self.fc=kwargs.get(‘fc’)
with warnings.catch_warnings():
warnings.simplefilter(“ignore”)
super().init(*args, **kwargs)
I wanted to get rid of the warning, but I still get the following:
UserWarning: Setting attribute “fc” which is not a default attribute
What would you advise for defining a new attribute for an obspy class without directly modifying the parent class? Is that the best approach? If yes, how can I get rid of the “warnings.warn”?
I thought about using the AttribDict() and the “extra” attribute but I’m not really interested in writing any xml for now and I would prefer a more direct approach.
Thanks for your help,
Christian