예제 #1
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_ReadData as rd
vts_numbers = vts - 1

#-------------------------------------------
print('>>>>> read & save data <<<<<')
#-------------------------------------------
time = rd.read_time(vts_numbers)
ip.save_1array('D_time', path, time)

trench_index, trench_location = rd.read_trench_location(vts_numbers)
trench_retreat_rate = cd.rate_calculating(trench_location, time)
trench_retreat_rate = cd.moving_window_smooth(trench_retreat_rate, 15)
trench_retreat_rate = cd.moving_window_smooth(trench_retreat_rate, 15)
ip.save_1array('D_trench_index', path, trench_index)
ip.save_1array('D_trench_location', path, trench_location)
ip.save_1array('D_retreat', path, trench_retreat_rate)

subductingV = rd.read_downgoing_plate_velocity(trench_index, vts_numbers)
subductingV = cd.moving_window_smooth(subductingV, 15)
subductingV = cd.moving_window_smooth(subductingV, 15)
ip.save_1array('D_subductingV', path, subductingV)

Ltime = rd.read_subductingL(time, subductingV, trench_retreat_rate)
ip.save_1array('D_Ltime', path, Ltime)

dip = rd.read_slab_dip(vts_numbers, 100, 200)
            print
            arcmaxT.append(round(max(arcthickness), 2))
            arcmeanT.append(round(np.mean(arcthickness), 2))
        else:
            arcmaxT.append(0.0)
            arcmeanT.append(0.0)
    return arcmaxT, arcmeanT


#get data
magmaP, Time = magma_prodction()
##smooth
magmaP = cd.moving_window_smooth(magmaP, 10)
magmaP = cd.moving_window_smooth(magmaP, 5)
magmaP = cd.rate_calculating(magmaP, Time)  #km3 km-1 Myr-1

arcP = [i * arcf for i in magmaP]  #from markers
#arcP2=crust_production()      #from elements area
#arcP2=cd.rate_calculating2(arcP2,Time)
#arcP2=cd.moving_window_smooth(arcP2,10)
#arcP2=cd.moving_window_smooth(arcP2,5)

arcmaxT, arcmeanT = get_arcT()

#aa=[i*0.05 for i in arcP]
#aa2=[i*0.05 for i in arcP2]

#print(np.sum(aa),np.sum(aa2))
#print(np.sum(aa2)*0.14)
        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])

        MORrate = cd.rate_calculating(meanMORloca, MORtime)

        RightV = []
        LeftV = []
        for kkMOR in range(len(meanMORloca)):
            MORframe = time2frame(MORtime[kkMOR], path)
            MORindex = xloca2xindex(meanMORloca[kkMOR], MORframe)

            vx, vz = fl.read_vel(MORframe)

            # right side
            rightV = 0
            for kkx in range(MORindex + 5, MORindex + 15):
                for kkz in range(2, 27):
                    rightV = vx[kkx, kkz] + rightV
            rightV = rightV / (10 * 25)