New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding new parameters to site.py and adding a new gsim #7020
Conversation
Added soil and topographical parameters to site.py
9ead5fa
to
26b733e
Compare
This is all good, but you should also add the code using the new parameters ;-) |
Thanks Michele. I will open a new pull request submitting the code for corresponding GSIM using these site parameters along with the other related files. |
Implementing Youd_etal_2002 GSIM for estimating liquefaction-induced lateral spread displacements.
The way to implement new GMPEs has changed drastically in the last weeks. You need to rewrite your GMPE to the compute API (follow any example in the current hazardlib). |
The GMPE file has been updated in accordance with the other GMPE files in the hazardlib.
The GMPE has been updated in accordance with the other GMPEs in hazardlib. Kindly, let me know if I am missing something. |
You are missing everything. Since one month ago GMPE classes do no have methods except a "compute" method. See for instance the implementation of https://github.com/gem/oq-engine/blob/master/openquake/hazardlib/gsim/raghukanth_iyengar_2007.py. You need to update your version of hazardlib. See for instance https://www.earthdatascience.org/courses/intro-to-earth-data-science/git-github/github-collaboration/update-github-repositories-with-changes-by-others/ |
Updated the GMPE file in accordance with the new format
As you rightly pointed out, my hazardlib wasn't updated. The shared links were quite useful. I have updated the GMPE file in accordance with the current version. However, let me know, if I am still missing something. Thanks, |
Now it is much better. There still a few issues, though. The notation |
Changed the name of functions as suggested.
I have updated the function names. Let me know other issues in the file. I'll work on them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove from your PR the tables of Lanzano and Kuehn. Also, I put a couple of notes that I kindly ask to be addressed.
|
||
R = (10 ** ((0.89 * ctx.mag) - 5.64)) + ctx.repi | ||
|
||
if ctx.freeface_ratio.all() == 0.0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand what this part of the code does. The freeface ratio is a site-specific coefficient. So depending on the value of this param for each site C and ctx.slope should be defined accordingly. However, with ctx.freeface_ratio.all()
you check if all the sites have a value of this parameter == 0 and then apply a correction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Marco,
PFA herewith the response to this query. Let us know, if any modifications further are to be incorporated or if we are missing something.
Thanks,
Explanation for the following lines of the code_sept 12 2021.pdf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Marco,
May we know the next steps to be taken in this pull request.
Thanks,
Prajakta
|
I have incorporated the changes as suggested. Further, the explanation for the different lines of code have been given in the attached file.
This reverts commit 810ba05.
Hello Marco and Michele, We have addressed your comments. May we know the next steps to be taken in this pull request. Thanks, |
8c809f5
to
022e516
Compare
Restored kuehn_2020_coeffs.csv Delete lanzano Restore lanzano from upstream
e481319
to
f7ff59d
Compare
The tests are broken, therefore this is a no go:
|
Hi Marco and Michele: Thanks for working on this pull request. I wonder why the tests are failing. Are the site parameters 'slope', 'freeface_ratio', 'T_15', 'F_15', 'D50_15' being included in the site.py and other related files? |
Hi Prajakta,
Please have a look at the link below. Are tests green on your machine?
https://github.com/gem/oq-engine/runs/4809232021?check_suite_focus=true#step:5:241
Marco
… Hi Marco and Michele:
Thanks for working on this pull request.
I wonder why the tests are failing. Are the site parameters 'slope',
'freeface_ratio', 'T_15', 'F_15', 'D50_15' being included in the
site.py and other related files?
--
Reply to this email directly or view it on GitHub:
#7020 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
Hi Marco: I checked the mentioned link. Yes, the tests did not run on my machine as well and showed the same error. So, we need to define these new parameters, viz., 'slope', 'freeface_ratio', 'T_15', 'F_15', 'D50_15' in site.py file and ensure that these are read in the Youd et al. gsim file. In order to do this, we might have to change other files. As a developer, can you suggest, which file needs to be changed? Thanks, Prajakta |
I do not think it depends on the fact that you are using new site terms. The error you get is generated by the tests defined in the verification tables. The error message explains that for that combination of parameters your model gives 0.0 while according to the test it should give 0.04225547599999999. You should check your model. |
Hi Marco: It makes me think why the model is in fact calculating 0.0 as the output, if it is able to take the values for parameters. I tried to run the tests on my PC using the same files that I have uploaded on Github in a newer version of OQ and I am getting an attribute error (Check attached image 'error_test'). I have also included image of a successful test ('success_test'), which was run in older version of OQ and using already defined parameters ('dw' in the place of free-face ratio). I can look into this in more detail, however, any suggestions on what might be going wrong would be of great help! |
I will look at the PR tomorrow, but today we have the release 3.13 to make ;-) |
Sure Michele :) 👍 |
The error is clear: in the file Youd2004_MEAN.csv the slope parameter has value 0 for some magnitudes (for instance mag=4.5); then you have a site term |
Hi Michele: Thanks for looking into this. I don't think that is resulting in zero value, because, I have included these lines, if ctx.freeface_ratio.all() == 0.0: The idea is, either of slope or freeface_ratio should be non-zero. As a result, if slope=0, then slope=freeface_ratio and the calculation will be done using COEFFS_FREEFACE table. Do you think, there is issue with this logic or syntax, because, this logic has worked fine in the previous version of OQ as shown through successful test result in previous conversation? |
The logic here is implemented incorrectly: if ctx.freeface_ratio.all() == 0.0:
C = self.COEFFS_SLOPE[imt]
else:
C = self.COEFFS_FREEFACE[imt]
ctx.slope = ctx.freeface_ratio I am going to close this PR and reopen it with the logic implemented correctly. |
This PR adds new soil and topographical parameters useful for predicting lateral spread displacements.
This PR also adds new gsim, Youd et al. (2002), for estimating lateral spread displacements.