Add paragraph description of the module. What stages are defined here generally? Make a table with the main ones like in water tools?
Public API methods attached to model¶
The following methods are defined in the
init_tools class, of the
- class pyDeltaRCM.init_tools.init_tools¶
Creates the model domain
Model implementation variables.
Creates variables for model implementation, from specified boundary condition variables. This method is run during initial model instantition, but it is also run any time an inlet flow condition variable is changed, including channel_flow_velocity, channel_width, channel_flow_depth, and influx_sediment_concentration.
Set the random seed if given.
If a random seed is specified, set the seed to this value.
Writes the seed to the log for record.
Import the input files.
This method handles the parsing and validation of any options supplied via the configuration.
dict, optional) – A dictionary with keys matching valid model parameter names that can be specified in a configuration YAML file. Keys given in this dictionary will supercede values specified in the YAML configuration.
Initialize a logger.
The logger is initialized regardless of the value of
self.verbose. The level of information printed to the log depends on the verbosity setting.
Populate the list of metadata information.
Sets up the dictionary object for the standard metadata.
Creates a netCDF file to store output grids.
Fills with default variables.
Overwrites an existing netcdf file with the same name if
Initialize the output infrastructure (folder and save lists).
This method is the first called in the initialization of the DeltaModel, after the configuration variables have been imported.
Initialize the sediment router object here.
These are preinitialized because the “boxing” for jitted functions is expensive, so we avoid boxing up the constants on each iteration.
Initialize subsidence pattern.
Initializes patterns of subsidence if toggle_subsidence is True (default False). Default behavior is for the entire basin to subside at a constant rate (with the exception of the land boundary cells along the inlet boundary).
To customize the subsiding region, or even vary the subsiding region over the course of the model run, we recommend subclassing the DeltaModel class.
Load the checkpoint from the .npz file.
Uses the file at the path determined by self.prefix and a file named checkpoint.npz. There are a few pathways for loading, which depend on 1) the status of additional grid-saving options, 2) the presence of a netCDF output file at the expected output location, and 3) the status of the
defer_outputparameter passed to this method as an optional argument.
As a standard user, you should not need to worry about any of these pathways or options. However, if you are developing pyDeltaRCM or customizing the model in any way that involves loadind from checkpoints, you should be aware of these pathways.
For example, loading from checkpoint will succeed if no netCDF4 file is found, where one is expected (e.g., because
_save_any_gridsis True). In this case, a new output netcdf file will be created, after a UserWarning is issued.
If you are customing the model and intend to use checkpointing and the
Preprocessorparallel infrastructure, be sure that parameter
defer_outputis True until the
load_checkpointmethod can be called from the thread the model will execute on. Failure to do so may result in unexpected behavior with indexing in the output netCDF4 file.
bool, optional) – Whether to defer any netCDF activities at present. Manipulating this variable is critical for parallel operations. See note above. Default is False.
Process input file to model variables.
Loop through the items specified in the model configuration and apply them to the model (i.e.,
self). Additionally, write the input values specified into the log file.
self.resume_checkpoint == True, then the input values are not written to the log.
Set the model constants.