adjtomo/seisflows

error in creating parameter file

Closed this issue · 3 comments

I am trying to generate a new parameters.yaml file using the command seisflows setup -f as described in this tutorial but I am getting an error.

(myseisflows) ANayak-M13:practise_seisflows anayak$ seisflows -w /Users/anayak/FWI/practise_seisflows setup -f
usage: seisflows [-h] [-w [WORKDIR]] [-p [PARAMETER_FILE]]
                 {init,configure,swap,submit,restart,clean,par,sempar,check,setup,plot2d,plotst,print,reset,debug,examples} ...
seisflows: error: unrecognized arguments: -f

If I try without the argument -f, I get this error

(myseisflows) ANayak-M13:practise_seisflows anayak$ seisflows -w /Users/anayak/FWI/practise_seisflows setup 
Traceback (most recent call last):
  File "/Users/anayak/opt/anaconda3/envs/myseisflows/bin/seisflows", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/anayak/seisflows/seisflows/seisflows.py", line 1426, in main
    sf()
  File "/Users/anayak/seisflows/seisflows/seisflows.py", line 450, in __call__
    getattr(self, self._args.command)(**vars(self._args))
  File "/Users/anayak/seisflows/seisflows/seisflows.py", line 768, in setup
    workflow = import_seisflows(workdir=self._args.workdir,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/anayak/seisflows/seisflows/tools/config.py", line 185, in import_seisflows
    parameters = load_yaml(os.path.join(workdir, parameter_file))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/anayak/seisflows/seisflows/tools/config.py", line 105, in load_yaml
    with open(filename, 'r') as f:
         ^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/anayak/FWI/practise_seisflows/parameters.yaml'

If I make an empty file myself, I get a new error.

(myseisflows) ANayak-M13:practise_seisflows anayak$ seisflows -w /Users/anayak/FWI/practise_seisflows setup 
Traceback (most recent call last):
  File "/Users/anayak/opt/anaconda3/envs/myseisflows/bin/seisflows", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/anayak/seisflows/seisflows/seisflows.py", line 1426, in main
    sf()
  File "/Users/anayak/seisflows/seisflows/seisflows.py", line 450, in __call__
    getattr(self, self._args.command)(**vars(self._args))
  File "/Users/anayak/seisflows/seisflows/seisflows.py", line 768, in setup
    workflow = import_seisflows(workdir=self._args.workdir,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/anayak/seisflows/seisflows/tools/config.py", line 185, in import_seisflows
    parameters = load_yaml(os.path.join(workdir, parameter_file))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/anayak/seisflows/seisflows/tools/config.py", line 106, in load_yaml
    mydict = Dict(yaml.safe_load(f))
             ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable

Has anyone encountered this before ? Thanks very much for your help.

Hi @avinash07guddu, thanks for bringing this up, if you are using the devel branch of SeisFlows, then the tutorials have gone out of sync with the source code and the commands init and setup have been swapped, which might solve your issue (the change is also listed in this giant changelog, but it's pretty buried in there: #181).

At the moment I would suggest using the master branch of the code, as it will be the most stable. I am actively developing on the devel branch so things will be going out of sync until I push out a new PR.

Let me know if that works for you!

thanks, the master branch worked for me in successfully running that example. thanks very much for your help.

No problem, glad that worked!