Beispiel #1
0
    def invertDepth(self, depth):
        """
        Calculating inversion for specific centroid depth
        """

        _gr_xyz = "gr_xyz" # name of the executable
        _elemse = "elemse" # name of the executable
        _isola12c = "isola12c" # name of the executable
        _norm12c = "norm12c" # name of the executable

        # set folder and files
        _depth_folder = os.path.join(self.dir.inversion, str(depth))
        _station_file = os.path.join(_depth_folder, 'station.dat')
        _crustal_file = os.path.join(_depth_folder, 'crustal.dat')
        _grdat_file = os.path.join(_depth_folder, 'grdat.hed')
        _inpinv_file = os.path.join(_depth_folder, 'inpinv.dat')
        _allstat_file = os.path.join(_depth_folder, 'allstat.dat')
        _source_file = os.path.join(_depth_folder, 'source.dat')

        # create depth folder
        if not os.path.exists(_depth_folder):
            os.makedirs(_depth_folder)

        # copy raw files
        copyutil.copy_tree(self.dir.rdata, _depth_folder)

        # copy ISOLA files
        shutil.copyfile(self.dir.station, _station_file)
        shutil.copyfile(self.dir.crustal, _crustal_file)
        shutil.copyfile(self.dir.grdat, _grdat_file)
        shutil.copyfile(self.dir.inpinv, _inpinv_file)
        shutil.copyfile(self.dir.allstat, _allstat_file)

        # create src file
        _date = self.origin.datetime.split()[0]

        isola.createSource(_date, self.origin.magnitude,
                           depth, _source_file)

        # calculate Green's functions and elementary seismograms
        _gr_xyz_file = os.path.join(self.settings.isola_path, _gr_xyz)
        _elemse_file = os.path.join(self.settings.isola_path, _elemse)
        _isola12c_file = os.path.join(self.settings.isola_path, _isola12c)
        _norm12c_file = os.path.join(self.settings.isola_path, _norm12c)

        isola.calculateGreens(_gr_xyz_file, _elemse_file, _depth_folder)

        # rename "elemse.dat" to "elemse01.dat"
        # in order to run ISOLA properly
        shutil.move(os.path.join(_depth_folder, 'elemse.dat'),
            os.path.join(_depth_folder, 'elemse01.dat'))
        shutil.move(os.path.join(_depth_folder, 'gr.hea'),
            os.path.join(_depth_folder, 'gr.01.hea'))
        shutil.move(os.path.join(_depth_folder, 'gr.hes'),
            os.path.join(_depth_folder, 'gr.01.hes'))

        # calculate inversion
        isola.calculateInversion(_isola12c_file, _norm12c_file,
                                 _depth_folder)
Beispiel #2
0
    def invertRevisedDepth(self, depth):
        """
        Calculating inversion for specific centroid depth
        """

        _isola12c = "isola12c"  # name of the executable
        _norm12c = "norm12c"  # name of the executable

        # set folder and files
        _depth_folder = os.path.join(self.dir.inversion, str(depth))

        _inpinv_file = os.path.join(_depth_folder, 'inpinv.dat')
        _allstat_file = os.path.join(_depth_folder, 'allstat.dat')
        shutil.copyfile(self.dir.inpinv, _inpinv_file)
        shutil.copyfile(self.dir.allstat, _allstat_file)

        _isola12c_file = os.path.join(self.settings.isola_path, _isola12c)
        _norm12c_file = os.path.join(self.settings.isola_path, _norm12c)

        # calculate inversion
        isola.calculateInversion(_isola12c_file, _norm12c_file, _depth_folder)
Beispiel #3
0
    def invertRevisedDepth(self, depth):
        """
        Calculating inversion for specific centroid depth
        """

        _isola12c = "isola12c" # name of the executable
        _norm12c = "norm12c" # name of the executable

        # set folder and files
        _depth_folder = os.path.join(self.dir.inversion, str(depth))

        _inpinv_file = os.path.join(_depth_folder, 'inpinv.dat')
        _allstat_file = os.path.join(_depth_folder, 'allstat.dat')
        shutil.copyfile(self.dir.inpinv, _inpinv_file)
        shutil.copyfile(self.dir.allstat, _allstat_file)

        _isola12c_file = os.path.join(self.settings.isola_path, _isola12c)
        _norm12c_file = os.path.join(self.settings.isola_path, _norm12c)

        # calculate inversion
        isola.calculateInversion(_isola12c_file, _norm12c_file,
                                 _depth_folder)