def METHOD_NAME(datetime_value, in_ts_format=None):
    """
    converts a numpy array containing basic_types.datetime_value_2d in
    user specified basic_types.ts_format into a time_value_pair array
    or it takes a basic_types.datetime_value_1d array and converts it to
    a time_value_pair array -- for 1d data, assume the ['value'] contains
    the 'u' component and set the 'v' component to 0.0
    :param datetime_value: numpy array of type basic_types.datetime_value_2d or
        basic_types.datetime_value_1d
    :param in_ts_format=None: format of the datetime_value_2d array - not
        required when converting from datetime_value_1d. Can be defined by a
        string 'r-theta', 'uv' or by an integer defined by one of the options
        given in basic_types.ts_format.
    """
    if (datetime_value.dtype not in (basic_types.datetime_value_2d,
                                     basic_types.datetime_value_1d)):
        raise ValueError('Method expects a numpy array containing '
                         'basic_types.datetime_value_2d or '
                         'basic_types.datetime_value_1d')
    # convert datetime_value_2d to time_value_pair
    time_value_pair = np.zeros((len(datetime_value), ),
                               dtype=basic_types.time_value_pair)
    time_value_pair['time'] = time_utils.date_to_sec(datetime_value['time'])
    if datetime_value.dtype == basic_types.datetime_value_1d:
        time_value_pair['value']['u'] = datetime_value['value'][:]
    else:
        if in_ts_format is None:
            raise ValueError("for datetime_value_2d data conversion, "
                             "the format defined by 'in_ts_format' "
                             "cannot be None ")
        in_ts_format = tsformat(in_ts_format)
        if in_ts_format == basic_types.ts_format.magnitude_direction:
            uv = transforms.r_theta_to_uv_wind(datetime_value['value'])
            time_value_pair['value']['u'] = uv[:, 0]
            time_value_pair['value']['v'] = uv[:, 1]
        elif in_ts_format == basic_types.ts_format.uv:
            time_value_pair['value']['u'] = datetime_value['value'][:, 0]
            time_value_pair['value']['v'] = datetime_value['value'][:, 1]
        else:
            raise ValueError('in_ts_format is not one of the two supported '
                             'types: '
                             'basic_types.ts_format.magnitude_direction, '
                             'basic_types.ts_format.uv')
    return time_value_pair