def image_edi(datadir): """ image """ edi_file = datadir + r"edifiles2\15125A.edi" save_file = datadir + 'penetration_depth1d.png' edi_path = datadir + 'edifiles' savepath = datadir pd1d.plot_edi_file(edi_file, savefile=save_file, fig_dpi=400) # Choose indices of periods to plot period_index_list = [0, 1, 10, 20, 30, 40, 50, 59] # Plot profiles for different modes ('det','zxy' or 'zyx') pen2d.plot2Dprofile(edi_path, period_index_list, 'det', marker='o', tick_params={'rotation': 'vertical'}) # Create plot for period index number 10 for determinant pen3d.plot_latlon_depth_profile(edi_path, 10, 'det', showfig=True, savefig=True, savepath=savepath, fontsize=11, fig_dpi=400, file_format='png')
def plot_penetration_depth(input, output_file): if os.path.isfile(input): pd1d.plot_edi_file(input,savefile=output_file) elif os.path.isdir(input): pd1d.plot_edi_dir(input, rholist=['det']) else: pass
def test_plot_edi_file_empty_rholist(self): """ testing plotting an empty rholist of a single edi file :return: """ with self.assertRaises(ZComponentError): plot_edi_file("data/edifiles/15125A.edi", [])
def test_plot_edi_file_save_image(self): """ testing saving plot of a single edi file :return: """ fname = os.path.join(self._temp_dir, "TestPenetration_depth1d.png") if os.path.isfile(fname): os.remove(fname) # remove test file if already exist plot_edi_file("data/edifiles/15125A.edi", savefile=fname) assert (os.path.isfile(fname))
# -*- coding: utf-8 -*- """ Plot Penetration Depth from EDI files Example how to use the module mtpy.imaging import penetration_depth1d as pd1d Created on Wed Nov 08 12:04:38 2017 @author: u64125 """ import os, sys from mtpy.imaging import penetration_depth1d as pd1d #edipath = r'C:\Git\mtpy\examples\data\edi_files' # avoid using \ edipath = r'E:/mtpywin/mtpy/examples/data/edi_files/pb23c.edi' # / is Unix and Win-Dos compatible # or get this variable from the cmdline: edipath = sys.argv[1] if os.path.isfile(edipath): pd1d.plot_edi_file(edipath, savefile='C:/temp/pen_depth.jpg') # rholist can be any of ['zxy','zyx','det'], default all of them elif os.path.isdir(edipath): # plot_edi_dir(edi_path ) pd1d.plot_edi_dir(edipath, rholist=['det'])
except: print( "Warn: The environment variable MTPY_ROOT is not defined. We will guess" ) mtpy_path = os.path.abspath('../..') if not os.path.isdir(mtpy_path): raise Exception("the guessed mtpy dir %s is not a folder!" % mtpy_path) # change the variable below according to your edi files folder !!! # edidir = r'C:/mtpywin/mtpy/data/edifiles' # / is Unix and Win-Dos compatible # or get this variable from the cmdline: edidir = sys.argv[1] edipath = os.path.join(mtpy_path, 'examples/data/edi_files_2/Synth00.edi') # savepath = r'C:\tmp' temp_dir = tempfile.gettempdir() print('Using temporary directory ' + temp_dir) savepath = temp_dir fig_dpi = 400 # change to your preferred file resolution if os.path.isfile(edipath): pd1d.plot_edi_file(edipath, savefile=os.path.join(savepath, 'pen_depth.jpg'), fig_dpi=fig_dpi) # rholist can be any of ['zxy','zyx','det'], default all of them elif os.path.isdir(edipath): # plot_edi_dir(edi_path ) pd1d.plot_edi_dir(edipath, rholist=['det'])
def test_plot_edi_file_unknown_type(self): """ testing plotting zyx and an unknown of a single edi file :return: """ plot_edi_file("data/edifiles/15125A.edi", ['zyx', 'dat'])
def test_plot_edi_file_zyx_det(self): """ testing plotting zyx & det of a single edi file :return: """ plot_edi_file("data/edifiles/15125A.edi", ['zyx', 'det'])
def test_plot_edi_file_zxy_zyx(self): """ testing plotting zxy & zyx of a single edi file :return: """ plot_edi_file("data/edifiles/15125A.edi", ['zxy', 'zyx'])
def test_plot_edi_file_zxy(self): """ testing ploting zxy of a single edi file :return: """ plot_edi_file("data/edifiles/15125A.edi", ['zxy'])
def test_plot_edi_file(self): """ testing plotting a single edi file :return: """ plot_edi_file("data/edifiles/15125A.edi")