Hello OpenQuake community,
I am running a scenario-based (event-based) analysis with secondary perils (liquefaction) using OpenQuake Engine WebUI version 3.23.3 on Windows, applying the ZhuEtAl2017LiquefactionGeneral model.
My setup is as follows:
Liquefaction model: ZhuEtAl2017LiquefactionGeneral
Site model CSV includes additional parameters vs30, dw, gwd, precip

Hi Lana, thank you so much for the guidance!
I followed your advice and removed the [Hazard sites] block in my job.ini file. You were totally right—the calculation ran perfectly smooth when I used the Zhu et al. (2015) model.
However, when I tried running the exact same scenario using the Zhu et al. (2017) model with intensity_measure_types = PGA, PGV, a completely different error popped up: UnboundLocalError: cannot access local variable 'prob_liq'.
Out of curiosity, and because I really needed both the PGA and PGV outputs, I decided to poke around the openquake/sep/classes.py file (with a little help from AI to understand the code flow). It seems the error in the 2017 model is a slightly different case. The issue appears to happen because the out.append() lines are still being executed when the loop evaluates PGA, even though the 2017 function only initializes those variables when the IMT is PGV.
So, I tried experimenting by adding an indentation to those 3 append lines so they sit securely inside the if im.string == "PGV": block, like this:
def compute(self, mag, imt_gmf, sites):
out = []
for im, gmf in imt_gmf:
if im.string == "PGV":
prob_liq, out_class, lse = zhu_etal_2017_general(
pgv=gmf,
vs30=sites.vs30,
dw=sites.dw,
gwd=sites.gwd,
precip=sites.precip,
)
# I tried adding indentation to these 3 lines
out.append(prob_liq)
out.append(out_class)
out.append(lse)
return out
After shifting the code, the error completely disappeared, and the scenario with the 2017 model successfully finished calculating both IMTs!
I just wanted to share the result of this little experiment. Please correct me if my understanding or this workaround is wrong, or if there is a more proper solution from the developer's side.
Thanks again so much for your help!
--
You received this message because you are subscribed to the Google Groups "OpenQuake Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openquake-use...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/openquake-users/b58dc63d-8906-4dac-bb43-848a8440c5efn%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/openquake-users/061b1f45-9d03-43c6-9983-0ec4d89d2fa8n%40googlegroups.com.