From 0ab0129700abae5b3fdc99c1c6a51a77566f2553 Mon Sep 17 00:00:00 2001 From: jinyan1214 Date: Mon, 26 Aug 2024 14:57:45 -0700 Subject: [PATCH] jz - UX supported IM type in error message --- .../regionalGroundMotion/gmpe/openSHAGMPE.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/performRegionalEventSimulation/regionalGroundMotion/gmpe/openSHAGMPE.py b/modules/performRegionalEventSimulation/regionalGroundMotion/gmpe/openSHAGMPE.py index 3a6c527ec..a83b970f6 100644 --- a/modules/performRegionalEventSimulation/regionalGroundMotion/gmpe/openSHAGMPE.py +++ b/modules/performRegionalEventSimulation/regionalGroundMotion/gmpe/openSHAGMPE.py @@ -74,7 +74,12 @@ def __init__(self): def setIMT(self, imt): # noqa: N802, D102 if imt not in self.supportedImt: - sys.exit(f'The imt {imt} is not supported by Chiou and Young (2014)') + # supported_imt = [] + # for i in self.supportedImt: + # if i is float: + # supported_imt.append(i) + supported_imt = [f'SA{x}s' if isinstance(x, float) else x for x in self.supportedImt] + sys.exit(f'The IM type {imt} is not supported by Chiou and Young (2014). \n The supported IM types are {supported_imt}') return False self.c1 = self.coeff['c1'][imt] self.c1a = self.coeff['c1a'][imt] @@ -337,8 +342,9 @@ def __init__(self): def setIMT(self, imt): # noqa: N802, D102 if imt not in self.supportedImt: + supported_imt = [f'SA{x}s' if isinstance(x, float) else x for x in self.supportedImt] sys.exit( - f'The imt {imt} is not supported by Abrahamson, Silva, and Kamai (2014)' + f'The IM type {imt} is not supported by Abrahamson, Silva, and Kamai (2014). \n The supported IM types are {supported_imt}' ) return self.imt = imt @@ -636,8 +642,9 @@ def __init__(self): def setIMT(self, imt): # noqa: N802, D102 if imt not in self.supportedImt: + supported_imt = [f'SA{x}s' if isinstance(x, float) else x for x in self.supportedImt] sys.exit( - f'The imt {imt} is not supported by Boore, Stewart, Seyhan & Atkinson (2014)' + f'The IM type {imt} is not supported by Boore, Stewart, Seyhan & Atkinson (2014). \n The supported IM types are {supported_imt}' ) return self.imt = imt @@ -863,8 +870,9 @@ def __init__(self): def setIMT(self, imt): # noqa: N802, D102 if imt not in self.supportedImt: + supported_imt = [f'SA{x}s' if isinstance(x, float) else x for x in self.supportedImt] sys.exit( - f'The imt {imt} is not supported by Campbell & Bozorgnia (2014)' + f'The IM type {imt} is not supported by Campbell & Bozorgnia (2014). \n The supported IM types are {supported_imt}' ) return self.imt = imt