def field_max(odb, result):
    """
    Look for the max value in a field output.

    Scan a field output on an abaqus result database and return the maximum value

    Parameters
    ----------
    odb : class
        Abaqus model containing the field results
    result : class
        Field output result to search for max

    Attributes
    ----------

    Notes
    -----

    References
    ----------

    """
    result_field, result_invariant = result
    _max = -1e+20
    for step in odb.steps.values():
        print('Processing Step:', step.name)
        for frame in step.frames:
            if frame.frameValue > 0.0:
                all_fields = frame.fieldOutputs
                if all_fields.has_key(result_field):
                    stress_set = all_fields[result_field]
                    for stressValue in stress_set.values:
                        if result_invariant:
                            if hasattr(stressValue, result_invariant.lower()):
                                val = getattr(stressValue, result_invariant
                                    .lower())
                            else:
                                raise ValueError(
                                    'Field value does not have invariant %s' %
                                    (result_invariant,))
                        else:
                            val = stressValue.data
                        if val > _max:
                            _max = val
                else:
                    raise ValueError('Field output does not have field %s' %
                        (result_field,))
    return _max
