Skip to content

Commit 71a8f25

Browse files
committed
Rename to redefine_graph
1 parent d95dad4 commit 71a8f25

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

docs/cli/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ The commands are:
1919
- :ref:`Validate Command <validate-command>`
2020
- :ref:`Patch Command <patch-command>`
2121
- :ref:`Requests Command <requests-command>`
22-
- :ref:`Redefine Command <redefine-command>`
22+
- :ref:`redefine_graph Command <redefine-command>`

docs/cli/redefine.rst renamed to docs/cli/redefine_graph.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.. _redefine-command:
1+
.. _redefine_graph-command:
22

3-
Redefine Command
4-
===============
3+
Redefine Graph Command
4+
======================
55

66
With this command, you can redefine the graph of a checkpoint file.
77
This is useful when you want to change / reconfigure the local-domain of a model, or rebuild with a new graph.
@@ -21,7 +21,7 @@ Subcommands allow for a graph to be made from a lat/lon coordinate file, boundin
2121

2222
.. code-block:: bash
2323
24-
% anemoi-inference redefine --help
24+
% anemoi-inference redefine_graph --help
2525
2626
Redefine the graph of a checkpoint file.
2727
@@ -49,19 +49,19 @@ Subcommands allow for a graph to be made from a lat/lon coordinate file, boundin
4949
Examples
5050
*********
5151

52-
Here are some examples of how to use the `redefine` command:
52+
Here are some examples of how to use the `redefine_graph` command:
5353

5454
#. Using a graph file:
5555

5656
.. code-block:: bash
5757
58-
anemoi-inference redefine path/to/checkpoint --graph path/to/graph
58+
anemoi-inference redefine_graph path/to/checkpoint --graph path/to/graph
5959
6060
#. Using a graph configuration:
6161

6262
.. code-block:: bash
6363
64-
anemoi-inference redefine path/to/checkpoint --graph_config path/to/graph_config
64+
anemoi-inference redefine_graph path/to/checkpoint --graph_config path/to/graph_config
6565
6666
.. note::
6767
The configuration of the existing graph can be found using:
@@ -85,19 +85,19 @@ Here are some examples of how to use the `redefine` command:
8585

8686
.. code-block:: bash
8787
88-
anemoi-inference redefine path/to/checkpoint --latlon path/to/latlon.npy
88+
anemoi-inference redefine_graph path/to/checkpoint --latlon path/to/latlon.npy
8989
9090
#. Using bounding box coordinates:
9191

9292
.. code-block:: bash
9393
94-
anemoi-inference redefine path/to/checkpoint --coords North West South East Resolution
94+
anemoi-inference redefine_graph path/to/checkpoint --coords North West South East Resolution
9595
9696
i.e.
9797

9898
.. code-block:: bash
9999
100-
anemoi-inference redefine path/to/checkpoint --coords 30.0 -10.0 20.0 0.0 0.1/0.1 --global_resolution n320
100+
anemoi-inference redefine_graph path/to/checkpoint --coords 30.0 -10.0 20.0 0.0 0.1/0.1 --global_resolution n320
101101
102102
103103
All examples can optionally save the updated graph and checkpoint using the `--save-graph` and `--output` options.
@@ -114,7 +114,7 @@ Redefine the checkpoint
114114

115115
.. code-block:: bash
116116
117-
anemoi-inference redefine path/to/checkpoint --coords 30.0 -10.0 20.0 0.0 0.1/0.1 --global_resolution n320 --save-graph path/to/updated_graph --output path/to/updated_checkpoint
117+
anemoi-inference redefine_graph path/to/checkpoint --coords 30.0 -10.0 20.0 0.0 0.1/0.1 --global_resolution n320 --save-graph path/to/updated_graph --output path/to/updated_checkpoint
118118
119119
Create the inference config
120120
---------------------------
@@ -157,4 +157,4 @@ Reference
157157
:module: anemoi.inference.__main__
158158
:func: create_parser
159159
:prog: anemoi-inference
160-
:path: redefine
160+
:path: redefine_graph

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ You may also have to install pandoc on MacOS:
153153
cli/inspect
154154
cli/patch
155155
cli/requests
156-
cli/redefine
156+
cli/redefine_graph
157157

158158
.. toctree::
159159
:maxdepth: 1

src/anemoi/inference/commands/redefine.py renamed to src/anemoi/inference/commands/redefine_graph.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def format_namespace_as_str(namespace: Namespace) -> str:
5252
return " ".join(args)
5353

5454

55-
class RedefineCmd(Command):
55+
class RedefineGraphCmd(Command):
5656
"""Redefine the graph of a checkpoint file."""
5757

5858
def add_arguments(self, command_parser: ArgumentParser) -> None:
@@ -89,19 +89,19 @@ def add_arguments(self, command_parser: ArgumentParser) -> None:
8989
command_parser.add_argument("--output", type=str, help="Path to save the updated checkpoint.", default=None)
9090

9191
def run(self, args: Namespace) -> None:
92-
"""Run the redefine command.
92+
"""Run the redefine_graph command.
9393
9494
Parameters
9595
----------
9696
args : Namespace
9797
The arguments passed to the command.
9898
"""
99-
from anemoi.inference.utils.redefine import create_graph_from_config
100-
from anemoi.inference.utils.redefine import get_coordinates_from_file
101-
from anemoi.inference.utils.redefine import get_coordinates_from_mars_request
102-
from anemoi.inference.utils.redefine import load_graph_from_file
103-
from anemoi.inference.utils.redefine import make_graph_from_coordinates
104-
from anemoi.inference.utils.redefine import update_checkpoint
99+
from anemoi.inference.utils.redefine_graph import create_graph_from_config
100+
from anemoi.inference.utils.redefine_graph import get_coordinates_from_file
101+
from anemoi.inference.utils.redefine_graph import get_coordinates_from_mars_request
102+
from anemoi.inference.utils.redefine_graph import load_graph_from_file
103+
from anemoi.inference.utils.redefine_graph import make_graph_from_coordinates
104+
from anemoi.inference.utils.redefine_graph import update_checkpoint
105105

106106
check_redefine_imports()
107107

@@ -116,7 +116,7 @@ def run(self, args: Namespace) -> None:
116116

117117
# Add command to history
118118
metadata.setdefault("history", [])
119-
metadata["history"].append(f"anemoi-inference redefine {format_namespace_as_str(args)}")
119+
metadata["history"].append(f"anemoi-inference redefine_graph {format_namespace_as_str(args)}")
120120

121121
# Create or load the graph
122122
if args.graph is not None:
@@ -162,4 +162,4 @@ def run(self, args: Namespace) -> None:
162162
LOG.info("Updated checkpoint saved to %s", model_path)
163163

164164

165-
command = RedefineCmd
165+
command = RedefineGraphCmd

src/anemoi/inference/runners/external_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
from ..decorators import main_argument
2525
from ..runners.default import DefaultRunner
26-
from ..utils.redefine import update_checkpoint
26+
from ..utils.redefine_graph import update_checkpoint
2727
from . import runner_registry
2828

2929
LOG = logging.getLogger(__name__)
File renamed without changes.

0 commit comments

Comments
 (0)