MTgeophysics / mtpy

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

Penetration Depth3D not working when the selected frequency is not present in every EDI file #66

Closed zhang01GA closed 5 years ago

zhang01GA commented 6 years ago

The mtpy/imaging/penetration.py, class Depth3D has a check_period_value, which may cause "ERROR: Periods are NOT equal !!!" problem.

Expected Behavior

If this error happens, use interpolation, or ignore the EDI-files that do not have the period.

Current Behavior

The system log an error and raise exception.

Possible Solution

Add interpolation if it makes sense to do so. Otherwise, just ignore the EDI files and use only those EDI files which have the period selected.

Steps to Reproduce (for bugs)

from mtpy.imaging import penetration_depth3d as pen3d

edi_path = r'C:\mtpywin\mtpy\Alison_penetrationDepth3D\EDI_files'
savepath = r'C:/tmp'

Create plot for period index number 1,2,... 10_

pen3d.plot_latlon_depth_profile(edi_path, 10 , 'det', showfig=True, savefig=True, savepath=savepath,fontsize=11, fig_dpi=400, file_format='png')

If you use a period float value, not the index integer, you will be fine:

pen3d.plot_latlon_depth_profile(edi_path, 10922.63,'det', showfig=True, savefig=True, savepath=savepath,fontsize=11, fig_dpi=400, file_format='png')

pen3d.plot_latlon_depth_profile(edi_path, 42.666,'det', showfig=True, savefig=True, savepath=savepath,fontsize=11, fig_dpi=400, file_format='png')

zhang01GA commented 5 years ago

the script checks if the periods of the set of EDI files are identical. If not, user must specify a period, not period index number, to create penetration depth plotting.