ogalanis / hypoDDpy

A collection of scripts to steer HypoDD by Felix Waldhauser.
85 stars 47 forks source link

AttributeError: 'ResourceIdentifier' object has no attribute 'getReferredObject' #12

Open langlami opened 4 years ago

langlami commented 4 years ago

Dear Lion, I am trying to perform some hypoDD relocation using your python code. After some small work to make it "run" under python3.7, I am facing an issue after hypodd reloc (during the writing sequence of the events I assume). I get this error : File "/Users/langlami/03-LOGICIELS/scripts-python/hypoDDpy/hypoddpy/hypodd_relocator.py", line 1315, in _create_output_event_file event = res_id.getReferredObject() AttributeError: 'ResourceIdentifier' object has no attribute 'getReferredObject'

But my knowledge and my skill in obspy/python does not helps me in solving this issue. Maybe the ResourceIdentifier method as changed in the latest version of obspy and I need to create an object somewhere linked to the event (res_id = ResourceIdentifier(event_id) maybe is not suffisient). But I do not really know how to fix that issue.

If you have still interest in the HyppdddPy software maybe you can help me.

Best Regards Mickael.

krischer commented 4 years ago

Hi Mickael,

the method has been renamed to snake-case, e.g. .get_referred_object(): https://github.com/obspy/obspy/blob/88687a146a7c3ca8f35c608db2243cf5fed6813c/obspy/core/event/resourceid.py#L309

Hope it helps!

Lion

langlami commented 4 years ago
Hi Lion,

  Thanks for this help, it solves the problem.

  I also have an issue when reading the xml input files :
  /Users/langlami/opt/anaconda3/envs/Python3.7/lib/python3.7/site-packages/obspy/io/xseed/fields.py:377:
    UserWarning: Date is required.
      warnings.warn('Date is required.', UserWarning)

/Users/langlami/opt/anaconda3/envs/Python3.7/lib/python3.7/site-packages/obspy/io/xseed/parser.py:2316: UserWarning: There exist unparsed elements!   warnings.warn("There exist unparsed elements!") It partial works but I get this warning message, I also assume that it is linked to a deprecated method, but don't really know how to fix it.

  If you have any idea...

  Regards

          Mickaël LANGLAIS
            Responsable Service
              Instrumentations Géophysiques
            Institut des Sciences de
              la Terre
            Université Grenoble Alpes
              - ISTerre - CS40700 - 38058 Grenoble Cedex 9
            ✆ +33 4 76 63 51 13 
            ✆[MOB] +33 6 14 83 16 90 
             mickael.langlais@univ-grenoble-alpes.fr
             Site Internet : ISTerre

On 14/04/2020 11:23, Lion Krischer
  wrote:

  Hi Mickael,
  the method has been renamed to snake-case, e.g. .get_referred_object():
    https://github.com/obspy/obspy/blob/88687a146a7c3ca8f35c608db2243cf5fed6813c/obspy/core/event/resourceid.py#L309
  Hope it helps!
  Lion
  —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub, or unsubscribe.
  [

{ "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/krischer/hypoDDpy/issues/12#issuecomment-613328327", "url": "https://github.com/krischer/hypoDDpy/issues/12#issuecomment-613328327", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

krischer commented 4 years ago

Best have a look at your XSEED files and try to figure out if there are elements it cannot parse.