shaharkadmiel / pySW4

Setup, run, post process, and visualize numerical simulations. Primarily SW4
http://shaharkadmiel.github.com/pySW4
GNU General Public License v3.0
28 stars 14 forks source link

Bug in rfileIO.py write_properties #14

Closed firstkingofrome closed 6 years ago

firstkingofrome commented 6 years ago

Hello, the documentation for write_properties says that the function takes everything in M/kg however if you give the function these units some of the values of P and VS are massively inflated. I think that this is because mm.get_vs returns different units and the function always expects these (it doesnt handle the case where the user provides them), I fixed it with the following change to function write_properties:

 k_array = np.empty((vp.size, nc), np.float32)
vs = vs or mm.get_vs(vp* 1e3)
rho = rho or mm.get_rho(vp* 1e3)
qs = qs or mm.get_qs(vs)
qp = qp or mm.get_qp(qs)

k_array[:, 0] = rho 
k_array[:, 1] = vp 
k_array[:, 2] = vs 
k_array[:, 3] = qp
k_array[:, 4] = qs

k_array.tofile(f)

EDIT: I am sorry this code actually doesn't fix it I am not sure why

shaharkadmiel commented 6 years ago

should be fixed in master