Model:Dakotathon: Difference between revisions
m (Update address) |
m (Text replacement - "{{End headertab}}" to "{{End headertab}} {{{{PAGENAME}}_autokeywords}}") |
||
(13 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
{{End a table}} | {{End a table}} | ||
{{Model identity2 | {{Model identity2 | ||
| | |ModelDomain=Terrestrial, Hydrology, Coastal, Marine, Geodynamic, Climate | ||
|Spatial dimensions=1D, 1.5D, 2D, 3D | |Spatial dimensions=1D, 1.5D, 2D, 3D | ||
|Spatialscale=Global, | |Spatialscale=Continental, Global, Grain-Scale, Landscape-Scale, Patch-Scale, Point-Based, Reach-Scale, Regional-Scale, Watershed-Scale | ||
|One-line model description=A Python API for the Dakota iterative systems analysis toolkit. | |One-line model description=A Python API for the Dakota iterative systems analysis toolkit. | ||
|Extended model description= | |Extended model description=Dakota is a software toolkit, developed at Sandia National Laboratories, that provides an interface between models and a library of analysis methods, including support for sensitivity analysis, uncertainty quantification, optimization, and calibration techniques. Dakotathon is a Python package that wraps and extends Dakota’s file-based user interface. It simplifies the process of configuring and running a Dakota experiment, and it allows a Dakota experiment to be scripted. Any model written in Python that exposes a Basic Model Interface (BMI), as well as any model componentized in the CSDMS modeling framework, automatically works with Dakotathon. Currently, six Dakota analysis methods have been implemented from the much larger Dakota library: | ||
* vector parameter study, | * vector parameter study, | ||
Line 37: | Line 37: | ||
|Last name=Piper | |Last name=Piper | ||
|Type of contact=Technical contact | |Type of contact=Technical contact | ||
|Institute / Organization=University of Colorado INSTAAR/CSDMS | |Institute / Organization=University of Colorado, INSTAAR/CSDMS | ||
|Postal address 1=450 UCB | |Postal address 1=450 UCB | ||
|Town / City=Boulder | |Town / City=Boulder | ||
Line 52: | Line 52: | ||
|Start year development=2015 | |Start year development=2015 | ||
|Does model development still take place?=Yes | |Does model development still take place?=Yes | ||
|DevelopmentCode=Active | |||
|DevelopmentCodeYearChecked=2020 | |||
|Model availability=As code | |Model availability=As code | ||
|Source code availability=Through web repository | |Source code availability=Through web repository | ||
Line 76: | Line 78: | ||
}} | }} | ||
{{Users groups model | {{Users groups model | ||
|Do you have current or future plans for collaborating with other researchers?=Any CSDMS member is welcome to fork the [https://github.com/csdms/dakota Dakotathon repository], make changes, and send a pull request back to the CSDMS Integration Facility. We | |Do you have current or future plans for collaborating with other researchers?=Any CSDMS member is welcome to fork the [https://github.com/csdms/dakota Dakotathon repository], make changes, and send a pull request back to the CSDMS Integration Facility. We appreciate any contribution! | ||
}} | }} | ||
{{Documentation model | {{Documentation model | ||
Line 93: | Line 95: | ||
{{End a table}} | {{End a table}} | ||
{{End headertab}} | {{End headertab}} | ||
{{{{PAGENAME}}_autokeywords}} | |||
'''Dakotathon''' provides a [http://dx.doi.org/10.1016/j.cageo.2012.04.002 Basic Model Interface] | |||
and a Python API for a subset of the methods included in the [https://dakota.sandia.gov/ Dakota] | |||
iterative systems analysis toolkit. | |||
Installation instructions and usage examples are provided below. | |||
Developer documentation is available at http://csdms-dakota.readthedocs.io. | |||
This is currently alpha-level software supported on Linux and Mac OSX. | |||
== Installation == | |||
Install Dakotathon into an Anaconda Python distribution with | |||
$ conda install -c csdms dakotathon | |||
or install from source with | |||
$ git clone https://github.com/csdms/dakota.git | |||
$ cd dakota | |||
$ python setup.py install | |||
Dakotathon requires Dakota. | |||
Follow the instructions on the Dakota website | |||
for [https://dakota.sandia.gov/download.html downloading] and | |||
[https://dakota.sandia.gov/content/install-linux-macosx installing] | |||
a precompiled Dakota binary for your system. | |||
Dakota version 6.1 is currently supported. | |||
== Execution: standalone == | |||
Import Dakotathon into a Python session with: | |||
from dakotathon import Dakota | |||
Create a `Dakota` instance, | |||
specifying a Dakota analysis method: | |||
d = Dakota(method='vector_parameter_study') | |||
To run a sample case, | |||
create a Dakota input file | |||
from the default vector parameter study | |||
and call Dakota: | |||
d.write_input_file() | |||
d.run() | |||
Dakota output is written to two files, | |||
'''dakota.out''' (run information) | |||
and | |||
'''dakota.dat''' (tabular output), | |||
in the current directory. | |||
For more in-depth examples of using the CSDMS Dakota interface, | |||
see the Jupyter Notebooks | |||
in the examples directory | |||
of the Dakotathon repository. | |||
=== Note === | |||
If you're using Anaconda IPython on Mac OS X, | |||
include the <code>DYLD_LIBRARY_PATH</code> environment variable | |||
in your session before calling the `run` method with: | |||
from dakotathon.utils import add_dyld_library_path | |||
add_dyld_library_path() | |||
See https://github.com/csdms/dakota/issues/17 for more information. | |||
== Execution: in PyMT == | |||
Dakotathon can also be called as a component in a WMT execution server | |||
where [https://github.com/csdms/pymt PyMT] has been installed. | |||
For example, | |||
to perform a centered parameter study on the Hydrotrend component, | |||
start with imports: | |||
import os | |||
from pymt.components import CenteredParameterStudy, Hydrotrend | |||
from dakotathon.utils import configure_parameters | |||
then create instances of the Hydrotrend and Dakota components: | |||
h, c = Hydrotrend(), CenteredParameterStudy() | |||
Next, | |||
set up a dict of parameters for the experiment: | |||
parameters = { | |||
'component': type(c).__name__, | |||
'run_duration': 365, # days | |||
'auxiliary_files': 'HYDRO0.HYPS', # the default Waipaoa hypsometry | |||
'descriptors': ['starting_mean_annual_temperature', | |||
'total_annual_precipitation'], | |||
'initial_point': [15.0, 2.0], | |||
'steps_per_variable': [2, 5], | |||
'step_vector': [2.5, 0.2], | |||
'response_descriptors': ['channel_exit_water_sediment~suspended__mass_flow_rate', | |||
'channel_exit_water__volume_flow_rate'], | |||
'response_statistics': ['median', 'mean'] | |||
} | |||
and use a helper function | |||
to format the parameters for Dakota and Hydrotrend: | |||
cparameters, hparameters = configure_parameters(parameters) | |||
Set up the Hydrotrend component: | |||
cparameters['run_directory'] = h.setup(os.getcwd(), **hparameters) | |||
Create the Dakota template file from the Hydrotrend input file: | |||
cfg_file = 'HYDRO.IN' | |||
dtmpl_file = cfg_file + '.dtmpl' | |||
os.rename(cfg_file, dtmpl_file) | |||
cparameters['template_file'] = dtmpl_file | |||
Set up the Dakota component: | |||
c.setup(dparameters['run_directory'], **cparameters) | |||
then initialize, run, and finalize the Dakota component: | |||
c.initialize('dakota.yaml') | |||
c.update() | |||
c.finalize() | |||
Dakota output is written to two files, | |||
'''dakota.out''' (run information) | |||
and | |||
'''dakota.dat''' (tabular output), | |||
in the current directory. | |||
For more in-depth examples of using Dakotathon with PyMT, | |||
see the Python scripts | |||
in the examples directory | |||
of the Dakotathon repository. |
Latest revision as of 20:17, 16 September 2020
Dakotathon
Metadata
|
|
Dakotathon provides a Basic Model Interface and a Python API for a subset of the methods included in the Dakota iterative systems analysis toolkit. Installation instructions and usage examples are provided below. Developer documentation is available at http://csdms-dakota.readthedocs.io.
This is currently alpha-level software supported on Linux and Mac OSX.
Installation
Install Dakotathon into an Anaconda Python distribution with
$ conda install -c csdms dakotathon
or install from source with
$ git clone https://github.com/csdms/dakota.git $ cd dakota $ python setup.py install
Dakotathon requires Dakota. Follow the instructions on the Dakota website for downloading and installing a precompiled Dakota binary for your system. Dakota version 6.1 is currently supported.
Execution: standalone
Import Dakotathon into a Python session with:
from dakotathon import Dakota
Create a `Dakota` instance, specifying a Dakota analysis method:
d = Dakota(method='vector_parameter_study')
To run a sample case, create a Dakota input file from the default vector parameter study and call Dakota:
d.write_input_file() d.run()
Dakota output is written to two files, dakota.out (run information) and dakota.dat (tabular output), in the current directory.
For more in-depth examples of using the CSDMS Dakota interface, see the Jupyter Notebooks in the examples directory of the Dakotathon repository.
Note
If you're using Anaconda IPython on Mac OS X,
include the DYLD_LIBRARY_PATH
environment variable
in your session before calling the `run` method with:
from dakotathon.utils import add_dyld_library_path add_dyld_library_path()
See https://github.com/csdms/dakota/issues/17 for more information.
Execution: in PyMT
Dakotathon can also be called as a component in a WMT execution server where PyMT has been installed. For example, to perform a centered parameter study on the Hydrotrend component, start with imports:
import os from pymt.components import CenteredParameterStudy, Hydrotrend from dakotathon.utils import configure_parameters
then create instances of the Hydrotrend and Dakota components:
h, c = Hydrotrend(), CenteredParameterStudy()
Next, set up a dict of parameters for the experiment:
parameters = { 'component': type(c).__name__, 'run_duration': 365, # days 'auxiliary_files': 'HYDRO0.HYPS', # the default Waipaoa hypsometry 'descriptors': ['starting_mean_annual_temperature', 'total_annual_precipitation'], 'initial_point': [15.0, 2.0], 'steps_per_variable': [2, 5], 'step_vector': [2.5, 0.2], 'response_descriptors': ['channel_exit_water_sediment~suspended__mass_flow_rate', 'channel_exit_water__volume_flow_rate'], 'response_statistics': ['median', 'mean'] }
and use a helper function to format the parameters for Dakota and Hydrotrend:
cparameters, hparameters = configure_parameters(parameters)
Set up the Hydrotrend component:
cparameters['run_directory'] = h.setup(os.getcwd(), **hparameters)
Create the Dakota template file from the Hydrotrend input file:
cfg_file = 'HYDRO.IN' dtmpl_file = cfg_file + '.dtmpl' os.rename(cfg_file, dtmpl_file) cparameters['template_file'] = dtmpl_file
Set up the Dakota component:
c.setup(dparameters['run_directory'], **cparameters)
then initialize, run, and finalize the Dakota component:
c.initialize('dakota.yaml') c.update() c.finalize()
Dakota output is written to two files, dakota.out (run information) and dakota.dat (tabular output), in the current directory.
For more in-depth examples of using Dakotathon with PyMT, see the Python scripts in the examples directory of the Dakotathon repository.