Kamodo-CLI

The kamodo command-line interface should be installed automatically with pip

pip install kamodo

Warning

The command line app is a work in progress. Expect changes!

Note

You can run these examples in a notebook with !kamodo

Run the command line interface with

kamodo <key>.<subkey>=value

instantiation

To create a simple function ready for evaluation:

kamodo model.params.f[cm]=x**2
     lhs   rhs symbol units
f(x)   f  x**2   f(x)    cm
\begin{equation}f{\left(x \right)} [cm] = x^{2}\end{equation}

Kamodo will print a description of the loaded model when verbose output is on (the default).

evaluation

To evaluate a model, provide arguments for each function.

kamodo model.params.f[cm]=x**2 model.evaluate.f.x=[-3,-1,1,3] verbose=false
f(x=[-3, -1, 1, 3]) cm = 

[9 1 1 9]

visualization

To visualize model output, provide plot parameters similar to evaluation

kamodo model.params.f[cm]=x**2 model.plot.f.x.min=-2 model.plot.f.x.max=2 model.plot.f.x.n=25 verbose=False

An interactive plot will open with your figure

Kamodofied models

To work with a kamodofied model, specify the model.class.

kamodo model.class=kamodo.readers.tiegcm.TIEGCM_Kamodo model.params.filename=$PWD/s001.nc  model.plot.EFLUX.lon=[0]

Screenshot

Configuration

Kamodo can use configuration files so that arguments do not have to be passed manually. To create your own configuration, create a config.yaml file in your project's directory:


Running kamodo from a directory containing the above config.yaml will produce the same plot as before:

! kamodo
     lhs   rhs symbol units
f(x)   f  x**2   f(x)    cm
\begin{equation}f{\left(x \right)} [cm] = x^{2}\end{equation}

Configuration Priority

Kamodo is built on hydra, which prioritizes configuration using the following rules:

  1. If there are two configurations that define the same value, the second one would win.
  2. If two configurations are contributing to the same dictionary the result would be the combined dictionary.

Help

kamodo --help
A low-coding command line interface for Kamodo

This application allows users to work with kamodo-compatible models and data
directly from the command line. 

Custom models, data, and expressions may be composed by editing config files
without needing to write python.

== Configuration groups ==
Compose your configuration from those groups (group=option)

== Config ==
Override anything in the config (foo.bar=value)
model:
  class: kamodo.Kamodo
  evaluate: {}
  fig_layout: {}
  params: {}
  plot: {}
  plot_conf:
    animation_opts: null
    auto_open: true
    auto_play: true
    config: null
    filename: temp-plot.html
    image: null
    image_filename: plot_image
    include_mathjax: cdn
    include_plotlyjs: true
    link_text: Export to plot.ly
    output_type: file
    show_link: false
    validate: true
verbose: true

Powered by Hydra (https://hydra.cc)
Use --hydra-help to view Hydra specific help

tab completion

Kamodo supports tab completion for bash. To set up bash tab completion, run the following:

eval "$(kamodo -sc install=bash)"