def main(in_path,
         max_sampl_dist,
         out_path,
         upper_depth=0,
         lower_depth=1000,
         *,
         from_id='.*',
         to_id='.*'):
    """
    Builds edges that can be used to generate a complex fault surface
    starting from a set of profiles
    """
    build_complex_surface(in_path, max_sampl_dist, out_path, upper_depth,
                          lower_depth, from_id, to_id)
Exemplo n.º 2
0
 def setUp(self):
     relpath = '../data/ini/test.ini'
     self.ini_fname = os.path.join(BASE_DATA_PATH, relpath)
     #
     # prepare the input folder and the output folder
     in_path = os.path.join(BASE_DATA_PATH, '../data/sp_cam/')
     out_path = os.path.join(BASE_DATA_PATH, '../data/tmp/')
     #
     # cleaning the tmp directory
     if os.path.exists(out_path):
         shutil.rmtree(out_path)
     #
     # create the complex surface. We use the profiles used for
     # the subduction in CCARA
     max_sampl_dist = 10.
     build_complex_surface(in_path,
                           max_sampl_dist,
                           out_path,
                           upper_depth=50,
                           lower_depth=200)
 def setUp(self):
     """
     """
     relpath = '../data/ini/test_south_america_slab_6.ini'
     self.ini_fname = os.path.join(BASE_DATA_PATH, relpath)
     #
     # Prepare the input folder and the output folder
     tmps = '../data/south_america_segment6_slab/'
     in_path = os.path.join(BASE_DATA_PATH, tmps)
     self.out_path = os.path.join(BASE_DATA_PATH, '../data/tmp/')
     #
     # Cleaning the tmp directory
     if os.path.exists(self.out_path):
         shutil.rmtree(self.out_path)
     #
     # create the complex surface. We use the profiles used for
     # the subduction in CCARA
     max_sampl_dist = 10.
     build_complex_surface(in_path, max_sampl_dist, self.out_path,
                           upper_depth=50, lower_depth=200)
Exemplo n.º 4
0
 def setUp(self):
     """
     """
     relpath = '../data/ini/test_kt_z1.ini'
     self.ini_fname = os.path.join(BASE_DATA_PATH, relpath)
     #
     # prepare the input folder and the output folder
     in_path = os.path.join(BASE_DATA_PATH, '../data/profiles/pai_kt_z1/')
     out_path = os.path.join(BASE_DATA_PATH, '../data/tmp/')
     #
     # cleaning the tmp directory
     if os.path.exists(out_path):
         shutil.rmtree(out_path)
     #
     # first we create the complex surface. We use the profiles used for
     # the subduction in the model for the Pacific Islands
     max_sampl_dist = 10.
     build_complex_surface(in_path,
                           max_sampl_dist,
                           out_path,
                           upper_depth=50,
                           lower_depth=750)
Exemplo n.º 5
0
    def setUp(self):
        """
        We use the profiles used for the subduction in the model for the
        Pacific Islands to test the smoothing approach.
        """

        relpath = os.path.join('..', 'data', 'ini', 'test_kt_z1.ini')
        ini_fname = os.path.join(BASE_DATA_PATH, relpath)

        # Prepare the input folder and the output folder
        tmp = os.path.join('..', 'data', 'profiles', 'pai_kt_z1')
        in_path = os.path.join(BASE_DATA_PATH, tmp)

        # Create the tmp directory
        self.out_path = tempfile.mkdtemp()

        # Read the ini file and change params
        config = configparser.ConfigParser()
        config.read(ini_fname)
        tmp = os.path.join(self.out_path, 'ruptures.hdf5')
        config['main']['out_hdf5_fname'] = tmp
        tmp = os.path.join(self.out_path, 'smoothing.hdf5')
        config['main']['out_hdf5_smoothing_fname'] = tmp
        config['main']['profile_folder'] = self.out_path
        # Spatial distribution controlled by smoothing
        config['main']['uniform_fraction'] = '0.0'

        # Save the new .ini
        self.ini = os.path.join(self.out_path, 'test.ini')
        with open(self.ini, 'w') as configfile:
            config.write(configfile)
        self.config = config

        # Create the complex surface
        max_sampl_dist = 10.
        build_complex_surface(in_path, max_sampl_dist, self.out_path,
                              upper_depth=50, lower_depth=300)
Exemplo n.º 6
0
 def test_build_01(self):
     """
     """
     upper_depth = 0
     lower_depth = 1000
     from_id = '.*'
     to_id = '.*'
     #
     # read profiles
     sps, odmin, odmax = read_profiles_csv(self.in_path, upper_depth,
                                           lower_depth, from_id, to_id)
     #
     # build the complex surface
     build_complex_surface(self.in_path, self.max_sampl_dist, self.out_path,
                           upper_depth, lower_depth, from_id, to_id)
     #
     # read the output profiles
     sps, edmin, edmax = read_profiles_csv(self.out_path, upper_depth,
                                           lower_depth, from_id, to_id)
     #
     #
     self.assertEqual(odmin, edmin)
     assert lower_depth >= edmax
     assert upper_depth <= edmin