# Path: safe/processors/post_processor_functions.py
# def size(size_calculator, geometry):
#     """Simple postprocessor where we compute the size of a feature.
# 
#     :param geometry: The geometry.
#     :type geometry: QgsGeometry
# 
#     :param size_calculator: The size calculator.
#     :type size_calculator: safe.gis.vector.tools.SizeCalculator
# 
#     :return: The size.
#     """
#     feature_size = size_calculator.measure(geometry)
#     return feature_size


import logging
from safe.common.exceptions import InvalidKeywordsForProcessingAlgorithm
from safe.definitions.fields import (
    size_field,
    count_fields,
)
from safe.definitions.processing_steps import (
    recompute_counts_steps)
from safe.gis.sanity_check import check_layer
from safe.gis.vector.tools import SizeCalculator
from safe.processors.post_processor_functions import size
from safe.utilities.profiling import profile
        msg = '%s not found in %s' % (
            size_field['key'], layer.keywords['title'])
        raise InvalidKeywordsForProcessingAlgorithm(msg)

    indexes = []
    absolute_field_keys = [f['key'] for f in count_fields]
    for field, field_name in list(fields.items()):
        if field in absolute_field_keys and field != size_field['key']:
            indexes.append(layer.fields().lookupField(field_name))
            LOGGER.info(
                'We detected the count {field_name}, we will recompute the '
                'count according to the new size.'.format(
                    field_name=field_name))

    if not len(indexes):
        msg = 'Absolute field not found in the layer %s' % (
            layer.keywords['title'])
        raise InvalidKeywordsForProcessingAlgorithm(msg)

    size_field_name = fields[size_field['key']]
    size_field_index = layer.fields().lookupField(size_field_name)

    layer.startEditing()

    exposure_key = layer.keywords['exposure_keywords']['exposure']
    size_calculator = SizeCalculator(
        layer.crs(), layer.geometryType(), exposure_key)

    for feature in layer.getFeatures():
        old_size = feature[size_field_name]

# Path: safe/processors/post_processor_functions.py
# def size(size_calculator, geometry):
#     """Simple postprocessor where we compute the size of a feature.
# 
#     :param geometry: The geometry.
#     :type geometry: QgsGeometry
# 
#     :param size_calculator: The size calculator.
#     :type size_calculator: safe.gis.vector.tools.SizeCalculator
# 
#     :return: The size.
#     """
#     feature_size = size_calculator.measure(geometry)
#     return feature_size


# Path: safe/gis/vector/recompute_counts.py
import logging
from safe.common.exceptions import InvalidKeywordsForProcessingAlgorithm
from safe.definitions.fields import (
    size_field,
    count_fields,
)
from safe.definitions.processing_steps import (
    recompute_counts_steps)
from safe.gis.sanity_check import check_layer
from safe.gis.vector.tools import SizeCalculator
from safe.processors.post_processor_functions import size
from safe.utilities.profiling import profile

        msg = '%s not found in %s' % (
            size_field['key'], layer.keywords['title'])
        raise InvalidKeywordsForProcessingAlgorithm(msg)

    indexes = []
    absolute_field_keys = [f['key'] for f in count_fields]
    for field, field_name in list(fields.items()):
        if field in absolute_field_keys and field != size_field['key']:
            indexes.append(layer.fields().lookupField(field_name))
            LOGGER.info(
                'We detected the count {field_name}, we will recompute the '
                'count according to the new size.'.format(
                    field_name=field_name))

    if not len(indexes):
        msg = 'Absolute field not found in the layer %s' % (
            layer.keywords['title'])
        raise InvalidKeywordsForProcessingAlgorithm(msg)

    size_field_name = fields[size_field['key']]
    size_field_index = layer.fields().lookupField(size_field_name)

    layer.startEditing()

    exposure_key = layer.keywords['exposure_keywords']['exposure']
    size_calculator = SizeCalculator(
        layer.crs(), layer.geometryType(), exposure_key)

    for feature in layer.getFeatures():
        old_size = feature[size_field_name]

        new_size = size(