oq-engine icon indicating copy to clipboard operation
oq-engine copied to clipboard

initial production of cb19 IA and CAV.

Open emabcede30 opened this issue 11 months ago • 17 comments

I have issue with calc of phi for total aleatory stddev. I want to know which is the correct formula for phi.

phi equation in CB14:

\phi = \sqrt{\phi_{\ln(Y_B)}^2 + \phi_{\ln(AF)}^2 + \alpha^2 \phi_{\ln(\text{PGA}_B)}^2 + 2\alpha\rho_{\ln(\text{PGA}),\ln(Y)} \phi_{\ln(Y_B)} \phi_{\ln(\text{PGA}_B)}}

phi equation in CB19 spreadsheet:

\phi = \sqrt{\phi_{\ln(Y)}^2 + \alpha^2 \phi_{\ln(\text{PGA})}^2 + 2\alpha\rho_{\ln(\text{PGA}),\ln(Y)} \phi_{\ln(Y)} \phi_{\ln(\text{PGA})}}

spreadsheet in cb19: https://journals.sagepub.com/doi/suppl/10.1193/090818EQS212M/suppl_file/10_eeri_35_3_suppl_es1_online.xlsx

spreadheet in cb14: https://journals.sagepub.com/doi/suppl/10.1193/100614EQS151M/suppl_file/14_eeri_32_2_suppl1_es1-es1_online.xlsx

Reference:

Bozorgnia, Y., & Campbell, K. W. (2016). Ground motion model for the vertical-to-horizontal (V/H) ratios of PGA, PGV, and response spectra. Earthquake Spectra, 32(2), 951-978.

Campbell, K. W., & Bozorgnia, Y. (2014). NGA-West2 ground motion model for the average horizontal components of PGA, PGV, and 5% damped linear acceleration response spectra. Earthquake Spectra, 30(3), 1087-1115.

Campbell, K. W., & Bozorgnia, Y. (2019). Ground motion models for the horizontal components of Arias intensity (AI) and cumulative absolute velocity (CAV) using the NGA-West2 database. Earthquake Spectra, 35(3), 1289-1310.

emabcede30 avatar Mar 20 '24 06:03 emabcede30

$$ \phi = \sqrt{\phi_{\ln(Y_B)}^2 + \phi_{\ln(AF)}^2 + \alpha^2 \phi_{\ln(\text{PGA}B)}^2 + 2\alpha\rho{\ln(\text{PGA},\ln(Y))} \phi_{\ln(Y_B)} \phi_{\ln(\text{PGA}_B)}} $$

$\phi$ equation in CB14: $$\phi = \sqrt{ \phi_{\ln(Y_{B})}^2 + \phi_{\ln(AF)}^2 + \alpha^{2}\phi_{\ln(PGA_{B})}^2 + 2\alpha\rho_{\ln(PGA),\ln(Y)}\phi_{\ln(Y_{B})}\phi_{\ln(PGA_{B})} }$$

$\phi$ equation in CB19 spreadsheet: $$\phi = \sqrt{ \phi_{\ln(Y)}^2 + \alpha^{2}\phi_{\ln(PGA)}^2 + 2\alpha\rho_{\ln(PGA),\ln(Y)}\phi_{\ln(Y)}\phi_{\ln(PGA)} }$$

ftbernales avatar Mar 20 '24 07:03 ftbernales

Notice that we have strict conventions on the naming of the modules, this is why you get the error

RuntimeError: /home/runner/work/oq-engine/oq-engine/openquake/hazardlib/gsim/campbell_bozorgnia_2019_IA_CAV.py is not lowercase!

You need to change the name of the module to campbell_bozorgnia_2019_ia_cav.py

micheles avatar Mar 26 '24 08:03 micheles

Now you have an error /doc/api-reference/openquake.hazardlib.gsim.rst: campbell_bozorgnia_2019_ia_cav.py is not documented. The solution is to update the file /doc/api-reference/openquake.hazardlib.gsim.rst

micheles avatar Mar 27 '24 14:03 micheles

Hi @emabcede30, @kslytherin has been working on an implementation of this also. It is unfortunate that we've duplicated effort a bit. One difference is that he added the new metrics within the existing CB14 module rather than creating a new one for these metrics, as discussed here.

@mmpagani @micheles Any thoughts on how we should proceed? We can abandon our implementation if the approach in this merge request is fine.

emthompson-usgs avatar May 10 '24 22:05 emthompson-usgs

I have issue with calc of phi for total aleatory stddev. I want to know which is the correct formula for phi.

phi equation in CB14:

phi equation in CB19 spreadsheet:

spreadsheet in cb19: https://journals.sagepub.com/doi/suppl/10.1193/090818EQS212M/suppl_file/10_eeri_35_3_suppl_es1_online.xlsx

spreadheet in cb14: https://journals.sagepub.com/doi/suppl/10.1193/100614EQS151M/suppl_file/14_eeri_32_2_suppl1_es1-es1_online.xlsx

Reference:

Bozorgnia, Y., & Campbell, K. W. (2016). Ground motion model for the vertical-to-horizontal (V/H) ratios of PGA, PGV, and response spectra. Earthquake Spectra, 32(2), 951-978.

Campbell, K. W., & Bozorgnia, Y. (2014). NGA-West2 ground motion model for the average horizontal components of PGA, PGV, and 5% damped linear acceleration response spectra. Earthquake Spectra, 30(3), 1087-1115.

Campbell, K. W., & Bozorgnia, Y. (2019). Ground motion models for the horizontal components of Arias intensity (AI) and cumulative absolute velocity (CAV) using the NGA-West2 database. Earthquake Spectra, 35(3), 1289-1310.

@emabcede30 I have emailed Yousef Bozorgnia on the phi discrepency. He has informed Kenneth Campbell on the issue and I am currently waiting for a response.

kslytherin avatar May 21 '24 16:05 kslytherin

Thank you for this work and sorry for the late comment. As suggested by @emthompson-usgs I would find it more useful for the user to have these intensity measures (IMTs) added to the original model rather than into a separate GMM implementation. The advantage is that in a single hazard analysis, the user can compute hazard for the already-supported IMTs and the new ones you are currently adding. We are keen to help with the refactoring. Maybe you can also leverage from the draft implementation from Eric.

mmpagani avatar May 22 '24 06:05 mmpagani

Hi, @emthompson-usgs. Thanks for the heads up. The reason for this approach in implementation by my colleague @emabcede30 is the difference in the cross-correlation coefficient $\rho_{\ln(PGA),\ln(Y)}$ between CB14 and CB19 (you can verify this by simply comparing the "HOR_Coeffs" sheets in their respective supplementary Excel files). Even though the median estimates stay the same, the inter-event standard deviations $\phi$ are different between CB14 and CB19. In relation to this, we actually thought of including the updated CB19 GSIM for RotD50 PGA & Sa in this PR as well; fortunately, this discussion has been already brought up.

Regardless, thanks @kslytherin for reaching out to the GMM developers directly. I think their response will bring more clarity to our final direction.

I would like to request for further advice, @mmpagani @micheles, given these additional considerations/constraints. Thanks!

ftbernales avatar May 22 '24 09:05 ftbernales

Unfortunately, @kslytherin is out of the office and won't be back for a while. I will point out that his draft changes to the CB14 model are on a branch on his fork of the repo here: https://github.com/kslytherin/oq-engine/blob/new-models/openquake/hazardlib/gsim/campbell_bozorgnia_2014.py

@ftbernales I see what you mean about rho. For the 2019 model, it is a function of magnitude, and in 2014 it is just a constant. If I'm not mistake, the CampbellBozorgnia2019_IA_CAV implementation in this PR inherits from the GMPE class and so it isn't taking advantage of the code that could be re-used. We could have a 2019 class that at least inherits from the 2014 class and only changes the method for computing rho. This seems like a better design to me, but I'm less familiar with the full implications for the hazard calculations so I defer to @mmpagani.

emthompson-usgs avatar May 23 '24 16:05 emthompson-usgs

Dear Francis, Eric and Enrico thanks for your comments (@ftbernales @emthompson-usgs @emabcede30).

I downloaded the implementation of @kslytherin and the one of @emabcede30 and compared the two. Indeed the differences between the implementations (and the current CB14 implementation) are minor apart from a few details.

Some notes below:

  • I prefer the option adopted by @emabcede30 for the initialization of variables used here https://github.com/gem/oq-engine/blob/7e8a0ed69a074823a40237568cfc80c480e298bc/openquake/hazardlib/gsim/campbell_bozorgnia_2019_ia_cav.py#L419
  • The two implementations of the function computing rho are quite similar so you can pick one of the two (https://github.com/gem/oq-engine/blob/7e8a0ed69a074823a40237568cfc80c480e298bc/openquake/hazardlib/gsim/campbell_bozorgnia_2019_ia_cav.py#L419 or https://github.com/kslytherin/oq-engine/blob/new-models/openquake/hazardlib/gsim/campbell_bozorgnia_2014.py#L305)

To complete the implementation, I suggest using the current implementation of CB14 without creating a new class.

  • Update the supported IMTs (with the ones added here https://github.com/gem/oq-engine/blob/7e8a0ed69a074823a40237568cfc80c480e298bc/openquake/hazardlib/gsim/campbell_bozorgnia_2019_ia_cav.py#L392)
  • Add at this point (https://github.com/gem/oq-engine/blob/master/openquake/hazardlib/gsim/campbell_bozorgnia_2014.py#L461) something like this
if imt.string in ['CAV', 'IA']:
   .... compute phi as in CB19
else:
   .... compute phi as before
  • Update coeff tables
  • Use the verification tables and tests for the new IMTs as already prepared by @emabcede30 and @ftbernales

... I hope I got everything with this. I will be glad to examine it further otherwise. Many thanks again. Marco

mmpagani avatar May 29 '24 08:05 mmpagani

@emabcede30 @ftbernales: Would you like to make the changes that @mmpagani requested to your branch, or should we modify the one from @kslytherin?

emthompson-usgs avatar Jun 04 '24 15:06 emthompson-usgs

Hi, @emthompson-usgs! Sorry for the quite late revert. Yes, we're working on it now though taking quite slow due to other workload. I'll also checkout @kslytherin's branch to make sure we didn't miss anything. But if I may ask, is it of interest to you to merge this feature into master ASAP?

ftbernales avatar Jun 06 '24 01:06 ftbernales

One more thing, @mmpagani. In relation to this:

In relation to this, we actually thought of including the updated CB19 GSIM for RotD50 PGA & Sa in this PR as well; fortunately, this discussion has been already brought up.

Do you think we should already address this in this same PR as well? The change in inter-event standard deviations $\phi$ in CB19 for PGA and Sa, will force us to create a CampbellBozorgnia2019 class, right?

ftbernales avatar Jun 06 '24 01:06 ftbernales

Hi, @emthompson-usgs! Sorry for the quite late revert. Yes, we're working on it now though taking quite slow due to other workload. I'll also checkout @kslytherin's branch to make sure we didn't miss anything. But if I may ask, is it of interest to you to merge this feature into master ASAP?

@ftbernales No, my question was motivated by a need for a specific timeline on getting this merged, just to try to stay coordinated. If you are working on it, @kslytherin and myself are happy to leave it to you and we will work on other models.

Specifically, we are working on a conditional GMM for CAV by Macedo et al. (2021) (based on base class here), and the Sandikkaya and Akkar (2017) model for CAV and AI. I mention this because these may be of interest to you as well since you are working on the CB19 model, and hopefully we don't duplicate efforts going forward.

emthompson-usgs avatar Jun 06 '24 14:06 emthompson-usgs

All CB14 & CB19 tests passed.

For your another round of review, @mmpagani @micheles cc: @emthompson-usgs @kslytherin

ftbernales avatar Jun 19 '24 03:06 ftbernales

I have issue with calc of phi for total aleatory stddev. I want to know which is the correct formula for phi.

phi equation in CB14:

phi equation in CB19 spreadsheet:

spreadsheet in cb19: https://journals.sagepub.com/doi/suppl/10.1193/090818EQS212M/suppl_file/10_eeri_35_3_suppl_es1_online.xlsx

spreadheet in cb14: https://journals.sagepub.com/doi/suppl/10.1193/100614EQS151M/suppl_file/14_eeri_32_2_suppl1_es1-es1_online.xlsx

Reference:

Bozorgnia, Y., & Campbell, K. W. (2016). Ground motion model for the vertical-to-horizontal (V/H) ratios of PGA, PGV, and response spectra. Earthquake Spectra, 32(2), 951-978.

Campbell, K. W., & Bozorgnia, Y. (2014). NGA-West2 ground motion model for the average horizontal components of PGA, PGV, and 5% damped linear acceleration response spectra. Earthquake Spectra, 30(3), 1087-1115.

Campbell, K. W., & Bozorgnia, Y. (2019). Ground motion models for the horizontal components of Arias intensity (AI) and cumulative absolute velocity (CAV) using the NGA-West2 database. Earthquake Spectra, 35(3), 1289-1310.

I

Hi, @emthompson-usgs. Thanks for the heads up. The reason for this approach in implementation by my colleague @emabcede30 is the difference in the cross-correlation coefficient ρln⁡(PGA),ln⁡(Y) between CB14 and CB19 (you can verify this by simply comparing the "HOR_Coeffs" sheets in their respective supplementary Excel files). Even though the median estimates stay the same, the inter-event standard deviations ϕ are different between CB14 and CB19. In relation to this, we actually thought of including the updated CB19 GSIM for RotD50 PGA & Sa in this PR as well; fortunately, this discussion has been already brought up.

Regardless, thanks @kslytherin for reaching out to the GMM developers directly. I think their response will bring more clarity to our final direction.

I would like to request for further advice, @mmpagani @micheles, given these additional considerations/constraints. Thanks!

I have heard back from Ken Campbell on phi. He said, "The 2019 spreadsheet has an error in the calculation of Phi. It doesn't use the "bedrock" version of Phi." We should be using the equations in CB14.

kslytherin avatar Jun 26 '24 20:06 kslytherin

Thank you kslytherin, we will update the test suite.

emabcede30 avatar Jun 27 '24 04:06 emabcede30

Sending here the link for the macro-spreadsheet for the test suite: https://drive.google.com/drive/folders/1Y7722tLMzLTPE-KlrYfXx0tYoZiOIjS7?usp=sharing

emabcede30 avatar Jun 29 '24 07:06 emabcede30

All CB14 & CB19 tests passed.

For review, thanks

emabcede30 avatar Jul 11 '24 01:07 emabcede30

The tests are red:

  File "/home/runner/work/oq-engine/oq-engine/openquake/hazardlib/gsim/can20/can_shm6_active_crust.py", line 432, in compute
    CB14.CONSTS["philnAF"] ** 2.)
KeyError: 'philnAF'

micheles avatar Jul 31 '24 08:07 micheles

Greetings all, apologies for late response. Just a quick fix for ϕln AF - the estimated aleatory standard deviation of f_site for linear site response. gsim/can20 uses cb14 constants, but ϕln AF for arias intensity is a different value in cb19. I set it back as a constant to 0.3, but when it accesses the coeff tables, it ovewrites to the correct ϕln AF value for arias intensity. Hope this fixes it.

For review, thanks

emabcede30 avatar Sep 09 '24 06:09 emabcede30