forked from OSeMOSYS/otoole
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.. _convert: | ||
|
||
========== | ||
Python API | ||
========== | ||
|
||
otoole also provides a Python API to access all the features available from the command line tool. | ||
|
||
Converting between formats | ||
-------------------------- | ||
|
||
``otoole`` currently supports conversion between the following formats: | ||
|
||
- Excel | ||
- A folder of CSV files | ||
- GNU MathProg datafile | ||
|
||
>>> from otoole import convert | ||
>>> convert('my_model.yaml', 'excel', 'csv', 'my_model.xlsx', 'my_model_csvs') | ||
|
||
See :py:func:`otoole.convert.convert` for more details | ||
|
||
Converting solver results to a folder of CSV files | ||
-------------------------------------------------- | ||
|
||
The ``convert_results`` function creates a folder of CSV result files from a CBC_, CLP_, | ||
Gurobi_ or CPLEX_ solution file:: | ||
|
||
>>> from otoole import convert_results | ||
>>> convert_results('my_model.yaml', 'cbc', 'csv', 'my_model.sol', 'my_model_csvs', input_datafile='my_model.dat') | ||
|
||
See :func:`otoole.convert.convert_results` for more details | ||
|
||
.. _CBC: https://github.com/coin-or/Cbc | ||
.. _CLP: https://github.com/coin-or/Clp | ||
.. _CPLEX: https://www.ibm.com/products/ilog-cplex-optimization-studio/cplex-optimizer | ||
.. _Gurobi: https://www.gurobi.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters