This repository has been archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Reasons for CLI
Norman Fomferra edited this page Aug 30, 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 <https://github.com/CCI-Tools/ect-core/wiki/Core-Processing-Requirements>
_
$ ect set aero2007 load name=AEROSOL_ATSR2_ORAC_L3_V3.02_MONTHLY time_range=2007
$ ect set cloud2007 extract 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
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) 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
- (+) possible to use the power of python (libraries, control structures)
- (+) no parsing to be developed, tested
- (+) rely on python documnetation (search for syntax errors)
- (-) syntax out-of-our-hands, in case of bad syntax pyhton is reporting the error (is this good or bad)
- (+) still possible to have a single command (for batch, if don't want to write *.py file)
$ 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); ..."
- (+-) foo
- (+-) bar
next