AttributeError: 'list' object has no attribute 'rjb' on Trellis Plotting

287 views
Skip to first unread message

Ziya Cekinmez

unread,
Apr 26, 2022, 2:58:57 AM4/26/22
to OpenQuake Users
Hi,

When I try to create distance trellis plots, I get an error called "AttributeError: 'list' object has no attribute 'rjb' ". 

Do you have any suggestion for this error?

Thanks,
Ziya

Distance_Scaling.ipynb

Peter Pažák

unread,
Apr 29, 2022, 3:25:36 AM4/29/22
to OpenQuake Users
Hi, I am not sure which versions of gmpe-smtk and OQ engine you are using, but for me it worked (slightly modified below - cannot attach due to company policies).

# Import the modules
%matplotlib inline
import numpy as np
import smtk.trellis.trellis_plots as trpl

# Set up the configuration
gmpe_list = ["AkkarBommer2010", "AkkarCagnan2010", "AkkarEtAlRjb2014", "BooreAtkinson2008", "ChiouYoungs2008", "ZhaoEtAl2006Asc"]

imts = ["PGA", "SA(0.2)", "SA(1.0)", "SA(2.0)"]

params = {"ztor": 5.0,   # Top of rupture depth
         "hypo_depth": 10.0,   # Hypocentral depth
         "distance_type": "rjb",
         "vs30": 800.0, # Vs30 for all sites
         "vs30measured": True, # Vs30 value is measured
         "z1pt0": 100.0, # Depth (m) to the 1.0 km/s Vs interface
         "dip": 90.0,  # Vertical Fault
         "rake": 0.0 # Strike-slip fault
         }

magnitudes = 6.5
distances = {"repi": np.arange(0.0, 151.0, 1.0)}
distances["rhypo"] = np.sqrt(distances["repi"] ** 2.0 + params["hypo_depth"] ** 2)
distances["rjb"] = distances["repi"]
distances["rrup"] = np.sqrt(distances["rjb"] ** 2.0 + params["ztor"] ** 2)
distances["rx"] = distances["rjb"]

tp=trpl.DistanceIMTTrellis(magnitudes, distances, gmpe_list, imts, params,
                        distance_type="rjb", plot_type="loglog", dpi=400, figure_size=(20,20),
                        filename="distance_imt_trellis_simple.pdf",
                        filetype="pdf")

tp.plot()

Produced both a figure in jupyter and the pdf.

Peter

Dátum: utorok 26. apríla 2022, čas: 8:58:57 UTC+2, odosielateľ: cekinm...@gmail.com

Ziya Cekinmez

unread,
Apr 29, 2022, 5:45:31 AM4/29/22
to OpenQuake Users
Hi Peter,

Thank you for your help. Unfortunately I still get the same error. There might be something wrong with my installation etc. I am using OQ installed with ova file to Virtual Box,  I installed Anaconda and Git and changed OQ to developer version 3.15.0 developer. And I installed gmpe-smtk from the GEM Science Tools Github link directly.

Ziya

Peter Pažák

unread,
May 2, 2022, 12:38:34 AM5/2/22
to OpenQuake Users
I have OQ 3.13, haven't tried 3.15 yet

Peter

Dátum: piatok 29. apríla 2022, čas: 11:45:31 UTC+2, odosielateľ: cekinm...@gmail.com

Hendro Nugroho

unread,
Jul 21, 2022, 2:35:32 AM7/21/22
to OpenQuake Users
I have the same problem. I am running OQ 3.11.5 with python 3.10. I am wondering what version of python you are using.

-Hendro

Peter Pažák

unread,
Jul 21, 2022, 12:55:58 PM7/21/22
to OpenQuake Users
Hi Hendro,

SMTK & Trellis plotting should work with OQ engine 3.11 as 3.11 is a long term support one, for me it did - what error are you getting?
(3.11 uses python 3.6 by default I think, but should also work with 3.10)
Looking at the code of SMTK - it was last updated some 8 months ago and calling get_mean_and_stddevs of a gmpe, so it will most probably not work for OQ v3.13 and later...

Peter

Dátum: štvrtok 21. júla 2022, čas: 8:35:32 UTC+2, odosielateľ: Hendro Nugroho

Hendro Nugroho

unread,
Jul 21, 2022, 9:17:39 PM7/21/22
to OpenQuake Users
Hi Peter,

Thank you for your quick response!
The trpl.DistanceIMTTrellis gave me the error message 'list' object has no attribute 'rjb'
Let me test it with python 3.6 as you suggested. Hopefully, It'll work.
Also it's good to know that get_mean_and_stddevs requires at least OQ v3.13.

Best,
-Hendro
Reply all
Reply to author
Forward
0 new messages