Esempio n. 1
0
    ShakeGrid,
    convert_mmi_data)

QGIS_APP, CANVAS, IFACE, PARENT = get_qgis_app()
# Parse the grid once and use it for all tests to fasten the tests
# Use temp directory to do the testing
SOURCE_PATH = test_data_path(
    'hazard',
    'shake_data',
    '20131105060809',
    'output',
    'grid.xml')
GRID_PATH = os.path.join(temp_dir(__name__), 'grid.xml')
shutil.copyfile(SOURCE_PATH, GRID_PATH)

SHAKE_GRID = ShakeGrid('Test Title', 'Test Source', GRID_PATH)


class ShakeGridTest(unittest.TestCase):
    """Class to test ShakeGrid."""

    @classmethod
    def tearDownClass(cls):
        """Class method called after tests on this class have run."""
        shutil.rmtree(temp_dir(__name__))

    def check_feature_count(self, path, count):
        """Method to check the features number of a vector layer.

        :param path: Path to vector layer.
        :type path: str
Esempio n. 2
0
QGIS_APP, CANVAS, IFACE, PARENT = get_qgis_app()

__copyright__ = "Copyright 2017, The InaSAFE Project"
__license__ = "GPL version 3"
__email__ = "*****@*****.**"
__revision__ = 'b2d0c787b7d956ae517d9245e8cb7b285d71ce74'

# Parse the grid once and use it for all tests to fasten the tests
# Use temp directory to do the testing
SOURCE_PATH = standard_data_path('hazard', 'shake_data', '20131105060809',
                                 'output', 'grid.xml')
GRID_PATH = os.path.join(temp_dir(__name__), 'grid.xml')
shutil.copyfile(SOURCE_PATH, GRID_PATH)

NORMAL_SHAKE_GRID = ShakeGrid('Normal Shake Map',
                              'Normal',
                              GRID_PATH,
                              output_dir=temp_dir(sub_dir='normal'))

SMOOTHED_SHAKE_GRID = ShakeGrid('Smoothed Shake Map',
                                'Smoothed',
                                GRID_PATH,
                                output_dir=temp_dir(sub_dir='smoothed'),
                                smoothing_method=NUMPY_SMOOTHING)


class TestShakeGrid(unittest.TestCase):
    """Class to test ShakeGrid."""
    @classmethod
    def tearDownClass(cls):
        """Class method called after tests on this class have run."""
        shutil.rmtree(temp_dir(__name__))