GEMScienceTools / gmpe-smtk

Python and OpenQuake-based Toolkit for Analysis of Strong Motions and Interpretation of GMPEs
GNU Affero General Public License v3.0
43 stars 33 forks source link

Unknown bug while running tests #124

Closed rizac closed 2 years ago

rizac commented 2 years ago

​(sorry for the quick and dirty copy-paste from the terminal)

I am trying to polish smtk from unused code, and also in relation to the recent flatfile upload in eGSIM and the adoption of pandas.

While trying to run tests, I get this error in trellis plots (a part of code I did not touch at all) and it seems to be due to some OpenQuake bug, probably due to the last update (single context? whatever). The traceback is below. Please note that:

  1. I am using the last commit in OpenQuake, which is forward their last release (I will check now if the problem persists in their last release)

  2. I am in the middle of a Pull Request so @g-weatherill if there is something to change smtk-side let me know, I will do it

Traceback:

Traceback (most recent call last):
  File "/Users/rizac/work/gfz/projects/sources/python/gmpe-smtk-rizac/tests/trellis/trellis_test.py", line 225, in test_magnitude_distance_spectra_trellis
    results = json.loads(trl.to_json())
  File "/Users/rizac/work/gfz/projects/sources/python/gmpe-smtk-rizac/smtk/trellis/trellis_plots.py", line 1392, in to_json
    return json.dumps(self.to_dict())
  File "/Users/rizac/work/gfz/projects/sources/python/gmpe-smtk-rizac/smtk/trellis/trellis_plots.py", line 1353, in to_dict
    gmvs = self.get_ground_motion_values()
  File "/Users/rizac/work/gfz/projects/sources/python/gmpe-smtk-rizac/smtk/trellis/trellis_plots.py", line 1269, in get_ground_motion_values
    means, _ = gmpe.get_mean_and_stddevs(
  File "/Users/rizac/work/gfz/projects/sources/python/oq-engine/openquake/hazardlib/gsim/base.py", line 373, in get_mean_and_stddevs
    ctx = cmaker.recarray([ctx])
  File "/Users/rizac/work/gfz/projects/sources/python/oq-engine/openquake/hazardlib/contexts.py", line 278, in recarray
    getattr(ra, par)[slc] = getattr(ctx, par)
AttributeError: 'RuptureContext' object has no attribute 'occurrence_rate'
g-weatherill commented 2 years ago

This looks like an incompatibility with the recent changes to the GSIM library of OpenQuake. @micheles do you have any suggestions?