Updated bathymetry generation with figsave

This commit is contained in:
Edgar P. Burkhart 2022-01-31 17:27:53 +01:00
parent 70a4e4bb59
commit 1969e54342
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 36 additions and 13 deletions

View file

@ -1,3 +1,4 @@
/1_scad
/2_stl
/3_pd
/4_fig

View file

@ -23,3 +23,7 @@ root = 2_stl
[pandas]
root = 3_pd
file = data.hdf
[fig]
root = 4_fig
format = pgf

View file

@ -27,6 +27,8 @@ folders = {
'stl': pathlib.Path(config['stl']['root']),
'pandas': pathlib.Path(config['pandas']['root']),
}
if config.getboolean('fig', 'enable', fallback=False):
folders['fig'] = pathlib.Path(config.get('fig', 'root'))
for path in folders.values():
path.mkdir(exist_ok=True)
@ -94,8 +96,11 @@ for bloc in blocs:
#line.z = all_blocs.z.fillna(line.z)
lim = float(config['main']['bathy_max'])
bathy_line = line.z.clip(upper=lim)
rubble_line = line.z[line.z > lim]
bathy_line = line.z.copy()
#bathy_line = line.z.clip(upper=lim)
bathy_line = bathy_line[(bathy_line.index - L0 < -10) | (bathy_line.index - L0 > 0)]
bathy_line.index = np.where((bathy_line > lim) & (bathy_line.index < L0), bathy_line.index + 10, bathy_line.index)
rubble_line = line.z[(line.z > lim) & (line.index < L0)]
data_dict = {}
for i in range(blocs.size):
@ -163,25 +168,34 @@ if config['main']['plot'] == 'True':
)
fig, ax = plt.subplots()
ax.scatter(
c = ax.tricontourf(
bathy.lon[flt],
bathy.lat[flt],
c=bathy.z[flt],
marker='1',
lw=1,
bathy.z[flt],
#marker='1',
#lw=1,
)
ax.scatter(
fig.colorbar(c, label='Altitude (m)')
ax.plot(
artha.lon,
artha.lat,
color='k',
marker='+',
lw=1,
label='Studied domain',
)
ax.legend()
ax.grid(alpha=.2)
ax.set(
xlabel='Longitude (°)',
ylabel='Latitude (°)',
aspect='equal',
)
if config.getboolean('fig', 'enable', fallback=False):
fig.savefig(folders['fig'].joinpath(
f'map.{config.get("fig", "format")}'))
fig, ax = plt.subplots()
fig, ax = plt.subplots(figsize=(6,2))
ax.plot(
bathy_line.index,
bathy_line,
@ -196,21 +210,25 @@ if config['main']['plot'] == 'True':
color='r',
lw=1,
zorder=11,
label='Rubble',
label='Armour',
)
blocs.apply(lambda bloc: ax.fill_between(
bloc.index,
bloc.z,
color='k',
zorder=9,
alpha=.1,
label='Caisson',
zorder=12,
#alpha=.1,
))
ax.set(
xlabel='x (m)',
ylabel='y (m)',
aspect='equal',
xlim=(bathy_line.index.min(), bathy_line.index.max()),
)
ax.grid()
fig.legend()
ax.legend()
if config.getboolean('fig', 'enable', fallback=False):
fig.savefig(folders['fig'].joinpath(
f'bathy.{config.get("fig", "format")}'))
plt.show(block=True)