示例#1
0
文件: mt.py 项目: lucasc15/mt3py
 def remove_distortion(self):
     """
     remove distortion following Bibby et al. [2005].
     
     if you want to write a new edi file with distortion removed you can 
     do this by:
     
         >>> import mtpy.core.mt as mt
         >>> mt1 = mt.MT(fn=r"/home/mt/edi_files/mt01.edi")
         >>> D, new_z = mt1.remove_distortion()
         >>> mt1.write_edi_file(new_fn=r"/home/mt/edi_files/mt01_dr.edi",\
                                new_Z=new_z)
     """
     dummy_z_obj = MTz.copy.deepcopy(self.Z)
     D, new_z_object = MTdistortion.remove_distortion(z_object=dummy_z_obj)
     
     return D, new_z_object
示例#2
0
文件: mt.py 项目: schoolhui/mtpy
 def remove_distortion(self):
     """
     remove distortion following Bibby et al. [2005].
     
     if you want to write a new edi file with distortion removed you can 
     do this by:
     
         >>> import mtpy.core.mt as mt
         >>> mt1 = mt.MT(fn=r"/home/mt/edi_files/mt01.edi")
         >>> D, new_z = mt1.remove_distortion()
         >>> mt1.write_edi_file(new_fn=r"/home/mt/edi_files/mt01_dr.edi",\
                                new_Z=new_z)
     """
     
     D, new_z_object = MTdistortion.remove_distortion(z_object=self.Z)
     
     return D, new_z_object
示例#3
0
文件: mt_old.py 项目: zy911k24/mtpy
    def remove_distortion(self, num_freq=None):
        """
        remove distortion following Bibby et al. [2005].
        
        Example
        ----------
        :Remove Distortion and Write New .edi: ::
        
            >>> import mtpy.core.mt as mt
            >>> mt1 = mt.MT(fn=r"/home/mt/edi_files/mt01.edi")
            >>> D, new_z = mt1.remove_distortion()
            >>> mt1.write_edi_file(new_fn=r"/home/mt/edi_files/mt01_dr.edi",\
            >>>                    new_Z=new_z)
        """
        dummy_z_obj = MTz.copy.deepcopy(self.Z)
        D, new_z_object = MTdistortion.remove_distortion(z_object=dummy_z_obj,
                                                         num_freq=num_freq)

        return D, new_z_object
示例#4
0
 def remove_distortion(self, num_freq=None):
     """
     remove distortion following Bibby et al. [2005].
     
     Example
     ----------
     :Remove Distortion and Write New .edi: ::
     
         >>> import mtpy.core.mt as mt
         >>> mt1 = mt.MT(fn=r"/home/mt/edi_files/mt01.edi")
         >>> D, new_z = mt1.remove_distortion()
         >>> mt1.write_edi_file(new_fn=r"/home/mt/edi_files/mt01_dr.edi",\
         >>>                    new_Z=new_z)
     """
     dummy_z_obj = MTz.copy.deepcopy(self.Z)
     D, new_z_object = MTdistortion.remove_distortion(z_object=dummy_z_obj,
                                                      num_freq=num_freq)
     
     return D, new_z_object
# directory path where edi files are
dirpath = r"d:\Peacock\MTData\EDI_Files\Counts"

# path to save edi files that have distortion removed
drpath = os.path.join(dirpath, 'DR')

# make sure the drpath exists
if not os.path.exists(drpath):
    os.mkdir(drpath)

#make a list of all edi files in the directory
edi_list = [
    os.path.join(dirpath, edi) for edi in os.listdir(dirpath)
    if edi.find('.edi') > 0
]

#loop over edi files and remove distortion
dlst = []
for edi in edi_list:
    e1 = mtedi.Edi(filename=edi)
    d, zd = distortion.remove_distortion(z_object=e1.Z)
    e1.Z = zd
    e1.writefile(os.path.join(dirpath, 'DR', e1.station.lower()))
    dlst.append({'station': e1.station, 'd': d})

#print results for easy viewing
for dd in dlst:
    print '--> Distortion tensor for {0} is:'.format(dd['station'])
    print '{0}|{1: .2f} {2: .2f}|'.format('' * 5, dd['d'][0, 0], dd['d'][0, 1])
    print '{0}|{1: .2f} {2: .2f}|'.format('' * 5, dd['d'][1, 0], dd['d'][1, 1])