# Path: cis/exceptions.py
# class InvalidCommandLineOptionError(CISError):
#     pass


import collections.abc
import re
import logging
import warnings
import numpy as np
import contextlib
    import logging
    import sys
    import numpy.ma as ma
    import numpy.ma as ma
    import numpy as np
    import numpy
    import math
    import numpy.ma as ma
    import iris
        import psutil
    import warnings
    import warnings
from cis.exceptions import InvalidCommandLineOptionError
    from numpy.ma import MaskedArray
        from numpy.ma import concatenate
        from numpy import concatenate
    from decimal import Decimal
    from numpy import array, append, logspace, log10
    from numpy.ma import MaskedArray
    from iris.exceptions import CoordinateNotFoundError
    from iris.analysis.cartography import wrap_lons
    from iris.exceptions import CoordinateNotFoundError
    from types import GeneratorType
    from iris.cube import Cube
    from iris.util import squeeze
    from cis.data_io.gridded_data import make_from_cube


def parse_distance_with_units_to_float_m(distance):
    """Parse a string such as '10km' or '1.0e3m' to a distance in m

    :param distance: string to parse
    :return: A distance in m
    """
    measurement = split_into_float_and_units(distance)
    if measurement['units'] is None:
        return measurement['value']
    else:
        return parse_distance_with_units_to_float_km(distance) * 1000.0


def split_into_float_and_units(measurement):
    """Split a string such as '1000m' or '1.0e3' to a value and, optionally, units

    :param distance: string to parse
    :return: A distance in m
    """

    # Convert to a string, just in case the number comes in as something else
    measurement = str(measurement)

    # First find any numbers that match the float type, e.g. 1, 1.2, 12e3
    measurement_value = re.findall(r'[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?', measurement)

    # Check for 1 and only 1 value found
    if len(measurement_value) > 1:

# Path: cis/exceptions.py
# class InvalidCommandLineOptionError(CISError):
#     pass


# Path: cis/utils.py
import collections.abc
import re
import logging
import warnings
import numpy as np
import contextlib
    import logging
    import sys
    import numpy.ma as ma
    import numpy.ma as ma
    import numpy as np
    import numpy
    import math
    import numpy.ma as ma
    import iris
        import psutil
    import warnings
    import warnings
from cis.exceptions import InvalidCommandLineOptionError
    from numpy.ma import MaskedArray
        from numpy.ma import concatenate
        from numpy import concatenate
    from decimal import Decimal
    from numpy import array, append, logspace, log10
    from numpy.ma import MaskedArray
    from iris.exceptions import CoordinateNotFoundError
    from iris.analysis.cartography import wrap_lons
    from iris.exceptions import CoordinateNotFoundError
    from types import GeneratorType
    from iris.cube import Cube
    from iris.util import squeeze
    from cis.data_io.gridded_data import make_from_cube



def parse_distance_with_units_to_float_m(distance):
    """Parse a string such as '10km' or '1.0e3m' to a distance in m

    :param distance: string to parse
    :return: A distance in m
    """
    measurement = split_into_float_and_units(distance)
    if measurement['units'] is None:
        return measurement['value']
    else:
        return parse_distance_with_units_to_float_km(distance) * 1000.0


def split_into_float_and_units(measurement):
    """Split a string such as '1000m' or '1.0e3' to a value and, optionally, units

    :param distance: string to parse
    :return: A distance in m
    """

    # Convert to a string, just in case the number comes in as something else
    measurement = str(measurement)

    # First find any numbers that match the float type, e.g. 1, 1.2, 12e3
    measurement_value = re.findall(r'[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?', measurement)

    # Check for 1 and only 1 value found
    if len(measurement_value) > 1:

        raise InvalidCommandLineOptionError("More than one number found")