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)
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)
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)
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']
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"]
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)
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)
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)