def get_tomo_data(self,threshold=20.): """Get tomography dataset from h5 file Parameters: tomo_f -- h5 file that contains the tomography results period -- period of interest threshold -- path density threshold for forming mask """ dset = raytomo.RayTomoDataSet(self.attrs['tomo_f']) for prd in self.attrs['prd_arr']: group = self['%g_sec'%( prd )] dset.get_data4plot(dataid=self.attrs['dataid'].decode('utf-8'), period=prd) pdens = dset.pdens mask_pdens = dset.pdens < threshold tomo_data = np.ma.masked_array(dset.vel_iso, mask=mask_pdens) group.create_dataset(name='tomo_data', data=dset.vel_iso) # phase velocity map group.create_dataset(name='tomo_data_msk', data=mask_pdens) # save the mask array seperately. h5 file doesn't support masked array group.create_dataset(name='latArr', data=dset.latArr) group.create_dataset(name='lonArr', data=dset.lonArr) return
import noisedbase import numpy as np import timeit import GeoPolygon import raytomo #----------------------- #initialization #----------------------- dset = raytomo.RayTomoDataSet('/work1/leon/ALASKA_work/hdf5_files/ray_tomo_Alaska_azi_old.h5') # dset=raytomo.RayTomoDataSet('/work1/leon/ALASKA_work/hdf5_files/ray_tomo_Alaska_single_40.h5') # dset.set_input_parameters(minlon=188, maxlon=238, minlat=52, maxlat=72, data_pfx='raytomo_in_', smoothpfx='N_INIT_', qcpfx='QC_') # # ----------------------------- # # run the inversion # # ----------------------------- dset.set_input_parameters(minlon=188, maxlon=238, minlat=52, maxlat=72, data_pfx='raytomo_in_',\ smoothpfx='N_INIT_', qcpfx='QC_', pers=np.array([50.])) dset.run_smooth(datadir='/work1/leon/ALASKA_work/xcorr_working_dir_Rayleigh/raytomo_input_20190131_all_three_lambda',\ outdir='../ray_tomo_working_dir_azi_old', lengthcell=1.) # dset.run_qc(outdir='../ray_tomo_working_dir', dlon=0.2, dlat=0.1, isotropic=True, anipara=0, alphaAni4=1000, alphaAni0=850, betaAni0=1, sigmaAni0=50,\ # madfactor=3., lengthcell=0.5, lengthcellAni=.5) # dset.run_qc(outdir='../ray_tomo_working_dir', dlon=0.2, dlat=0.1, isotropic=False, anipara=0, alphaAni4=1000, alphaAni0=850, betaAni0=1, sigmaAni0=50,\ # madfactor=3., lengthcell=0.5, lengthcellAni=.5) # dset.run_qc(outdir='../ray_tomo_working_dir', dlon=0.2, dlat=0.1, isotropic=False, anipara=1, alphaAni4=1000, alphaAni0=850, betaAni0=1, sigmaAni0=50, \ # madfactor=3., lengthcell=0.5, lengthcellAni=.5) # # dset.run_qc(outdir='../ray_tomo_working_dir_azi_old', dlon=0.2, dlat=0.1, isotropic=False, anipara=1, alphaAni4=1000, alphaAni0=850, betaAni0=1, sigmaAni0=50, \
import raytomo import numpy as np dset = raytomo.RayTomoDataSet('./ray_tomo_JdF_ocean.h5') pers = np.append( np.arange(7.)*2.+6., np.arange(4.)*3.+20.) dset.set_input_parameters(minlon=228., maxlon=237., minlat=43., maxlat=50., pers=pers, data_pfx='2_sta_in_', smoothpfx='N_INIT_', qcpfx='QC_') dset.run_smooth(datadir='/work3/wang/JdF/Input_4_Ray', outdir='./ray_tomo_working_dir_ocean',dlon=0.1, dlat=0.1, lengthcell=0.3) dset.run_qc(outdir='./ray_tomo_working_dir_ocean', isotropic=True, dlon=0.1, dlat=0.1, lengthcell=0.3) #dset.run_qc(runid=1, outdir='./ray_tomo_working_dir', alpha=1000, sigma=200, isotropic=True, anipara=1, alphaAni4=1000) #dset.run_qc(runid=2, outdir='./ray_tomo_working_dir', dlon=0.1, dlat=0.1, alpha=1000, sigma=100, isotropic=True, anipara=1) #dset.get_data4plot(dataid='smooth_run_0', period=12.) #dset.get_data4plot(dataid='qc_run_0', period=29.) #dset.plot_vel_iso(vmin=2.9, vmax=3.5, fastaxis=False, projection='global') #dset.plot_pdens() #dset.plot_vel_iso(vmin=1.25, vmax=2.4,hillshade=False) #dset.plot_vel_iso(hillshade=False) #dset.plot_residual(dataid='qc_run_0', period=30.) #dset.residual_per_station(dataid='qc_run_0', period=30., dist_lim=1.) #dset.plot_fast_axis() #dset.generate_corrected_map(dataid='qc_run_0', glbdir='./MAPS', outdir='./REG_MAPS') #dset.plot_global_map(period=50., inglbpfx='./MAPS/smpkolya_phv_R')
import noisedbase import numpy as np import timeit import matplotlib.pyplot as plt import raytomo import matplotlib.pyplot as plt # dset=eikonaltomo.EikonalTomoDataSet('/scratch/summit/life9360/ALASKA_work/hdf5_files/eikonal_xcorr_tomo_Alaska_TA_AK_20180718_10sec.h5') # dset = eikonaltomo.EikonalTomoDataSet('/scratch/summit/life9360/ALASKA_work/hdf5_files/eikonal_xcorr_tomo_Alaska_TA_AK_20180813.h5') dset = raytomo.RayTomoDataSet( '/work1/leon/ALASKA_work/hdf5_files/ray_tomo_Alaska_20180920.h5') dset.plot_sem_curve(ineikfname='/work1/leon/ALASKA_work/hdf5_files/eikonal_xcorr_tomo_Alaska_TA_AK_20180814_250km.h5',\ period=20., runid=2, dx=10., xmax=70., plotfig=True, semfactor=2.0) # # periods = dset.attrs['period_array'][1:-2] # k = np.zeros(periods.size) # for i in range(periods.size): # k[i] = dset.plot_sem_curve(ineikfname='/work1/leon/ALASKA_work/hdf5_files/eikonal_xcorr_tomo_Alaska_TA_AK_20180814_250km.h5',\ # period=periods[i], runid=2, dx=10., xmax=70., plotfig=False, semfactor=1.2)[0] # # # # ax = plt.subplot() # plt.plot(periods, k, 'o', ms=15, label='observed') # ax.tick_params(axis='x', labelsize=20) # ax.tick_params(axis='y', labelsize=20) # plt.ylabel('Slope ('+r'$10^{-3} \sec^{-1}$'+')', fontsize=30) # plt.xlabel('Period (s)', fontsize=30) # # plt.legend(fontsize=30) # plt.show()
def get_res_data(self): dset = raytomo.RayTomoDataSet(self.attrs['tomo_f']) for period in self.attrs['prd_arr']: group = self['%g_sec'%( period )] group.create_dataset(name='res_data', data=dset[self.attrs['dataid'].decode('utf-8')+'/%g_sec'%( period )]['residual'].value) return
import noisedbase import numpy as np import timeit import GeoPolygon import raytomo #----------------------- #initialization #----------------------- dset = raytomo.RayTomoDataSet( '/work1/leon/ALASKA_work/hdf5_files/ray_tomo_Alaska_Love_find_bad.h5') # dset=raytomo.RayTomoDataSet('/work1/leon/ALASKA_work/hdf5_files/ray_tomo_Alaska_single_40.h5') # dset=raytomo.RayTomoDataSet('/work1/leon/ALASKA_work/hdf5_files/ray_tomo_Alaska_formisha.h5') # dset=raytomo.RayTomoDataSet('/scratch/summit/life9360/ALASKA_work/hdf5_files/ray_tomo_Alaska_20180806_all_001.h5') # dset=raytomo.RayTomoDataSet('/work3/leon/ray_tomo_Alaska_20180410.h5') # dset=raytomo.RayTomoDataSet('../ray_tomo_Alaska_20180410.h5') # dset=raytomo.RayTomoDataSet('/scratch/summit/life9360/ALASKA_work/hdf5_files/ray_tomo_Alaska_20180410_un_from_TA_AK.h5') # # dset.set_input_parameters(minlon=188, maxlon=238, minlat=52, maxlat=72, data_pfx='raytomo_in_', smoothpfx='N_INIT_', qcpfx='QC_') # # #----------------------------- # # # run the inversion # # #----------------------------- dset.set_input_parameters(minlon=188, maxlon=238, minlat=52, maxlat=72, data_pfx='raytomo_in_',\ smoothpfx='N_INIT_', qcpfx='QC_', pers=np.array([50.])) dset.run_smooth(datadir='/work1/leon/ALASKA_work/xcorr_working_dir_Love/raytomo_input_20190131_all_three_lambda', \ outdir='../ray_tomo_working_dir_find_bad', channel='TT', lengthcell=1.) dset.run_qc(outdir='../ray_tomo_working_dir_find_bad', dlon=.2, dlat=.1, isotropic=False, anipara=0, alphaAni4=1000, alphaAni0=850, betaAni0=1, sigmaAni0=50,\ madfactor=2., lengthcell=.5, lengthcellAni=.5, wavetype='L')
import raytomo import timeit import numpy as np dset = raytomo.RayTomoDataSet('./ray_tomo_WUS.h5') # dset.set_input_parameters(minlon=235., maxlon=255., minlat=31., maxlat=50., data_pfx='raytomo_in_', smoothpfx='N_INIT_', qcpfx='QC_')