Skip to content

arg less main() for pip install -e #5

@yunjunz

Description

@yunjunz

It seems when installing mintpy using pip install -e MintPy, the command-line options are not working:

(insar) kyushu:~/data/offset4motion/SaltonSeaSenDT173/merged/test/20191220_20201220>$ view.py off3_snr.bip -v 0 100 --flip-lr
Traceback (most recent call last):
  File "/home/zyunjun/tools/miniconda3/envs/insar/bin/view.py", line 33, in <module>
    sys.exit(load_entry_point('mintpy', 'console_scripts', 'view.py')())
  File "/home/zyunjun/tools/MintPy/mintpy/view.py", line 1663, in main
    obj.configure()
  File "/home/zyunjun/tools/MintPy/mintpy/view.py", line 1538, in configure
    inps = cmd_line_parse(self.iargs)
  File "/home/zyunjun/tools/MintPy/mintpy/view.py", line 175, in cmd_line_parse
    geo_opt_names = list(set(geo_opt_names) & set(iargs))
TypeError: 'NoneType' object is not iterable

The solution could be using the sys.argv all the time as suggested in insarlab#652. view.py has the most complicated usage of iargs. If the following 3 scenarios works, then it should be safe to translate the rest of mintpy to arg less main() style:

  1. view.py velocity.h5 -v 0 3 --flip-lr # command line in terminal
  2. view.main('velocity.h5 -v 0 3 --flip-lr'.split()) # main function call in python
  3. view and tsview interactive jupyter notebook: https://github.com/insarlab/MintPy-tutorial/tree/main/visualization

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions