Model plugins
Plugin classes for non-componentized models that can be called by Dakota.
Plugins base class
An abstract base class for all Dakota model plugins.
-
class
dakotathon.plugins.base.
PluginBase
(**kwargs)[source]
Bases: object
Describe features common to all Dakota plugins.
-
calculate
()[source]
Calculate Dakota response functions.
-
call
()[source]
Call the model through the shell.
-
load
(output_file)[source]
Read data from a model output file.
- output_file : str
- The path to a model output file.
- array_like
- A numpy array, or None on an error.
-
setup
(config)[source]
Configure model inputs.
Sets attributes using information from the run configuration
file. The Dakota parsing utility dprepro
reads parameters
from Dakota to create a new input file from a template.
- config : dict
- Stores configuration settings for a Dakota experiment.
-
write
(params_file, results_file)[source]
Write a Dakota results file.
- params_file : str
- A Dakota parameters file.
- results_file : str
- A Dakota results file.
-
dakotathon.plugins.base.
write_dflt_file
(tmpl_file, parameters_file, run_duration=1.0)[source]
Create a model input file populated with default values.
- tmpl_file : str
- The path to the template file defined for the model.
- parameters_file : str
- The path to the parameters file defined for the model.
- run_duration : str, int, or float
- Simulation run length, in undetermined units (default is 1.0).
- str or None
- The path to the new dflt file, or None on an error.
-
dakotathon.plugins.base.
write_dtmpl_file
(tmpl_file, dflt_input_file, parameter_names)[source]
Create a template input file for use by Dakota.
In the CSDMS framework, the tmpl file is an input file for a
model, but with the parameter values replaced by
{parameter_name}. Dakota uses the same idea. This function
creates a Dakota dtmpl file from a CSDMS model tmpl file. Only
the parameters used by Dakota are left in the tmpl format; the
remainder are populated with default values for the model. The
dtmpl file is written to the current directory.
- tmpl_file : str
- The path to the template file defined for the model.
- dflt_input_file : str
- An input file that contains the default parameter values for a
model.
- parameter_names : list of str
- A list of parameter names for the model to be evaluated by
Dakota.
- str or None
- The path to the new dtmpl file, or None on an error.
HydroTrend
Provides a Dakota interface to the HydroTrend model.
-
class
dakotathon.plugins.hydrotrend.
HydroTrend
(input_dir='HYDRO_IN', output_dir='HYDRO_OUTPUT', input_file='HYDRO.IN', input_template='HYDRO.IN.dtmpl', hypsometry_file='HYDRO0.HYPS', output_files=None, output_statistics=None, **kwargs)[source]
Bases: dakotathon.plugins.base.PluginBase
Represent a HydroTrend simulation in a Dakota experiment.
-
__init__
(input_dir='HYDRO_IN', output_dir='HYDRO_OUTPUT', input_file='HYDRO.IN', input_template='HYDRO.IN.dtmpl', hypsometry_file='HYDRO0.HYPS', output_files=None, output_statistics=None, **kwargs)[source]
Configure a default HydroTrend simulation.
- input_dir : str, optional
- HydroTrend input directory (default is ‘HYDRO_IN’).
- output_dir : str, optional
- HydroTrend output directory (default is ‘HYDRO_OUTPUT’).
- input_file : str, optional
- HydroTrend input file (default is ‘HYDRO.IN’).
- input_template : str, optional
- Dakota template formed from HydroTrend input file (default
is ‘HYDRO.IN.dtmpl’).
- hypsometry_file : str, optional
- The hypsometry file for the HydroTrend experiment.
- output_files : str or list or tuple of str, optional
- HydroTrend output files to analyze.
- output_statistics : str or list or tuple of str, optional
- Statistics to apply to HydroTrend output.
- **kwargs
- Optional keyword arguments.
Create a HydroTrend instance with:
-
calculate
()[source]
Calculate Dakota output functions.
-
call
()[source]
Invoke HydroTrend through the shell.
-
load
(output_file)[source]
Read a column of data from a HydroTrend output file.
- output_file : str
- The path to a text HydroTrend output file.
- array_like
- A numpy array, or None on an error.
-
setup
(config)[source]
Configure HydroTrend inputs.
Sets attributes using information from the run configuration
file. The Dakota parsing utility dprepro
reads parameters
from Dakota to create a new HydroTrend input file from a
template.
- config : dict
- Stores configuration settings for a Dakota experiment.
-
setup_directories
(config)[source]
Configure HydroTrend input and output directories.
- config : dict
- Configuration settings for a Dakota experiment.
-
setup_files
(config)[source]
Configure HydroTrend input and output files.
- config : dict
- Configuration settings for a Dakota experiment.
-
write
(params_file, results_file)[source]
Write the Dakota results file.
- params_file : str
- A Dakota parameters file.
- results_file : str
- A Dakota results file.
-
dakotathon.plugins.hydrotrend.
is_installed
()[source]
Check whether HydroTrend is in the execution path.