Esempio n. 1
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['_run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])

    assign_parameters(env, file_list)

    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
    # src = find_simulation_input_file(env['site_prefix'] + '.rti')
    # shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    src = find_simulation_input_file(env['rti_file'])
    shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    for var in ('rho_snow', 'c0', 'T0', 'h0_snow', 'h0_swe'):
        if env[var + '_ptype'] == 'Scalar':
            scalar_to_rtg_file(var, env)
Esempio n. 2
0
def execute(env):
    src = find_simulation_input_file(env['bathymetry_file'])
    shutil.copy(src, 'bathymetry.csv')

    if env['sea_level_method'] == 'user':
        src = find_simulation_input_file(env['sea_level_file'])
        shutil.copy(src, 'sea_level.csv')
Esempio n. 3
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env["n_steps"] = int(round(float(env["_run_duration"]) / float(env["dt"])))
    env["save_grid_dt"] = float(env["dt"])
    env["save_pixels_dt"] = float(env["dt"])
    env["n_layers"] = 1  # my choice

    # If no pixel_file is given, let TopoFlow make one.
    if env["pixel_file"] == "off":
        env["pixel_file"] = env["case_prefix"] + "_outlets.txt"

    assign_parameters(env, file_list)

    env["soil_type_0"] = lowercase_choice(env["soil_type_0"])

    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
    src = find_simulation_input_file(env["site_prefix"] + ".rti")
    shutil.copy(src, os.path.join(os.curdir, env["site_prefix"] + ".rti"))

    for var in ("Ks_0", "Ki_0", "qs_0", "qi_0", "G_0"):
        if env[var + "_ptype"] == "Scalar":
            scalar_to_rtg_file(var, env)
Esempio n. 4
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['_run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    assign_parameters(env, file_list)

    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
    src = find_simulation_input_file(env['site_prefix'] + '.rti')
    shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    for var in ('alpha', 'K_soil', 'soil_x', 'T_soil_x'):
        if env[var + '_ptype'] == 'Scalar':
            scalar_to_rtg_file(var, env)
Esempio n. 5
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['_run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])

    # TopoFlow needs site_prefix and case_prefix.
    # env['site_prefix'] = os.path.splitext(env['rti_file'])[0]
    # env['case_prefix'] = 'WMT'

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        # file_list.remove('pixel_file')
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    # Default files common to all TopoFlow components are stored with the
    # topoflow component metadata.
    # prepend_to_path('WMT_INPUT_FILE_PATH',
    #                 os.path.join(site['db'], 'components', 'topoflow', 'files'))
    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
    src = find_simulation_input_file(env['site_prefix'] + '.rti')
    shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))
Esempio n. 6
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env["n_steps"] = int(round(float(env["_run_duration"]) / float(env["dt"])))
    env["save_grid_dt"] = float(env["dt"])
    env["save_pixels_dt"] = float(env["dt"])

    # If no pixel_file is given, let TopoFlow make one.
    if env["pixel_file"] == "off":
        env["pixel_file"] = env["case_prefix"] + "_outlets.txt"

    # Translate the roughness choice to TopoFlow flags.
    env["MANNING"] = env["roughness_option"].startswith("Manning") * 1
    env["LAW_OF_WALL"] = 1 - env["MANNING"]

    assign_parameters(env, file_list)

    # for fname in ['code_file', 'slope_file'] + file_list:
    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
    # src = find_simulation_input_file(env['site_prefix'] + '.rti')
    # shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    src = find_simulation_input_file(env["code_file"])
    env["code_file"] = env["site_prefix"] + "_flow.rtg"
    shutil.copy(src, os.path.join(os.curdir, env["code_file"]))

    src = find_simulation_input_file(env["slope_file"])
    env["slope_file"] = env["site_prefix"] + "_slope.rtg"
    shutil.copy(src, os.path.join(os.curdir, env["slope_file"]))

    src = find_simulation_input_file(env["rti_file"])
    shutil.copy(src, os.path.join(os.curdir, env["site_prefix"] + ".rti"))

    env["A_units"] = units_map[env["A_units"]]
    for var in ("LINK_FLATS", "FILL_PITS_IN_Z0", "LR_PERIODIC", "TB_PERIODIC"):
        env[var] = choices_map[env[var]]

    for var in ("width", "angle", "roughness", "d0", "sinu"):
        if env[var + "_ptype"] == "Scalar":
            scalar_to_rtg_file(var, env)

    for var in ("nval", "z0val"):
        env[var + "_ptype"] = env["roughness_ptype"]
        env[var + "_dtype"] = env["roughness_dtype"]
        env[var] = env["roughness"]
        env[var + "_file"] = env["roughness_file"]
Esempio n. 7
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['_run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    # Translate the roughness choice to TopoFlow flags.
    env['MANNING'] = env['roughness_option'].startswith('Manning') * 1
    env['LAW_OF_WALL'] = 1 - env['MANNING']

    assign_parameters(env, file_list)

    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)

    src = find_simulation_input_file(env['code_file'])
    env['code_file'] = env['site_prefix'] + '_flow.rtg'
    shutil.copy(src, os.path.join(os.curdir, env['code_file']))

    src = find_simulation_input_file(env['slope_file'])
    env['slope_file'] = env['site_prefix'] + '_slope.rtg'
    shutil.copy(src, os.path.join(os.curdir, env['slope_file']))

    # src = find_simulation_input_file(env['site_prefix'] + '.rti')
    # shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    src = find_simulation_input_file(env['rti_file'])
    shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    env['A_units'] = units_map[env['A_units']]
    for var in ('LINK_FLATS', 'FILL_PITS_IN_Z0', 'LR_PERIODIC',
        'TB_PERIODIC'): env[var] = choices_map[env[var]]

    for var in ('width', 'angle', 'roughness', 'd0', 'sinu'):
        if env[var + '_ptype'] == 'Scalar':
            scalar_to_rtg_file(var, env)

    for var in ('nval', 'z0val'):
        env[var + '_ptype'] = env['roughness_ptype']
        env[var + '_dtype'] = env['roughness_dtype']
        env[var] = env['roughness']
        env[var + '_file'] = env['roughness_file']
Esempio n. 8
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['stop_code'] = 1  # my choice
    env['stop_time'] = env['run_duration']  # years
    env['n_steps'] = 1  # WMT needs something here
    env['save_grid_dt'] = 1.0  # years
    env['save_pixels_dt'] = 1.0  # years

    # TopoFlow needs site_prefix and case_prefix.
    env['site_prefix'] = 'CSDMS'
    env['case_prefix'] = 'WMT'

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        file_list.remove('pixel_file')
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    env['BC_method'] = format_choice(env['BC_method'])
    env['make_z0_method'] = format_choice(env['make_z0_method'])
    env['noise_method'] = format_choice(env['noise_method'])
    
    # Default files common to all TopoFlow components are stored with the
    # topoflow component metadata.
    prepend_to_path('WMT_INPUT_FILE_PATH',
                    os.path.join(site['db'], 'components', 'topoflow', 'files'))
    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
Esempio n. 9
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['_run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    env['A_units'] = units_map[env['A_units']]
    env['LINK_FLATS'] = choices_map[env['LINK_FLATS']]
    env['FILL_PITS_IN_Z0'] = choices_map[env['FILL_PITS_IN_Z0']]
    env['LR_PERIODIC'] = choices_map[env['LR_PERIODIC']]
    env['TB_PERIODIC'] = choices_map[env['TB_PERIODIC']]

    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
Esempio n. 10
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['stop_code'] = 1  # my choice
    env['stop_time'] = env['_run_duration']  # years
    env['n_steps'] = 1  # WMT needs something here
    env['save_grid_dt'] = 1.0  # years
    env['save_pixels_dt'] = 1.0  # years
    env['dt'] = 1.0  # years

    # TopoFlow needs site_prefix and case_prefix.
    # env['site_prefix'] = 'default'
    # env['case_prefix'] = 'WMT'

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        # file_list.remove('pixel_file')
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    env['BC_method'] = uppercase_choice(env['BC_method'])
    env['make_z0_method'] = uppercase_choice(env['make_z0_method'])
    env['noise_method'] = uppercase_choice(env['noise_method'])

    env['A_units'] = 'm^2'
    env['LINK_FLATS'] = choices_map[env['LINK_FLATS']]
    env['FILL_PITS_IN_Z0'] = choices_map[env['FILL_PITS_IN_Z0']]
    env['LR_PERIODIC'] = choices_map[env['LR_PERIODIC']]
    env['TB_PERIODIC'] = choices_map[env['TB_PERIODIC']]

    # Default files common to all TopoFlow components are stored with the
    # topoflow component metadata.
    # prepend_to_path('WMT_INPUT_FILE_PATH',
    #                 os.path.join(site['db'], 'components', 'topoflow', 'files'))
    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
    src = find_simulation_input_file(env['site_prefix'] + '.rti')
    shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))
Esempio n. 11
0
def execute(env):
    os.mkdir('HYDRO_IN')
    os.mkdir('HYDRO_OUTPUT')

    os.rename('hydrotrend.in', 'HYDRO.IN')
    shutil.move('HYDRO.IN', 'HYDRO_IN')

    src = find_simulation_input_file(env['hypsometry_file'])

    shutil.copy(src, os.path.join('HYDRO_IN', 'HYDRO0.HYPS'))
Esempio n. 12
0
def execute(env):
    """Perform post-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    src = find_simulation_input_file(env["rti_file"])
    shutil.copy(src, os.path.join(os.curdir, env["site_prefix"] + ".rti"))
Esempio n. 13
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['_run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])
    env['save_profile_dt'] = float(env['dt'])
    env['save_cube_dt'] = float(env['dt'])
    env['n_layers'] = 1  # my choice

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    assign_parameters(env, file_list)

    env['soil_0_type'] = lowercase_choice(env['soil_0_type'])
    env['soil_1_type'] = lowercase_choice(env['soil_1_type'])
    env['soil_2_type'] = lowercase_choice(env['soil_2_type'])

    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
    src = find_simulation_input_file(env['site_prefix'] + '.rti')
    shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    for var in ('Ks_val_0', 'Ki_val_0', 'qs_val_0', 'qi_val_0', 'qr_val_0', 
                'pB_val_0', 'pA_val_0', 'lam_val_0', 'c_val_0', 'Ks_val_1',
                'Ki_val_1', 'qs_val_1', 'qi_val_1', 'qr_val_1', 'pB_val_1',
                'pA_val_1', 'lam_val_1', 'c_val_1', 'Ks_val_2', 'Ki_val_2',
                'qs_val_2', 'qi_val_2', 'qr_val_2', 'pB_val_2', 'pA_val_2',
                'lam_val_2', 'c_val_2'):
        if env[var + '_ptype'] == 'Scalar':
            scalar_to_rtg_file(var, env)
Esempio n. 14
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['_run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    assign_parameters(env, file_list)

    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
    # src = find_simulation_input_file(env['site_prefix'] + '.rti')
    # shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    src = find_simulation_input_file(env['rti_file'])
    shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    for var in ('rho_H2O', 'Cp_air', 'rho_air', 'T_air', 'T_surf',
                'RH', 'p0', 'uz', 'z', 'z0_air', 'albedo', 'em_surf',
                'dust_atten', 'cloud_factor', 'canopy_factor'):
        if env[var + '_ptype'] == 'Scalar':
            scalar_to_rtg_file(var, env)

    if env['P_ptype'] != 'Grid_Sequence':
        to_rts_file('P', env)
Esempio n. 15
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['_run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])
    env['n_layers'] = 3  # my choice

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    assign_parameters(env, file_list)

    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
    # src = find_simulation_input_file(env['site_prefix'] + '.rti')
    # shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))
    src = find_simulation_input_file(env['flow_grid_file'])
    env['flow_grid_file'] = env['site_prefix'] + '_flow.rtg'
    shutil.copy(src, os.path.join(os.curdir, env['flow_grid_file']))

    src = find_simulation_input_file(env['rti_file'])
    shutil.copy(src, os.path.join(os.curdir, env['site_prefix'] + '.rti'))

    for var in ('elev', 'h0_table', 'd_freeze', 'd_thaw', 'Ks_0', 'qs_0',
                'th_0', 'Ks_1', 'qs_1', 'th_1', 'Ks_2', 'qs_2', 'th_2'):
        if env[var + '_ptype'] == 'Scalar':
            scalar_to_rtg_file(var, env)
Esempio n. 16
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])

    # TopoFlow needs site_prefix and case_prefix.
    env['site_prefix'] = os.path.splitext(env['rti_file'])[0]
    env['case_prefix'] = 'WMT'

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        file_list.remove('pixel_file')
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    assign_parameters(env, file_list)

    # If P_ptype is Scalar, replicate the scalar value as a Time_Series.
    # This works around the issue described in https://trello.com/c/LaOMPpOa.
    if env['P_ptype'] == 'Scalar':
        env['P_ptype'] = 'Time_Series'
        env['P_dtype'] = 'string'
        file_name = env['case_prefix'] + '_rain_rates.txt'
        time_series = np.ones(env['n_steps']) * float(env['P'])
        np.savetxt(file_name, time_series, fmt='%8.3f')
        env['P'] = env['P_file'] = file_name

    # yaml_dump('_env.yaml', env)  # helpful for debugging

    # Default files common to all TopoFlow components are stored with the
    # topoflow component metadata.
    prepend_to_path('WMT_INPUT_FILE_PATH',
                    os.path.join(site['db'], 'components', 'topoflow', 'files'))
    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
Esempio n. 17
0
def execute(env):
    """Perform post-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    for name in _DEFAULT_FILES:
        if env[name] != _DEFAULT_FILES[name]:
            try:
                os.remove(os.path.join(os.curdir, 'Forcing',
                                       _DEFAULT_FILES[name]))
            except OSError:
                pass

        src = find_simulation_input_file(env[name])
        shutil.copy(src, os.path.join(os.curdir, 'Forcing'))
Esempio n. 18
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['end_year'] = long(env['start_year']) + long(env['_run_duration']) - 1
    env['fn_out_filename'] = 'frostnumber_output.dat'

    assign_parameters(env, file_list)

    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)

    yaml_dump('_env.yaml', env)
Esempio n. 19
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    # TopoFlow needs site_prefix and case_prefix.
    env['site_prefix'] = os.path.splitext(env['rti_file'])[0]
    env['case_prefix'] = 'scenario'

    # Default files common to all TopoFlow components are stored with the
    # topoflow component metadata.
    prepend_to_path('WMT_INPUT_FILE_PATH',
                    os.path.join(site['db'], 'components', 'topoflow', 'files'))
    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
Esempio n. 20
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])

    # TopoFlow needs site_prefix and case_prefix.
    env['site_prefix'] = os.path.splitext(env['rti_file'])[0]    
    env['case_prefix'] = 'WMT'

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        file_list.remove('pixel_file')
        env['pixel_file'] = env['case_prefix'] + '_outlets.txt'

    if env['H0_file'] == 'off':
        file_list.remove('H0_file')
        env['H0_file'] = 'None'

    env['VARIABLE_DT_TOGGLE'] = choices_map[env['VARIABLE_DT_TOGGLE']]
    env['INIT_COND_TOGGLE'] = choices_map[env['INIT_COND_TOGGLE']]
    env['GENERIC_ICE_TOGGLE'] = choices_map[env['GENERIC_ICE_TOGGLE']]
    env['ICEFLOW_TOGGLE'] = choices_map[env['ICEFLOW_TOGGLE']]
    env['ICESLIDE_TOGGLE'] = choices_map[env['ICESLIDE_TOGGLE']]
    env['FREEZE_ON_TOGGLE'] = choices_map[env['FREEZE_ON_TOGGLE']]

    # Default files common to all TopoFlow components are stored with the
    # topoflow component metadata.
    prepend_to_path('WMT_INPUT_FILE_PATH',
                    os.path.join(site['db'], 'components', 'topoflow', 'files'))
    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)
Esempio n. 21
0
def execute(env):
    """Perform pre-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    env['n_steps'] = int(round(float(env['run_duration']) / float(env['dt'])))
    env['save_grid_dt'] = float(env['dt'])
    env['save_pixels_dt'] = float(env['dt'])

    # TopoFlow needs site_prefix and case_prefix.
    env['site_prefix'] = os.path.splitext(env['rti_file'])[0]
    env['case_prefix'] = 'scenario'

    # If no pixel_file is given, let TopoFlow make one.
    if env['pixel_file'] == 'off':
        file_list.remove('pixel_file')
        env['pixel_file'] = '_outlets.txt'

    # Translate the roughness choice to TopoFlow flags.
    env['MANNING'] = env['roughness_option'].startswith('Manning') * 1
    env['LAW_OF_WALL'] = 1 - env['MANNING']

    env['nval_type'] = env['z0val_type'] = env['roughness_type']
    env['nval_scalar'] = env['z0val_scalar'] = env['roughness_scalar']
    env['nval_file'] = env['z0val_file'] = env['roughness_file']    

    assign_parameter_type_and_value(env)

    # Default files common to all TopoFlow components are stored with the
    # topoflow component metadata.
    prepend_to_path('WMT_INPUT_FILE_PATH',
                    os.path.join(site['db'], 'components', 'topoflow', 'files'))
    for fname in file_list:
        src = find_simulation_input_file(env[fname])
        shutil.copy(src, os.curdir)