-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#162 Merge branch 'main' of github.com:NOAA-GFDL/fre-cli into 162.fi…
…x-yaml-overwrites
- Loading branch information
Showing
56 changed files
with
1,790 additions
and
546 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
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
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 |
---|---|---|
@@ -1,6 +1,13 @@ | ||
.. NEEDS UPDATING #TODO | ||
``combine-yamls`` | ||
----------------- | ||
|
||
* placehold | ||
``fre yamltools combine-yamls [options]`` | ||
- Purpose: Creates a combined yaml file for either compilation or post-processing. | ||
If `--use compile`, the model yaml is combined with the compile and platforms yaml. | ||
If `--use pp`, the model yaml is combined with post-processing yamls. | ||
- Options: | ||
- `-y, --yamlfile [experiment yaml] (required)` | ||
- `-e, --experiment [experiment name]` | ||
- `-p, --platform [platform] (required)` | ||
- `-t, --target [target] (required)` | ||
- `--use [compile|pp] (required)` |
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
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
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
Empty file.
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,64 @@ | ||
from analysis_scripts import available_plugins | ||
import click | ||
|
||
from .subtools import install_analysis_package, list_plugins, run_analysis, \ | ||
uninstall_analysis_package | ||
|
||
|
||
@click.group(help=click.style(" - access fre analysis subcommands", fg=(250, 154, 90))) | ||
def analysis_cli(): | ||
"""Entry point to fre analysis click commands.""" | ||
pass | ||
|
||
|
||
@analysis_cli.command() | ||
@click.option("--url", type=str, required=True, help="URL of the github repository.") | ||
@click.option("--name", type=str, required=False, help="Subdirectory to pip install.") | ||
@click.option("--library-directory", type=str, required=False, | ||
help="Path to a custom lib directory.") | ||
def install(url, name, library_directory): | ||
"""Installs an analysis package.""" | ||
install_analysis_package(url, name, library_directory) | ||
|
||
|
||
@analysis_cli.command() | ||
@click.option("--library-directory", type=str, required=False, | ||
help="Path to a custom lib directory.") | ||
def list(library_directory): | ||
"""List available plugins.""" | ||
plugins = list_plugins(library_directory) | ||
if plugins: | ||
print("Installed analysis packages:\n") | ||
for plugin in plugins: | ||
print(plugin) | ||
else: | ||
print("No analysis packages found.") | ||
|
||
|
||
@analysis_cli.command() | ||
@click.option("--name", type=str, required=True, help="Name of the analysis script.") | ||
@click.option("--catalog", type=str, required=True, help="Path to the data catalog.") | ||
@click.option("--output-directory", type=str, required=True, | ||
help="Path to the output directory.") | ||
@click.option("--output-yaml", type=str, required=True, help="Path to the output yaml.") | ||
@click.option("--experiment-yaml", type=str, required=True, help="Path to the experiment yaml.") | ||
@click.option("--library-directory", type=str, required=False, | ||
help="Path to a custom lib directory.") | ||
def run(name, catalog, output_directory, output_yaml, experiment_yaml, | ||
library_directory): | ||
"""Runs the analysis script and writes the paths to the created figures to a yaml file.""" | ||
run_analysis(name, catalog, output_directory, output_yaml, experiment_yaml, | ||
library_directory) | ||
|
||
|
||
@analysis_cli.command() | ||
@click.option("--name", type=str, required=True, help="Name of package to uninstall.") | ||
@click.option("--library-directory", type=str, required=False, | ||
help="Path to a custom lib directory.") | ||
def uninstall(name, library_directory): | ||
"""Uninstall an analysis package.""" | ||
uninstall_analysis_package(name, library_directory) | ||
|
||
|
||
if __name__ == "__main__": | ||
analysis_cli() |
Oops, something went wrong.