Example #1
0
    def test_plugin_selection(self):
        """Verify the plugins can recognize compatible layers.
        """
        exposure =[
                 'topp:buildings_osm_4326',
                 {'layertype': 'vector',
                  'category': 'exposure',
                  'subcategory': 'structure',
                  'title': 'buildings_osm_4326',
                  'datatype': 'osm',
                  'purpose': 'dki'
                 }
               ]
        hazard = [
                 'topp:jakarta_flood_like_2007_with_structural_improvements',
                  {'layertype': 'raster',
                   'category': 'hazard',
                   'subcategory': 'flood',
                   'title': 'Jakarta flood like 2007 with structural improvements',
                   'resolution': '0.00045228819716',
                   'unit': 'm'
                   }
               ]
        layers = [exposure, hazard]

        exposure_name, exposure_params = exposure
        hazard_name, hazard_params = hazard

        requirements = requirements_collect(FloodBuildingImpactFunction)

        exposure_compatible = requirements_met(requirements, exposure_params)
        assert exposure_compatible

        hazard_compatible = requirements_met(requirements, hazard_params)
        assert hazard_compatible
Example #2
0
    def test_basic_plugin_requirements_met(self):
        """Test requirements_met"""
        requirements = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat1', 'unit': 'MMI'}
        self.assertTrue(requirements_met(requirements, params))

        params = {'category': 'test_cat2', 'unit': 'mmi2'}
        self.assertFalse(requirements_met(requirements, params))
Example #3
0
    def test_basic_plugin_requirements_met(self):
        """Test requirements_met"""
        requirements = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat1', 'unit': 'MMI'}
        self.assertTrue(requirements_met(requirements, params))

        params = {'category': 'test_cat2', 'unit': 'mmi2'}
        self.assertFalse(requirements_met(requirements, params))
Example #4
0
    def test_basic_plugin_requirements(self):
        """Basic plugin requirements collection
        """
        requirelines = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat1', 'unit': 'MMI'}
        assert requirements_met(requirelines, params)

        params = {'category': 'test_cat2', 'unit': 'mmi2'}
        assert not requirements_met(requirelines, params)
Example #5
0
    def test_basic_plugin_requirements(self):
        """Basic plugin requirements collection
        """
        requirelines = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat1', 'unit': 'MMI'}
        assert requirements_met(requirelines, params)

        params = {'category': 'test_cat2', 'unit': 'mmi2'}
        assert not requirements_met(requirelines, params)
Example #6
0
    def test_basic_plugin_requirements(self):
        """Basic plugin requirements collection
        """
        requirelines = requirements_collect(BasicFunction)
        params = {'category': 'hazard', 'unit': 'mmi'}
        assert requirements_met(requirelines, params)

        params = {'category': 'exposure', 'unit': 'mmi2'}
        assert requirements_met(requirelines, params, True) == False
Example #7
0
    def test_plugin_selection(self):
        """Verify the plugins can recognize compatible layers.
        """
        exposure = [
            'topp:buildings_osm_4326', {
                'layertype': 'vector',
                'category': 'exposure',
                'subcategory': 'structure',
                'title': 'buildings_osm_4326',
                'datatype': 'osm',
                'purpose': 'dki'
            }
        ]
        hazard = [
            'topp:jakarta_flood_like_2007_with_structural_improvements', {
                'layertype': 'raster',
                'category': 'hazard',
                'subcategory': 'flood',
                'title':
                'Jakarta flood like 2007 with structural improvements',
                'resolution': '0.00045228819716',
                'unit': 'm'
            }
        ]
        layers = [exposure, hazard]

        exposure_name, exposure_params = exposure
        hazard_name, hazard_params = hazard

        requirements = requirements_collect(FloodBuildingImpactFunction)

        exposure_compatible = requirements_met(requirements, exposure_params)
        assert exposure_compatible

        hazard_compatible = requirements_met(requirements, hazard_params)
        assert hazard_compatible