# Path: safe/definitions/layer_purposes.py



import logging
import os
from safe.definitions.exposure import exposure_place
from safe.definitions.hazard import hazard_earthquake
from safe.definitions.layer_purposes import (
    layer_purpose_exposure,
    layer_purpose_hazard,
    layer_purpose_nearby_places,
    layer_purpose,
    layer_purpose_earthquake_contour,
)
from safe.gis.raster.contour import create_smooth_contour
from safe.processors import (
    function_process,
)
from safe.utilities.gis import is_raster_layer
from safe.utilities.i18n import tr
    from safe.test.utilities import load_test_vector_layer
        from safe.gis.tools import load_layer
        return False


def earthquake_contour_preprocessor(impact_function):
    """Preprocessor to create contour from an earthquake

    :param impact_function: Impact function to run.
    :type impact_function: ImpactFunction

    :return: The contour layer.
    :rtype: QgsMapLayer
    """
    contour_path = create_smooth_contour(impact_function.hazard)

    if os.path.exists(contour_path):
        return load_layer(contour_path, tr('Contour'), 'ogr')[0]


pre_processor_earthquake_contour = {
    'key': 'pre_processor_earthquake_contour',
    'name': tr('Earthquake Contour Pre Processor'),
    'description': tr(
        'A pre processor to create contour from a hazard earthquake.'),
    'condition': check_earthquake_contour_preprocessor,
    'process': {
        'type': function_process,
        'function': earthquake_contour_preprocessor,
    },
    'output': {
        'type': 'layer',

# Path: safe/definitions/layer_purposes.py



# Path: safe/processors/pre_processors.py
import logging
import os
from safe.definitions.exposure import exposure_place
from safe.definitions.hazard import hazard_earthquake
from safe.definitions.layer_purposes import (
    layer_purpose_exposure,
    layer_purpose_hazard,
    layer_purpose_nearby_places,
    layer_purpose,
    layer_purpose_earthquake_contour,
)
from safe.gis.raster.contour import create_smooth_contour
from safe.processors import (
    function_process,
)
from safe.utilities.gis import is_raster_layer
from safe.utilities.i18n import tr
    from safe.test.utilities import load_test_vector_layer
        from safe.gis.tools import load_layer

        return False


def earthquake_contour_preprocessor(impact_function):
    """Preprocessor to create contour from an earthquake

    :param impact_function: Impact function to run.
    :type impact_function: ImpactFunction

    :return: The contour layer.
    :rtype: QgsMapLayer
    """
    contour_path = create_smooth_contour(impact_function.hazard)

    if os.path.exists(contour_path):
        return load_layer(contour_path, tr('Contour'), 'ogr')[0]


pre_processor_earthquake_contour = {
    'key': 'pre_processor_earthquake_contour',
    'name': tr('Earthquake Contour Pre Processor'),
    'description': tr(
        'A pre processor to create contour from a hazard earthquake.'),
    'condition': check_earthquake_contour_preprocessor,
    'process': {
        'type': function_process,
        'function': earthquake_contour_preprocessor,
    },
    'output': {
        'type': 'layer',

        'key': layer_purpose,