In [1]:
import pandas as pd
import numpy as np
import json
import sys
from importlib import reload
sys.path.append('../scripts/')
import utils
In [2]:
reload(utils)
Out[2]:
In [3]:
ls ../data/fault_data/
In [4]:
with open('../data/fault_data/tib_dog_tris.geojson') as f:
td = json.load(f)
In [5]:
td['features'][0]
Out[5]:
In [6]:
tdz = pd.read_csv('../data/gis/tib_dog_elev_pts.csv', index_col=2)
tdz.columns = ['x', 'y', 'z']
tdz.head()
Out[6]:
In [47]:
#utils.add_tri_z_values(td['features'], tdz, 'z')
In [7]:
td['features'][0]
Out[7]:
In [8]:
utils.add_tri_centers_area(td['features'])
In [9]:
utils.add_strike_dip(td['features'])
utils.add_rake_from_trend(td['features'], 100, 10)
In [10]:
tib_dog_pts_df = utils.tri_dict_to_df(td, fault_name='tib_dog')
In [11]:
tib_dog_pts_df.head()
Out[11]:
In [12]:
tib_dog_pts_df.to_csv('../data/fault_data/tib_dog_pts_df.csv')
In [13]:
with open('../data/fault_data/tib_dog_tris.geojson', 'w') as f:
json.dump(td, f)
In [14]:
strikes = [feat['properties']['strike'] for feat in td['features']]
dips = [feat['properties']['dip'] for feat in td['features']]
rakes = [feat['properties']['rake'] for feat in td['features']]
cx = [feat['properties']['center'][0] for feat in td['features']]
cy = [feat['properties']['center'][1] for feat in td['features']]
cz = [feat['properties']['center'][2] for feat in td['features']]
In [15]:
td['features'][120]
Out[15]:
In [16]:
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import matplotlib.pyplot as plt
In [17]:
plt.figure(figsize=(12, 12))
plt.scatter(cx, cy, c=strikes,
s=50, lw=0)
plt.colorbar()
plt.axis('equal')
plt.show()
In [18]:
plt.figure(figsize=(12, 12))
plt.scatter(cx, cy, c=rakes,
s=50, lw=0)
plt.colorbar()
plt.axis('equal')
plt.show()
In [ ]:
In [ ]:
In [9]:
with open('../data/fault_data/tib_dog_tri_stresses.geojson') as f:
td = json.load(f)
In [11]:
utils.add_rake_from_trend(td['features'], 90., 15)
In [13]:
with open('../data/fault_data/tib_dog_tri_stresses.geojson', 'w') as f:
json.dump(td, f)
In [ ]: