MTgeophysics / mtpy

Python toolbox for standard Magnetotelluric (MT) data analysis
GNU General Public License v3.0
145 stars 66 forks source link

Plot penetration depth 2d bug #104

Closed brenmous closed 4 years ago

brenmous commented 4 years ago

Originally reported by @kashkoulimohammad:

For plot penetration depth how I can define the frequency array? For example, my data has 31 frequencies but I can plot onl6 17 frequencies and this error is happend: "Traceback (most recent call last): File "pe_depth.py", line 12, in tick_params={'rotation':'vertical'}) File "/home/mkash/Downloads/mtpy-develop(1)/mtpy-develop/mtpy/imaging/penetration_depth2d.py", line 57, in plot2Dprofile plot.plot(tickparams, **kwargs) File "/home/mkash/Downloads/mtpy-develop(1)/mtpy-develop/mtpy/imaging/penetration.py", line 163, in plot (stations, periods, pen, ) = get_penetration_depth(pr.edi_list, int(period_index), whichrho=self._rho) File "/home/mkash/Downloads/mtpy-develop(1)/mtpy-develop/mtpy/imaging/penetration.py", line 530, in get_penetration_depth "Index out_of_range Error: period index must be less than number of periods in zeta.freq") Exception: Index out_of_range Error: period index must be less than number of periods in zeta.freq" I think if I define frequency array this problem will be solve.

brenmous commented 4 years ago

Specifying period indicies would cause an exception if the period index did not exist on all stations. It also causes issue because the period for each index may not be the same across all stations.

The new approach is to specify a list of periods in seconds and a tolerance. The nearest periods to the provided periods will be plotted. If the nearest found period is outside of tolerance, then it will be discarded and appear as a gap in the plot for that station.

Use the new 'selected_periods' and 'ptol' arguments in plot_penetration_depth2d.py.

brenmous commented 4 years ago

Testing on a branch, will be merged into develop when review is complete.