コード例 #1
0
modem_data.read_data_file(data_fn)

model_obj_avg = modem.Model()
model_obj_avg.read_model_file(mfn_avg_2)

model_obj_avg3 = modem.Model()
model_obj_avg3.read_model_file(mfn_avg_3)

model_obj_comb = modem.Model()
model_obj_comb.read_model_file(mfn_comb_1)

model_obj_sm3 = modem.Model()
model_obj_sm3.read_model_file(mfn_sm3)
sm3_res = interp_grid(model_obj_sm3, model_obj_avg)

new_res = model_obj_avg.res_model.copy()
new_res = (new_res * model_obj_avg3.res_model *
           model_obj_comb.res_model)**(1 / 3.0)
new_res[0:30, :, 0:29] = sm3_res[0:30, :, 0:29]
# smooth_res = new_res.copy()
# for zz in range(model_obj_avg.grid_z.shape[0]):
#    smooth_res[8:-8, 8:-8, zz] = 10**smooth_2d(np.log10(new_res[:,:, zz]),
#                                              11)[8:-8, 8:-8]

model_obj_avg.res_model = new_res.copy()
model_obj_avg.write_model_file(
    save_path=r"/home/jpeacock/Documents/ModEM/LV",
    model_fn_basename="lv_avg_comb_02.rho",
)
mm = modem.ModelManipulator(model_obj_avg.model_fn, data_fn=data_fn)
コード例 #2
0
# difference between modem and ws grids
# d_east = -7500.
# d_north = 500.

# get all models into useable objects
modem_data = modem.Data()
modem_data.read_data_file(data_fn)

model_obj = modem.Model()
model_obj.read_model_file(mfn_list[3])

new_res = np.ones_like(model_obj.res_model)

for mfn in mfn_list:
    m_obj = modem.Model()
    m_obj.read_model_file(mfn)
    if m_obj.res_model.shape != model_obj.res_model.shape:
        new_res *= interp_grid(m_obj, model_obj)

    else:
        new_res[:, :, :] *= m_obj.res_model

# --> average all as a geometric mean
new_res = new_res**(1.0 / len(mfn_list))

model_obj.res_model = new_res.copy()
model_obj.write_model_file(save_path=r"/home/jpeacock/Documents/ModEM/LV",
                           model_fn_basename="lv_avg_all_5.rho")
mm = modem.ModelManipulator(model_obj.model_fn)
コード例 #3
0
                                                                   zz].shape))
    new_res[:, -pad:,
            zz] = (new_res[:, -pad - 1,
                           zz].repeat(pad).reshape(new_res[:, -pad:,
                                                           zz].shape))

#
new_res[np.where(np.nan_to_num(new_res) == 0.0)] = 100.0
modem_mod.write_model_file(
    save_path=r"/home/jpeacock/Documents/ModEM/LV/geo_inv2",
    model_fn_basename="lv_geo_wsdeep_sm.rho",
    res_model=new_res,
)
print "End Time = {0}".format(time.ctime())

mod_plot = modem.ModelManipulator(model_fn=modem_mod.model_fn,
                                  data_fn=modem_data_fn)

# omfid = file(ws_mod.initial_fn, 'r')
# mlines = omfid.readlines()
# omfid.close()
#
# mfid = file(ws_mod.initial_fn, 'w')
# mfid.writelines(mlines[0:26])
# for kk in range(ws_mod.grid_z.shape[0]):
#    for jj in range(ws_mod.grid_east.shape[0]):
#        for ii in range(ws_mod.grid_north.shape[0]):
#            res_num = new_res[(ws_mod.grid_north.shape[0]-1)-ii, jj, kk]
#            mfid.write('{0:12.5e}\n'.format(res_num))
# mfid.close()
#
# x, y = np.modgrid(ws_mod.grid_east, ws_mod.grid_north)
コード例 #4
0
"""
Created on Wed Sep  2 15:48:52 2015

@author: jpeacock
"""

import mtpy.modeling.modem_new as modem
import numpy as np
from interpolate_models import interpolate_model_grid

m1_fn = r"/home/jpeacock/Documents/ModEM/LV/geo_err12/lv_geo_err03_cov5_NLCG_065.rho"
m2_fn = r"/home/jpeacock/Documents/ModEM/LV/lv_geo_sm_wsdeep_01/lv_geo_ws_err03_cov5_NLCG_118.rho"
m3_fn = r"

#m1_interp_fn = interpolate_model_grid(m1_fn, m2_fn, pad=3, shift_north=5500,
#                                      shift_east=700)
#m1_interp_fn = interpolate_model_grid(m1_fn, m2_fn, pad=3)

m1_obj = modem.Model()
m1_obj.read_model_file(m1_fn)

m2_obj = modem.Model()
m2_obj.read_model_file(m2_fn)

res_avg = np.sqrt(m1_obj.res_model*m2_obj.res_model)

m2_obj.res_model = res_avg
m2_obj.write_model_file(model_fn_basename='lv_geo_sm_avg_02.rho')

mm = modem.ModelManipulator(model_fn=m2_obj.model_fn, 
                            data_fn=r"/home/jpeacock/Documents/ModEM/LV/geo_err12/lv_geo_err12_tip10.dat")