Example #1
0
    def test_switzerland(self):

        drought = Drought()
        drought.set_area(44.5, 5, 50, 12)

        hazard_set = drought.setup()

        imp_drought = Impact()
        dr_if = ImpactFuncSet()
        if_def = IFDrought()
        if_def.set_default()
        dr_if.append(if_def)

        exposure_agrar = SpamAgrar()
        exposure_agrar.init_spam_agrar(country='CHE')
        exposure_agrar.assign_centroids(hazard_set)
        imp_drought.calc(exposure_agrar, dr_if, hazard_set)

        index_event_start = imp_drought.event_name.index('2003')
        damages_drought = imp_drought.at_event[index_event_start]

        self.assertEqual(hazard_set.tag.haz_type, 'DR')
        self.assertEqual(hazard_set.size, 114)
        self.assertEqual(hazard_set.centroids.size, 130)
        self.assertEqual(exposure_agrar.latitude.values.size, 766 / 2)
        self.assertEqual(exposure_agrar.value[3], 1720024.4)
        self.assertEqual(damages_drought, 61995472.555223145)
Example #2
0
    def test(self):

        drought = Drought()
        drought.set_area(44.5, 5, 50, 12)

        hazard_set = drought.setup()

        self.assertEqual(hazard_set.tag.haz_type, 'DR')
        self.assertEqual(hazard_set.size, 114)
        self.assertEqual(hazard_set.centroids.size, 130)
        self.assertEqual(hazard_set.intensity[112, 111], -1.6286273002624512)