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() None

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_after_create_domain() None

Hook called after create_domain.

Unlike the standard model hooks, this hook is called after the domain has been created with the method create_domain

hook_after_finalize_timestep() None

Hook called after finalize_timestep.

Unlike the standard model hooks, this hook is called after the finalize timestep method has completed.

Hint

This is the last method called before logging and outputting data for each timestep.

hook_after_route_sediment() None

Hook called after route_sediment.

Unlike the standard model hooks, this hook is called after sed routing has completed with the method route_sediment

hook_after_route_water() None

Hook called after route_water.

Unlike the standard model hooks, this hook is called after water routing has completed with the method route_water

hook_apply_subsidence() None

Hook apply_subsidence.

Called immediately before apply_subsidence.

hook_compute_free_surface() None

Hook compute_free_surface.

Called immediately before compute_free_surface.

hook_compute_sand_frac() None

Hook compute_sand_frac.

Called immediately before compute_sand_frac.

hook_create_domain() None

Hook create_domain.

Called immediately before create_domain.

hook_create_other_variables() None

Hook create_other_variables.

Called immediately before create_other_variables.

hook_finalize_timestep() None

Hook finalize_timestep.

Called immediately before finalize_timestep.

hook_finalize_water_iteration(iteration: int) None

Hook finalize_water_iteration.

Called immediately before finalize_water_iteration.

hook_import_files() None

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() None

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() None

Hook init_sediment_iteration.

Called immediately before init_sediment_iteration.

hook_init_water_iteration() None

Hook init_water_iteration.

Called immediately before init_water_iteration.

hook_load_checkpoint() None

Hook load_checkpoint.

Called immediately before load_checkpoint.

hook_output_checkpoint() None

Hook output_checkpoint.

Called immediately before output_checkpoint.

hook_output_data() None

Hook output_data.

Called immediately before output_data.

hook_process_input_to_model() None

Hook process_input_to_model.

Called immediately before process_input_to_model.

hook_route_all_mud_parcels() None

Hook route_all_mud_parcels.

Called immediately before route_all_mud_parcels.

hook_route_all_sand_parcels() None

Hook route_all_sand_parcels.

Called immediately before route_all_sand_parcels.

hook_route_sediment() None

Hook route_sediment.

Called immediately before route_sediment.

hook_route_water() None

Hook route_water.

Called immediately before route_water.

hook_run_water_iteration() None

Hook run_water_iteration.

Called immediately before run_water_iteration.

hook_solve_water_and_sediment_timestep() None

Hook solve_water_and_sediment_timestep.

Called immediately before solve_water_and_sediment_timestep.

hook_topo_diffusion() None

Hook topo_diffusion.

Called immediately before topo_diffusion.