Example #1
0
 def test_cs_across_idl(self):
     """
     Test cross section across idl
     """
     cs = CrossSection(-179.0, -50.0, [500], [-90])
     computed = cs.get_mm()
     expected = [cs.plo[0], cs.plo[1], cs.pla[0], cs.pla[1], 1]
     numpy.testing.assert_equal(computed, expected)
Example #2
0
 def test_cs_across_idl_with_delta(self):
     """
     Test cross section across idl + delta
     """
     cs = CrossSection(-179.5, -50.0, [200], [90])
     computed = cs.get_mm(1.0)
     expected = [179.5, -175.70311203864779, -51.0, -48.966369263787726, 1]
     numpy.testing.assert_equal(computed, expected)
Example #3
0
 def test_simple_cs(self):
     """
     Test simple cross section
     """
     cs = CrossSection(10.0, 45.0, [100], [45])
     computed = cs.get_mm()
     expected = [cs.plo[0], cs.plo[1], cs.pla[0], cs.pla[1], 0]
     numpy.testing.assert_equal(computed, expected)
Example #4
0
 def test_idl_cross_section(self):
     cs = CrossSection(-179.0, -50.0, [200], [-90])
     csd = CrossSectionData(cs)
     csd.set_crust1pt0_moho_depth(CRUST_DATA_PATH_IDL, bffer=100.)
     expected = [[-179.5, -49.5], [-179.5, -50.5], [178.5, -49.5],
                 [179.5, -49.5], [178.5, -50.5], [179.5, -50.5]]
     numpy.testing.assert_equal(expected, csd.moho[:, 0:2])
Example #5
0
def plt_cs(olo, ola, depp, lnght, strike, ids, ini_filename):
    """
    """
    csec = CrossSection(olo, ola, [lnght], [strike], ids)
    csda = CrossSectionData(csec)

    config = configparser.ConfigParser()
    config.read(ini_filename)
    fname_trench = config['data']['trench_axis_filename']
    fname_eqk_cat = config['data']['catalogue_pickle_filename']
    fname_slab = config['data']['slab1pt0_filename']
    fname_crust = config['data']['crust1pt0_filename']
    fname_gcmt = config['data']['gcmt_filename']
    fname_topo = config['data']['topo_filename']
    fname_litho = config['data']['litho_filename']
    fname_volc = config['data']['volc_filename']

    csda.set_trench_axis(fname_trench)
    cat = pickle.load(open(fname_eqk_cat, 'rb'))
    csda.set_catalogue(cat)
    if re.search('[a-z]', fname_slab):
        csda.set_slab1pt0(fname_slab)
    csda.set_crust1pt0_moho_depth(fname_crust)
    csda.set_gcmt(fname_gcmt)
    csda.set_topo(fname_topo)
    csda.set_litho_moho_depth(fname_litho)
    csda.set_volcano(fname_volc)

    fig = plot(csda, depp, lnght)

    return fig
 def setUp(self):
     cs = CrossSection(99.871355, -3.732278, 400.0, 52.046981)
     self.css = [cs]
     self.fname = os.path.join(BASE_PATH, 'data', 'slab2pt0',
                               'sum_slab2_dep_02.23.18.xyz')
     self.fname_pro = os.path.join(BASE_PATH, 'data', 'slab2pt0',
                                   'profile.csv')
Example #7
0
def read_cs(filename):
    """
    """
    cs_dict = {}
    fin = open(filename, 'r')
    for line in fin:
        aa = re.split('\\s+', line)
        olo = float(aa[0])
        ola = float(aa[1])
        length = float(aa[3])
        strike = float(aa[4])
        key = aa[5]
        cs = CrossSection(olo, ola, [length], [strike])
        cs_dict[key] = cs
    return cs_dict
def main(fname_slab: str,
         pname_out: str,
         fname_cross_sections: str,
         *,
         bffer: float = 10):

    # Read the traces of the cross-sections
    names = ['olo', 'ola', 'sle', 'sde', 'azi', 'num', 'ini']
    df = pd.read_csv(fname_cross_sections, names=names, sep='\\s+')
    css = []
    for i, l in df.iterrows():
        num = '{:03d}'.format(int(l.num))
        css.append(CrossSection(l.olo, l.ola, l.sle, l.azi, num))

    # Create and save profiles
    slb = Slab2pt0.from_file(fname_slab, css)
    slb.compute_profiles(bffer)
    slb.write_profiles(pname_out)
Example #9
0
 def test_ns_cross_section(self):
     cs = CrossSection(45.0, 45.0, [100], [0])
     csd = CrossSectionData(cs)
     csd.set_crust1pt0_moho_depth(CRUST_DATA_PATH, bffer=200.)
     expected = [[43.5, 45.5], [44.5, 45.5], [45.5, 45.5], [46.5, 45.5]]
     numpy.testing.assert_equal(expected, csd.moho[:, 0:2])