"""Change the data type of an input collection from irradiane to illuminance."""
    head = data.header
    new_header = Header(Illuminance(), 'lux', head.analysis_period,
                        head.metadata)
    return HourlyContinuousCollection(new_header, data.values) if \
        isinstance(data, HourlyContinuousCollection) else \
        data.__class__(new_header, data.values, data.datetimes)


if all_required_inputs(ghenv.Component):
    # set default values
    az = _srf_azimuth_ if _srf_azimuth_ is not None else 180
    alt = _srf_altitude_ if _srf_altitude_ is not None else 0
    gref = _ground_ref_ if _ground_ref_ is not None else 0.2
    isot = not anisotrophic_

    # create the Wea and output irradaince
    wea = Wea(_location, _direct_norm, _diffuse_horiz)
    total, direct, diff, reflect = \
        wea.directional_irradiance(alt, az, gref, isot)
    for dat in (total, direct, diff, reflect):
        dat.header.metadata['altitude'] = alt
        dat.header.metadata['azimuth'] = az

    # convert to illuminace if input data was illuiminance
    if isinstance(_direct_norm.header.data_type, Illuminance):
        total = rad_to_ill(total)
        direct = rad_to_ill(direct)
        diff = rad_to_ill(diff)
        reflect = rad_to_ill(reflect)
            north_ = math.degrees(
                to_vector2d(north_).angle_clockwise(Vector2D(0, 1)))
        except AttributeError:  # north angle instead of vector
            north_ = float(north_)
    else:
        north_ = 0
    density = 2 if high_density_ else 1
    ground_r = 0.2 if _ground_ref_ is None else _ground_ref_

    # filter the radiation by _hoys if they are input
    if len(_hoys_) != 0:
        _direct_rad = _direct_rad.filter_by_hoys(_hoys_)
        _diffuse_rad = _diffuse_rad.filter_by_hoys(_hoys_)

    # create the wea and write it to the default_epw_folder
    wea = Wea(_location, _direct_rad, _diffuse_rad)
    wea_duration = len(wea) / wea.timestep
    wea_folder = _folder_ if _folder_ is not None else \
        os.path.join(lb_folders.default_epw_folder, 'sky_matrices')
    metd = _direct_rad.header.metadata
    wea_basename = metd['city'].replace(' ',
                                        '_') if 'city' in metd else 'unnamed'
    wea_path = os.path.join(wea_folder, wea_basename)
    wea_file = wea.write(wea_path)

    # execute the Radiance gendaymtx command
    use_shell = True if os.name == 'nt' else False
    # command for direct patches
    cmds = [gendaymtx_exe, '-m', str(density), '-d', '-O1', '-A', wea_file]
    process = subprocess.Popen(cmds, stdout=subprocess.PIPE, shell=use_shell)
    stdout = process.communicate()
    if _atmos_pressure_:
        epw_obj.atmospheric_station_pressure.values = check_data(
            '_atmos_pressure_', _atmos_pressure_, Pressure, 'Pa', leap_yr)
    if _visibility_:
        epw_obj.visibility.values = check_data(
            '_visibility_', _visibility_, Distance, 'km', leap_yr)
    if _ceiling_height_:
        epw_obj.ceiling_height.values = check_data(
            '_ceiling_height_', _ceiling_height_, Distance, 'm', leap_yr)
    if _model_year_:
        epw_obj.years.values = _model_year_.values
    
    # calculate properties that are derived from other inputs
    if _dry_bulb_temp_ and _dew_point_temp_:
        rel_humid = HourlyContinuousCollection.compute_function_aligned(
            rel_humid_from_db_dpt, [_dry_bulb_temp_, _dew_point_temp_],
            RelativeHumidity(), '%')
        epw_obj.relative_humidity.values = rel_humid.values
    if _direct_normal_rad_ and _diffuse_horiz_rad_:
        wea = Wea(_location, _direct_normal_rad_, _diffuse_horiz_rad_)
        epw_obj.global_horizontal_radiation.values = wea.global_horizontal_irradiance.values
    if _direct_normal_ill_ and _diffuse_horiz_ill_:
        glob_horiz = []
        sp = Sunpath.from_location(_location)
        sp.is_leap_year = leap_yr
        for dt, dni, dhi in zip(_direct_normal_ill_.datetimes,
                _direct_normal_ill_, _diffuse_horiz_ill_):
            sun = sp.calculate_sun_from_date_time(dt)
            glob_horiz.append(dhi + dni * math.sin(math.radians(sun.altitude)))
        epw_obj.global_horizontal_radiation.values = glob_horiz