Example #1
0
def test_from_string():
    opt = RtraceOptions()
    opt_str = '-I -u- -h+ -lw 2e-06 -fa'
    opt.update_from_string(opt_str)
    assert opt.I == True
    assert opt.u == False
    assert opt.h == True
    assert opt.lw == 2e-06
    assert opt.fio == 'a'
    'point-in-time-image': 'rpict',
    'rpict': 'rpict',
    '2': 'rfluxmtx',
    'annual': 'rfluxmtx',
    'rfluxmtx': 'rfluxmtx',
}

DETAIL_LEVELS = {'0': 0, 'low': 0, '1': 1, 'medium': 1, '2': 2, 'high': 2}

if all_required_inputs(ghenv.Component):
    # process the recipe type and level of detail
    _detail_level_ = DETAIL_LEVELS[_detail_level_.lower()] \
        if _detail_level_ is not None else 0
    command_name = RECIPE_TYPES[_recipe_type.lower()]
    if command_name == 'rtrace':
        option_dict = RTRACE
        option_obj = RtraceOptions()
    elif command_name == 'rpict':
        option_dict = RPICT
        option_obj = RpictOptions()
    elif command_name == 'rfluxmtx':
        option_dict = RFLUXMTX
        option_obj = RfluxmtxOptions()

    # assign the defualts to the object and output the string
    for opt_name, opt_val in option_dict.items():
        setattr(option_obj, opt_name, opt_val[_detail_level_])
    if additional_par_:
        option_obj.update_from_string(additional_par_)
    rad_par = option_obj.to_radiance()
Example #3
0
def test_from_string_non_standard():
    opt = RtraceOptions()
    opt_str = '-g 200'
    opt.update_from_string(opt_str)
    assert '-g 200' in opt.to_radiance()