Disaggregation_Plot / oq-tools

409 views
Skip to first unread message

Rolando Rojas Garcia

unread,
Feb 24, 2023, 3:28:34 PM2/24/23
to OpenQuake Users
Hi all, 

I would like to use this type of graphic, so anyone has already used oq-tools (https://github.com/GEMScienceTools/oq-tools/tree/master/output) disaggregation_plot.py and can introduce me, I will be grateful.

On the other hand, is there other platform where I can use my results from OpenQuake and plotting them?

Thanks a lot.

Best regards,

Rolando Rojas.

Peter Pažák

unread,
Mar 2, 2023, 1:29:26 PM3/2/23
to OpenQuake Users
Hi,

as you can see in the repository, it has been updated maybe 10 years ago, so it is quite clear it would require efforts to update it to the current version of OpenQuake.
The calculation produces disaggregation matrices which can be plotted by any software capable of doing 3D plots, even excel can do plots for disaggregation in up to
two parameters, or three if you also use colors...

Peter


Dátum: piatok 24. februára 2023, čas: 21:28:34 UTC+1, odosielateľ: rro...@uni.pe

ariascr...@gmail.com

unread,
Mar 4, 2023, 11:21:20 PM3/4/23
to OpenQuake Users
Hi,

Some years ago I did a python routine to graph the results of a disaggregated analysis. I share it with you if it helps.

Cristian.

GRAF_DESAGREGADO.ipynb

Peter Pažák

unread,
Mar 8, 2023, 8:45:12 AM3/8/23
to OpenQuake Users
Thank you for sharing Cristian,

if anyone would like just something simple using matplotlib only and csv OQ output, the code is quite short actually for example for magnitude-distance of the demo:

import pandas as pd
import numpy as np
from matplotlib import pyplot as plt

data_all = pd.read_csv('Mag_Dist-0_57.csv',comment='#')

data = data_all[data_all['poe']==0.1] #select just one poe

fig = plt.figure(figsize=(8, 3))
ax = fig.add_subplot(111, projection='3d')
ax.bar3d(x=data['mag'], y = data['dist'], z = np.zeros_like(data['dist']), dx=0.8, dy=10, dz=data['rlz1'], shade=True)
plt.show()

Dátum: nedeľa 5. marca 2023, čas: 5:21:20 UTC+1, odosielateľ: ariascr...@gmail.com

Krlo Aguinda

unread,
Mar 13, 2023, 9:43:49 PM3/13/23
to OpenQuake Users
hi,

And how to plot epsilon as colorbar size?

thanks

Rolando Rojas Garcia

unread,
Mar 16, 2023, 6:18:48 PM3/16/23
to OpenQuake Users
Thanks for sharing Cristian. 

So much interesting your python routine. However, I was wondering if you can share output xml from OpenQuake that you got. I guess that in older versions of OpenQuake the outputs was xml files, given that the last version has output as csv files and each type of disaggregation by separate.

Best regards,

Rolando.

Rolando Rojas Garcia

unread,
Mar 16, 2023, 6:36:05 PM3/16/23
to OpenQuake Users
Thanks a lot Peter.

Just as had commented in the last email, nowadays openquake has as outputs at csv files. 

If in case you have a python routine for plotting csv OQ output, specifically, the type of disaggregation for Mag-Dist-Eps (Magnitud-Distance-Epsilon), please share to the group or how we can add the Epsilon variable.

I would like to plot the disaggregation of Mag-Dist-Eps as can be seen in the attach. 

Regards, 

Rolando.

El miércoles, 8 de marzo de 2023 a las 8:45:12 UTC-5, peter...@gmail.com escribió:

Peter Pažák

unread,
Mar 27, 2023, 4:46:09 PM3/27/23
to OpenQuake Users
The slight problem with matplotlib is that 3d plots are not perfect and if you plot multiple 3d bars, sometimes the image does not come out right.
So if you look in some direction (you can turn around in 3d if you run the attached python code) it looks fine like below, but distorted in some other views...
This is known problem in matplotlib, not easy to correct, one would have to go from the back to the front from bottom to top to get always a correct image...

mag_dist_eps_ok.png
Dátum: štvrtok 16. marca 2023, čas: 23:36:05 UTC+1, odosielateľ: rro...@uni.pe
Disaggregation.zip

Catalina Cantone

unread,
Nov 26, 2023, 9:08:41 PM11/26/23
to OpenQuake Users
Hi Peter, thanks for sharing this code. I wanted to take this opportunity to ask you, how to obtain the % contribution instead of the probability for the z-axis of the disaggregation plot. Applied to the code you present.

Thank you very much in advance and I remain attentive.
Reply all
Reply to author
Forward
0 new messages