Skip to content

Commit 6a96b7e

Browse files
committed
Update to the toolbox docs
1 parent 7dabd4f commit 6a96b7e

File tree

3 files changed

+56
-71
lines changed

3 files changed

+56
-71
lines changed

docs/source/user_guide/api_toolbox.rst

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,24 @@ Tools will sit under the following categories: Results Analysis, Model Build, Mo
1313

1414
These tools act as standalone scripts. To run them, please read the available documentation for each tool.
1515

16-
.. _fmapi_toolbox_cli:
16+
.. _fmapi_toolbox:
1717

18-
fmapi-toolbox cli
19-
-----------------
18+
fmapi-toolbox
19+
-------------
2020

21-
.. _how_to_run_a_tool:
21+
A tool to use in the command line to interact with all the API toolbox scripts.
22+
23+
You can use these command line arguements:
24+
25+
- *-l* or *-list* : list all toolbox scripts installed
26+
- *-ld* or *-list-detailed* : list all toolbox scripts installed including usage
27+
- *-r* or *-register* : register a new tool to the fmapi-toolbox
28+
29+
.. _run_a_tool:
30+
31+
Run a tool
32+
----------
2233

23-
How to run a tool
24-
-----------------
2534
Tools can be run from the command line or from code:
2635

2736
.. note::
@@ -43,33 +52,48 @@ Tools can be run from the command line or from code:
4352
name="model_name",
4453
)
4554
46-
.. _how_edit_existing_tool:
55+
.. _edit_existing_tool:
56+
57+
Edit an existing tool
58+
---------------------
4759

48-
How to edit an existing tool
49-
----------------------------
60+
You can edit previously existing tools for the Flood Modeller API.
5061

51-
.. _how_to_add_a_new_tool:
62+
Go to the scripts folder and select the tool you want to edit, then change what you want to.
5263

53-
How to add a new tool
54-
---------------------
64+
.. _add_a_new_tool:
65+
66+
Add a new tool
67+
--------------
5568

5669
You can develop your own tools to integrate with the Flood Modeller Python API.
5770

5871
There are a few conventions you need to follow to do this:
5972

60-
- Add a python file to one of the directories in the toolbox
61-
- Within the file, define the tool as single function
73+
- Add a python file to one of the directories in the toolbox, depending on the category of the tool
74+
- Within the file, define the tool as a single function (add a definition file)
6275
- Within the same file, create a child class of FMTool, passing in the tool name and description, funciton to be run and the function parameters
76+
- Register the file as a script
77+
78+
See the *example_tool.py* script in the toolbox for an example of how to do this.
79+
80+
.. _add_new_execution_method:
6381

64-
See the *example_tool.py* script for an example of how to do this.
82+
Add a new execution method
83+
--------------------------
6584

66-
**Create the code**
85+
You can add command-line execution for a tool by having its *.py* and *.bat* scripts in the *scripts* folder.
6786

68-
**Add a definition file**
87+
.. code:: python
6988
70-
**Register it as a script**
89+
example.py
90+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91+
from floodmodeller_api.toolbox import Example
92+
Example().run_from_command_line()
7193
72-
.. _how_to_add_new_execution_method:
94+
.. code:: console
7395
74-
How to add a new execution method
75-
---------------------------------
96+
example.bat
97+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98+
@echo off
99+
python "%~dp0\example.py" %*

docs/source/user_guide/list_of_api_tools.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,14 @@ Or you can use it from your code:
3838
tcf_path="path/to/tcf.tcf",
3939
folder="path/to/model",
4040
name="model_name",
41-
)
41+
)
42+
43+
.. _raise_section_bed_levels:
44+
45+
raise_section_bed_levels
46+
------------------------
47+
48+
.. _interactive_flow_graph:
49+
50+
interactive_flow_graph
51+
----------------------

sample_scripts/test.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)