# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Affero General Public # License along with OpenQuake Risklib. If not, see # <http://www.gnu.org/licenses/>. import os import unittest from openquake.risklib import scientific from openquake.risklib.tests.utils import vectors_from_csv THISDIR = os.path.dirname(__file__) gmv = vectors_from_csv('gmv', THISDIR) def vf(loss_ratios, covs=(0.0, 0.0, 0.0, 0.0, 0.0)): return scientific.VulnerabilityFunction( 'PGA', [0.1, 0.2, 0.3, 0.5, 0.7], loss_ratios, covs) class ScenarioTestCase(unittest.TestCase): vulnerability_model_mean = dict( RM=vf([0.05, 0.1, 0.2, 0.4, 0.8]), RC=vf([0.035, 0.07, 0.14, 0.28, 0.56]) ) hazard_mean = dict(
# # You should have received a copy of the GNU Affero General Public # License along with OpenQuake Risklib. If not, see # <http://www.gnu.org/licenses/>. import os import unittest import numpy from openquake.risklib import scientific, workflows from openquake.risklib.tests.utils import vectors_from_csv THISDIR = os.path.dirname(__file__) gmf = vectors_from_csv('gmf', THISDIR) assets = [workflows.Asset( 1, 'SOME-TAXONOMY', 1, (0, 0), dict(structural=10), insurance_limits=dict(structural=1250), deductibles=dict(structural=40)) ] * 2 class EventBasedTestCase(unittest.TestCase): loss_type = 'structural' def assert_similar(self, a, b): assert a.keys() == b.keys(), (a.keys(), b.keys()) for k in a:
# # You should have received a copy of the GNU Affero General Public # License along with OpenQuake Risklib. If not, see # <http://www.gnu.org/licenses/>. import os import unittest import numpy from openquake.risklib import scientific, workflows from openquake.risklib.tests.utils import vectors_from_csv THISDIR = os.path.dirname(__file__) gmf = vectors_from_csv('gmf', THISDIR) assets = [ workflows.Asset(1, 'SOME-TAXONOMY', 1, (0, 0), dict(structural=10), insurance_limits=dict(structural=1250), deductibles=dict(structural=40)) ] * 2 class EventBasedTestCase(unittest.TestCase): loss_type = 'structural' def assert_similar(self, a, b):
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Affero General Public # License along with OpenQuake Risklib. If not, see # <http://www.gnu.org/licenses/>. import os import unittest from openquake.risklib import scientific from openquake.risklib.tests.utils import vectors_from_csv THISDIR = os.path.dirname(__file__) gmv = vectors_from_csv('gmv', THISDIR) def vf(loss_ratios, covs=(0.0, 0.0, 0.0, 0.0, 0.0)): return scientific.VulnerabilityFunction('VF', 'PGA', [0.1, 0.2, 0.3, 0.5, 0.7], loss_ratios, covs) class ScenarioTestCase(unittest.TestCase): vulnerability_model_mean = dict(RM=vf([0.05, 0.1, 0.2, 0.4, 0.8]), RC=vf([0.035, 0.07, 0.14, 0.28, 0.56])) hazard_mean = dict( a1=[