Skip to content

Commit af1930f

Browse files
committed
updated plots
1 parent a946643 commit af1930f

13 files changed

+798
-71
lines changed

.DS_Store

0 Bytes
Binary file not shown.

__pycache__/bForStrain.cpython-39.pyc

2.59 KB
Binary file not shown.

__pycache__/params.cpython-39.pyc

-5 Bytes
Binary file not shown.

__pycache__/tools.cpython-39.pyc

732 Bytes
Binary file not shown.

bForStrain.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ def load(filename):
7676
return(pickle.load(pkl_file))
7777

7878
class Mesh:
79-
def __init__(self):
79+
def __init__(self,file):
8080

81-
data = np.loadtxt(params.gps_file,delimiter=',')
81+
data = np.loadtxt(file,delimiter=',')
8282
data = data[::params.decimate,:]
8383
self.lon = data[:,0]
8484
self.lat = data[:,1]
@@ -224,7 +224,7 @@ def plot_vels(self, Ve=None, Vn=None, colormap='viridis',plot_centroid=False,res
224224

225225
return(axes)
226226

227-
def plot(self,values=None, colormap='viridis', scale=None, cbar=True, lonlat=False,edges=False):
227+
def plot(self,values=None, colormap='viridis', scale=None, cbar=True, lonlat=False,edges=False,borders=False):
228228

229229
if values is None:
230230
values=[self.score]
@@ -248,6 +248,8 @@ def plot(self,values=None, colormap='viridis', scale=None, cbar=True, lonlat=Fal
248248

249249
for i, (val, ax) in enumerate(zip(values, axes)):
250250
plt.subplot(1, n_vals, i + 1)
251+
252+
251253
if edges:
252254
tripcolor = ax.tripcolor(triang, val, cmap=colormap, norm=scale,edgecolors='k')
253255
else:
@@ -265,7 +267,10 @@ def plot(self,values=None, colormap='viridis', scale=None, cbar=True, lonlat=Fal
265267
else:
266268
ax.plot([self.SegEnds[:, 0], self.SegEnds[:, 2]],
267269
[self.SegEnds[:, 1], self.SegEnds[:, 3]], 'k-', linewidth=1.5)
268-
270+
271+
if borders:
272+
tools.plot_borders(ax,lonlat)
273+
269274
if n_vals == 1:
270275
return(axes[0])
271276
return axes
@@ -462,8 +467,7 @@ def Inversion(mesh):
462467
GExx = Gpoint.GExx
463468
GExy = Gpoint.GExy
464469
GEyy = Gpoint.GEyy
465-
466-
470+
467471
G = np.concatenate([GVe[mesh.ind,:],GVn[mesh.ind,:]])
468472

469473
numobs = mesh.nodes.shape[0]*2

data/Table-S1.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Table S1: ITRF2014-PMM rotation pole cartesian components in DEG/My.
2+
----------------------------------------------------------------------------------------------------------
3+
plate omega_x omega_y omega_z
4+
-----------DEG/My----------
5+
----------------------------------------------------------------------------------------------------------
6+
ANTA -0.0688 -0.0900 0.1874
7+
ARAB 0.3205 -0.0378 0.4011
8+
AUST 0.4194 0.3284 0.3375
9+
EURA -0.0235 -0.1476 0.2140
10+
INDI 0.3205 -0.0014 0.4038
11+
NAZC -0.0925 -0.4290 0.4508
12+
NOAM 0.0066 -0.1928 -0.0176
13+
NUBI 0.0274 -0.1704 0.2037
14+
PCFC -0.1135 0.2907 -0.6025
15+
SOAM -0.0751 -0.0835 -0.0389
16+
SOMA -0.0336 -0.2206 0.2454

data/ne_10m_admin_0_countries.geojson

+265
Large diffs are not rendered by default.

demo.ipynb

+419
Large diffs are not rendered by default.

environment.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencies:
1010
- pyvista
1111
- scipy
1212
- pyproj
13+
- geopandas
1314
- pip
1415
- pip:
1516
- triangle

params.py

+11-14
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,40 @@
22

33
gps_file = 'data/GNSS_velocities_alpides.txt'
44
creeping_file = []
5-
origin = [32.5, 35]
5+
origin = [32.5, 35]
66
lon_range = [-15,142]
7-
lat_range = [5, 60]
7+
lat_range = [5, 60]
88
nom_node_spacing = 400.
99

10-
## West US configuration
10+
### West US configuration
1111

1212
gps_file = 'data/Zeng_vels_augmented_PA_JDF.txt'
1313
creeping_file = 'data/creeping_faults.txt'
1414
origin = [-120,34]
1515
lon_range = [-127, -96]
1616
lat_range = [26, 54]
17-
nom_node_spacing = 500.
17+
nom_node_spacing = 100.
1818

19-
# mesh decimation factor (speeds up runtime, useful for debugging large scenarios)
20-
# set = 1 for no decimation
21-
decimate = 8
19+
### Meshing parameters
20+
# mesh decimation factor (speeds up runtime, useful for debugging large scenarios), set = 1 for no decimation
21+
decimate = 1
2222

2323
# creeping patch length
2424
patchL = 15.
2525

2626
#option to refine mesh in vicinity of GPS data
2727
# 0 = no refinement, 1-4 provides some
2828
refine_mesh = 0
29-
30-
31-
3229
refine = 1
30+
3331
nu = 0.25
3432
Gshear = 1
3533

3634
betas = [40]
37-
38-
39-
uncertainty = True
35+
# Compute uncertainties?
36+
uncertainty = False
4037
# number of realizations of strain rate for each beta value
41-
num = 10
38+
num = 25
4239
# relative weight on fitting creep rate data (creeping faults)
4340
Wcreep = 1
4441
# optional two-step minimization of strain rates below threshold value

results_beta40.pkl

-200 KB
Binary file not shown.

run.ipynb

+58-51
Large diffs are not rendered by default.

tools.py

+18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import params
55
import pandas as pd
66
import pyproj
7+
import geopandas as gpd
78

89
###############
910
# Coordinate transforms defined using pyproj, called via wrapper functions
@@ -16,6 +17,23 @@ def llh2local(lons,lats):
1617
def local2llh(xs,ys):
1718
return(np.array(local_to_llh.transform(xs,ys)).T)
1819

20+
### Read in borders...
21+
# naturalearthdata.com data downloaded from https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_0_countries.geojson
22+
borders = gpd.read_file('data/ne_10m_admin_0_countries.geojson')
23+
borders_xy = borders.to_crs(local_crs)
24+
25+
def plot_borders(ax,lonlat=False,width=0.5):
26+
27+
xlim = ax.get_xlim()
28+
ylim = ax.get_ylim()
29+
30+
if lonlat:
31+
borders.boundary.plot(ax=ax, linewidth=width, color='black')
32+
else:
33+
borders_xy.boundary.plot(ax=ax, linewidth=width, color='black')
34+
35+
ax.set_xlim(xlim)
36+
ax.set_ylim(ylim)
1937

2038

2139
class build_G_pointforce:

0 commit comments

Comments
 (0)