hook_tools

Todo

Add paragraph description of the module. What stages are defined here generally? Link to relevant documentation about hooks in user guide and model list.

Public API methods attached to model

The following methods are defined in the hook_tools class, of the pyDeltaRCM.hook_tools module.

hook_tools()

Tools defining various hooks in the model.

class pyDeltaRCM.hook_tools.hook_tools

Tools defining various hooks in the model.

For an explanation on model hooks, see the User Guide.

_check_deprecated_hooks()

Check for any old hooks that are defined.

Sometimes hook names need to be deprecated, due to changing underlying model mechanics or anything else. This may mean that an old hook is no longer called, but there is no way to warn the user about this. Therefore, we enforce that no old hooks may be used as method names of subclassing models.

This helper method is early in the DeltaModel __init__ routine.

hook_apply_subsidence()

Hook apply_subsidence.

Called immediately before apply_subsidence.

hook_compute_free_surface()

Hook compute_free_surface.

Called immediately before compute_free_surface.

hook_compute_sand_frac()

Hook compute_sand_frac.

Called immediately before compute_sand_frac.

hook_create_domain()

Hook create_domain.

Called immediately before create_domain.

hook_create_other_variables()

Hook create_other_variables.

Called immediately before create_other_variables.

hook_finalize_timestep()

Hook finalize_timestep.

Called immediately before finalize_timestep.

hook_finalize_water_iteration(iteration)

Hook finalize_water_iteration.

Called immediately before finalize_water_iteration.

hook_import_files()

Hook import_files.

Called immediately before import_files.

This is the recommended hook to use for defining custom yaml parameters for a subclassed model. To allow the model to successfully load custom yaml parameters, expected types and default values need to be provided as dictionary key-value pairs to the model attribute, subclass_parameters.

The expected format is:

self.subclass_parameters['custom_param'] = {
    'type': ['expected_type'], 'default': default_value}  # noqa: E501
hook_init_output_file()

Hook init_output_file.

Called immediately before init_output_file.

Expected format for entries to the meta dictionary nested within the self._save_var_list dictionary:

self._save_var_list['meta']['new_meta_name'] = ['varname', 'units',
                                                'type', (dimensions)]  # noqa: E501

Expected format for time-varying metadata entries to the meta dictionary nested within the self._save_var_list dictionary:

self._save_var_list['meta']['new_meta_attribute_name'] = [
    None, 'units', 'type', (dimensions)]  # noqa: E501

Note

For a vector of time-varying metadata, the dimension should be specified as (‘total_time’).

Expected format for time varying grid entries as keys within the self._save_var_list dictionary:

self._save_var_list['new_grid_name'] = ['varname', 'units',
                                        'type', (dimensions)]
hook_init_sediment_iteration()

Hook init_sediment_iteration.

Called immediately before init_sediment_iteration.

hook_init_water_iteration()

Hook init_water_iteration.

Called immediately before init_water_iteration.

hook_load_checkpoint()

Hook load_checkpoint.

Called immediately before load_checkpoint.

hook_output_checkpoint()

Hook output_checkpoint.

Called immediately before output_checkpoint.

hook_output_data()

Hook output_data.

Called immediately before output_data.

hook_process_input_to_model()

Hook process_input_to_model.

Called immediately before process_input_to_model.

hook_route_all_mud_parcels()

Hook route_all_mud_parcels.

Called immediately before route_all_mud_parcels.

hook_route_all_sand_parcels()

Hook route_all_sand_parcels.

Called immediately before route_all_sand_parcels.

hook_route_sediment()

Hook route_sediment.

Called immediately before route_sediment.

hook_route_water()

Hook route_water.

Called immediately before route_water.

hook_run_water_iteration()

Hook run_water_iteration.

Called immediately before run_water_iteration.

hook_solve_water_and_sediment_timestep()

Hook solve_water_and_sediment_timestep.

Called immediately before solve_water_and_sediment_timestep.

hook_topo_diffusion()

Hook topo_diffusion.

Called immediately before topo_diffusion.