adjtomo/seisflows

plot2d can't set a specified cmap

Opened this issue · 1 comments

when I finish a workflow and I want to plot my GRADIENT_01 with a specified cmap, I use the following command:

$ seisflows plot2d GRADIENT_01 vp_kernel -c seismic

I get the error message:

Traceback (most recent call last):
File "/home/zhaox/anaconda3/envs/py311/bin/seisflows", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/zhaox/seisflows-master/seisflows/seisflows.py", line 1396, in main
sf()
File "/home/zhaox/seisflows-master/seisflows/seisflows.py", line 447, in call
getattr(self, self._args.command)(**vars(self._args))
File "/home/zhaox/seisflows-master/seisflows/seisflows.py", line 1118, in plot2d
plot_model.plot2d(parameter=parameter, cmap=cmap, show=True,
File "/home/zhaox/seisflows-master/seisflows/tools/model.py", line 585, in plot2d
zero_midpoint=zero_midpoint)
^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'zero_midpoint' where it is not associated with a value

It is because if I set the value of cmap, then the zero_midpoint will not be assigned a value.

I think it is easy to fix. Thx.

Hi @bzdzdxb, thanks for raising this issue, glad to see the plotter is being used! I will give this a look this week and get back to you!