def BAST2L(foldername, BAST, arraysize): BASL = [] for folderk in range(len(foldername)): path = inputpath + foldername[folderk] #os.chdir(path) #print(path) if os.path.isfile(path + '/D_rifting.txt'): kk = 0 #print('exist') time = ip.read_data1('D_time', path) Ltime = ip.read_data1('D_Ltime', path) BASL.append(5000) for kk in range(len(time)): if time[kk] >= BAST[folderk]: BASL[folderk] = round(Ltime[kk], 1) break else: BASL.append(5000) print(foldername[folderk], BAST[folderk], BASL[folderk]) print(arraysize) print(BASL, BAST) print(len(BASL), len(BAST)) BAST = np.reshape(BAST, arraysize) BASL = np.reshape(BASL, arraysize) return BAST, BASL
def get_BASdata(): BAST = [] BASL = [] for folderk in range(len(foldername)): path = inputpath + foldername[folderk] #os.chdir(path) #print(path) if os.path.isfile(path + '/D_rifting.txt'): kk = 0 #print('exist') rt = ip.read_data('D_rifting', path, 3) time = ip.read_data1('D_time', path) Ltime = ip.read_data1('D_Ltime', path) BAST.append(round(rt[-1], 1)) BASL.append(1000) #print(foldername[folderk],BAST[folderk],BASL[folderk]) for kk in range(len(time)): if time[kk] >= BAST[folderk]: BASL[folderk] = round(Ltime[kk], 1) break else: print('no exist') BAST.append(1000) BASL.append(5000) #print(foldername[folderk],BAST[folderk],BASL[folderk]) BAST = np.reshape(BAST, arraysize) BASL = np.reshape(BASL, arraysize) return BAST, BASL
def getdip(depth1, depth2, time): dip = [] time = np.reshape(time, (-1, 1)) #print(time,len(time)) for folderk in range(len(foldername)): path = inputpath + foldername[folderk] os.chdir(path) if os.path.isfile(path + '/D_time.txt'): T = ip.read_data1('D_time', path) dip.append(0) for kk in range(len(T)): if time[folderk] == 0: dip[folderk] = 0 else: if time[folderk] <= T[kk]: dip[folderk] = round(read_slab_dip(kk, depth1, depth2), 1) #print (foldername[folderk],kk,dip[folderk]) break else: dip.append(0) dip = np.reshape(dip, arraysize) return dip
def time2frame(time, path): T = ip.read_data1('D_time', path) for kk in range(len(T) - 1): if T[kk] < time and T[kk + 1] >= time: break return kk
def time2vts(time, path): vts = 1 if os.path.isfile(path + '/D_time.txt'): T = ip.read_data1('D_time', path) for kk in range(len(T)): if time == 0: vts = 1 else: if time <= T[kk]: vts = kk break return vts
fa.inputpath='/home/chiilee/data/dec2019/AFcD/' fa.foldername=['AFcD1-','AFcD1-0.5','AFcD1-0.1','AFcD1-0.01', 'AFcD0.5-1','AFcD0.5-','AFcD0.5-0.1','AFcD0.5-0.01', 'AFcD0.1-1','AFcD0.1-0.5','AFcD0.1-','AFcD0.1-0.01', 'AFcD0.01-1','AFcD0.01-0.5','AFcD0.01-0.1','AFcD0.01-'] fa.arraysize=(4,4) ''' fig = plt.figure(figsize=(10, 5)) ax = fig.add_subplot(111) for folderk in range(len(gxy.foldername)): gxy.path = gxy.inputpath + gxy.foldername[folderk] os.chdir(gxy.path) time = ip.read_data1('D_time', gxy.path) retreat = ip.read_data1('D_retreat', gxy.path) line = ax.plot(time, retreat, '-', color=groupcolor[grouptype[folderk]], lw=1.2) ax.grid() ax.set_xlim(0, 20) ax.set_ylim(-4, 8) ax.set_xlabel("Time (Myrs)") ax.set_ylabel("retreat rate (cm/yr)") ''' if (axis_tick<1): plt.setp(ax.get_xticklabels(), visible=False)
axis_tick = 1 legend = 1 folderplot = 0 path = inputpath + '/' + foldername os.chdir(path) results_dir = os.path.abspath(outputpath + '/' + foldername) if not os.path.isdir(results_dir): os.makedirs(results_dir) import function_DevelopmentOfSystem as subf import function_DataInOut as ip #------------------------------------------- print('>>>>> read data in <<<<<') #------------------------------------------- time = ip.read_data1('D_time', path) trench_index = ip.read_data1('D_trench_index', path) trench_location = ip.read_data1('D_trench_location', path) #----------------------------------------- print('>>>>> ploting <<<<<') #----------------------------------------- # ========================= # strenght proflie # ========================= strenght, strenght_D, strenght_T = subf.read_strenght(vts, trench_index, 1) fig = plt.figure(figsize=(6, 5)) ax = fig.add_subplot(111)
def getfinalvts(path): finalvts = 1 if os.path.isfile(path + '/D_time.txt'): T = ip.read_data1('D_time', path) finalvts = len(T) return finalvts
if not os.path.isdir(results_dir): os.makedirs(results_dir) import flac #import flacmarker2vtk fl = flac.Flac() #------------------------------------------- print('>>>>> read data in <<<<<') #------------------------------------------- meanMORloca = [] MORtime = [] MORl = [] if os.path.isfile(path + '/D_time.txt'): time = ip.read_data1('D_time', path) Ltime = ip.read_data1('D_Ltime', path) rx = ip.read_data('D_rifting', path, 1) rz = ip.read_data('D_rifting', path, 2) rt = ip.read_data('D_rifting', path, 3) for kkt in range(len(time) - 1): MORloca = [] for kkr in range(len(rt)): if time[kkt] < rt[kkr] and time[kkt + 1] >= rt[kkr]: MORloca.append(rx[kkr]) if len(MORloca) != 0: meanMORloca.append(sum(MORloca) / len(MORloca)) MORtime.append(time[kkt]) MORl.append(Ltime[kkt])