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 # 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' 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)
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)
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)
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)
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)
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' # 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)