Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Reasons for CLI

Marco Zühlke edited this page Aug 31, 2016 · 15 revisions

Every now and the we ask our self the question. Do we (or better: does the user) need a CLI for the CCI Toolbox ? This page should summarize all argument pro and contra a CLI.

See also: Core Processing Requirements.

Using the CLI

$ ect set aero2007 load name=AEROSOL_ATSR2_ORAC_L3_V3.02_MONTHLY time_range=2007
$ ect set cloud2007 load name=CLOUD_L3S_MERGED_PHASE1_V1.0 time_range=2007
$ ect set cloud2007ga ect.ops.coregister master=aero2007 slave=cloud2007 method=nearest
$ ect set movie ect.ops.animated_map ds=aero2007,cloud2007ga mode=multiple
$ ect save movie file=movie.gif
$ ect set correlation ect.ops.pearson ds1=aero2007_sub ds2=cloud2007_sub mode=grid_map
$ ect save correlation.map file=grid_correlation.png
$ ect save correlation.stat file=correlation_statistics.txt

Using the ECT REPL

The alternative solution to having a CLI would be to use python for all user interaction. Instead of allowing the user to interact with the CCI Toolbox from the command line he first would have to launch a python (ectpython, it would automatically do the ect imports) REPL to interact with.

$ ectpython
> aero2007 = ect.load(name=AEROSOL_ATSR2_ORAC_L3_V3.02_MONTHLY, time_range=2007)
> cloud2007 = ect.load(name=CLOUD_L3S_MERGED_PHASE1_V1.0, time_range=2007)
> cloud2007ga = ect.ops.coregister(master=aero2007, slave=cloud2007, method=nearest)
> movie = ect.ops.animated_map(ds=[aero2007,cloud2007ga], mode=multiple)
> ect.save(movie,file=movie.gif)
> correlation = ect.ops.pearson(ds1=aero2007_sub, ds2=cloud2007_sub, mode=grid_map)
> ect.save(correlation.map, file=grid_correlation.png)
> ect.save(correlation.stat, file=correlation_statistics.txt)

Arguments why we need a CLI indead of a REPL

  • (+) we control the syntax and the error message to the users. In case of the REPL we stick with the python syntax. Syntax errors are reported by the python parser. Especially for users without prior python knowledge this can be a problem.
  • (+) The REPL make single command from the Shell complicated. (if you don't want to write a *.py file)
    $ ectpython -c "aero2007 = ect.load(name=AEROSOL_ATSR2_ORAC_L3_V3.02_MONTHLY, time_range=2007);cloud2007 = ect.load(name=CLOUD_L3S_MERGED_PHASE1_V1.0, time_range=2007); ..."
  • (+) logging must happen within the individual operations. The CLI can handle this externally.
  • (-) possible to use the power of python (libraries, control structures)
  • (-) no parsing has to be developed, tested
  • (-) rely on python documentation (searching for syntax errors)