# Ask GRASS GIS where its Python packages are.
sys.path.append(
subprocess.check_output(["grass", "--config", "python_path"], text=True).strip()
)
# Import the GRASS GIS packages we need.
import grass.script as gs
# Import GRASS Jupyter
import grass.jupyter as gjSensitivity Analysis
Combines the output from r.univar for each model output into a signle dataframe and CSV file for analysis.
results_df = pd.read_csv(os.path.join("output", "combined_stats", 'combined_analysis_7.csv'))
results_df.info()<class 'pandas.core.frame.DataFrame'>
RangeIndex: 5052 entries, 0 to 5051
Data columns (total 26 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Unnamed: 0 5052 non-null int64
1 n 5052 non-null int64
2 null_cells 5052 non-null int64
3 cells 5052 non-null int64
4 min 5052 non-null float64
5 max 5052 non-null float64
6 range 5052 non-null float64
7 mean 5052 non-null float64
8 mean_of_abs 5052 non-null float64
9 stddev 5052 non-null float64
10 variance 5052 non-null float64
11 coeff_var 5048 non-null float64
12 sum 5052 non-null float64
13 first_quartile 5052 non-null float64
14 median 5052 non-null float64
15 third_quartile 5052 non-null float64
16 percentiles 5052 non-null object
17 run_time 5052 non-null float64
18 particles 5052 non-null float64
19 area_km2 5052 non-null float64
20 resolution 5052 non-null int64
21 scalar 5052 non-null int64
22 minute 5052 non-null int64
23 stat_type 5052 non-null object
24 ars 5004 non-null float64
25 Location 5052 non-null object
dtypes: float64(16), int64(7), object(3)
memory usage: 1.0+ MB
Extracts the history of each model output step to get values returned by SIMWE.
model_runs_df = pd.read_csv(os.path.join("output", "combined_stats", 'combined_simulations_7.csv'))
model_runs_df.info()<class 'pandas.core.frame.DataFrame'>
RangeIndex: 8346 entries, 0 to 8345
Data columns (total 25 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Unnamed: 0 8346 non-null int64
1 init.walk 8346 non-null int64
2 maxwalk 8346 non-null int64
3 remaining walkers 8346 non-null int64
4 duration (sec.) 8346 non-null int64
5 mean man 8346 non-null float64
6 mean infil 8346 non-null float64
7 Location 8346 non-null object
8 map_name 8346 non-null object
9 Cells 8346 non-null int64
10 Min Depth (m) 8346 non-null float64
11 Max Depth (m) 8346 non-null float64
12 Seed 8346 non-null int64
13 Resolution (m) 8346 non-null int64
14 scalar_str 8346 non-null int64
15 Particle Scalar 8346 non-null float64
16 Number of iterations (cells) 8346 non-null int64
17 Mean flow velocity (m/s) 8346 non-null float64
18 Time Step (s) 8346 non-null float64
19 Time at Step (s) 8346 non-null float64
20 Time at Step (min) 8346 non-null float64
21 Mean Source Rate (Rain Fall Excess) (m/s) 8346 non-null float64
22 Compute Time (s) 8346 non-null float64
23 particles 8346 non-null float64
24 Particle Density 8346 non-null float64
dtypes: float64(13), int64(10), object(2)
memory usage: 1.6+ MB
sns.pairplot(model_runs_df, hue="Resolution (m)", kind="scatter")sns.pairplot(model_runs_df, hue="Location", kind="scatter")grouped_results_df = (results_df.groupby(by=['resolution', 'scalar', 'Location', 'stat_type', 'minute'])
.agg({
'run_time': 'mean',
'particles': 'mean',
'cells': 'mean',
# 'area_km2': 'max',
# 'p_density': 'max',
# "minute": "mean",
'mean': "mean",
'ars': "mean",
# "std": "mean",
"max": "mean",
"min": "mean",
"stddev": "mean"
})
.reset_index()
)
grouped_results_df['log10(particles)'] = np.log10(grouped_results_df['particles'])
grouped_results_df['log10(run_time)'] = np.log10(grouped_results_df['run_time'])
grouped_results_df['log10(ars)'] = np.log10(grouped_results_df['ars'])
grouped_results_df['run_time_min'] = grouped_results_df['run_time'] / 60.0
grouped_results_df.head()| resolution | scalar | Location | stat_type | minute | run_time | particles | cells | mean | ars | max | min | stddev | log10(particles) | log10(run_time) | log10(ars) | run_time_min | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 1 | SFREC | average | 10 | 2780.749446 | 363592.0 | 491046.0 | 0.011785 | 0.960214 | 1.383436 | 0.000253 | 0.033582 | 5.560614 | 3.444162 | -0.017632 | 46.345824 |
| 1 | 1 | 1 | SFREC | average | 20 | 2780.749446 | 363592.0 | 491046.0 | 0.013080 | 0.960214 | 2.766822 | 0.000253 | 0.059275 | 5.560614 | 3.444162 | -0.017632 | 46.345824 |
| 2 | 1 | 1 | SFREC | average | 30 | 2780.749446 | 363592.0 | 491046.0 | 0.014045 | 0.960214 | 3.785676 | 0.000253 | 0.079292 | 5.560614 | 3.444162 | -0.017632 | 46.345824 |
| 3 | 1 | 1 | SFREC | average | 40 | 2780.749446 | 363592.0 | 491046.0 | 0.014865 | 0.960214 | 4.645530 | 0.000253 | 0.096456 | 5.560614 | 3.444162 | -0.017632 | 46.345824 |
| 4 | 1 | 1 | SFREC | average | 50 | 2780.749446 | 363592.0 | 491046.0 | 0.015598 | 0.960214 | 5.409575 | 0.000253 | 0.111816 | 5.560614 | 3.444162 | -0.017632 | 46.345824 |
model_runs_df.info()
# grouped_results_df['log10(particles)'] = np.log10(grouped_results_df['particles'])
model_runs_df['log10(Compute Time (s))'] = np.log10(model_runs_df['Compute Time (s)'])
# grouped_results_df['run_time_min'] = grouped_results_df['run_time'] / 60.0
# grouped_results_df.head()<class 'pandas.core.frame.DataFrame'>
RangeIndex: 8346 entries, 0 to 8345
Data columns (total 25 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Unnamed: 0 8346 non-null int64
1 init.walk 8346 non-null int64
2 maxwalk 8346 non-null int64
3 remaining walkers 8346 non-null int64
4 duration (sec.) 8346 non-null int64
5 mean man 8346 non-null float64
6 mean infil 8346 non-null float64
7 Location 8346 non-null object
8 map_name 8346 non-null object
9 Cells 8346 non-null int64
10 Min Depth (m) 8346 non-null float64
11 Max Depth (m) 8346 non-null float64
12 Seed 8346 non-null int64
13 Resolution (m) 8346 non-null int64
14 scalar_str 8346 non-null int64
15 Particle Scalar 8346 non-null float64
16 Number of iterations (cells) 8346 non-null int64
17 Mean flow velocity (m/s) 8346 non-null float64
18 Time Step (s) 8346 non-null float64
19 Time at Step (s) 8346 non-null float64
20 Time at Step (min) 8346 non-null float64
21 Mean Source Rate (Rain Fall Excess) (m/s) 8346 non-null float64
22 Compute Time (s) 8346 non-null float64
23 particles 8346 non-null float64
24 Particle Density 8346 non-null float64
dtypes: float64(13), int64(10), object(2)
memory usage: 1.6+ MB
sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=model_runs_df,
x="particles",
y="init.walk",
hue="Location",
style="Resolution (m)",
# size="scalar",
err_style="bars",
# errorbar=("se", 2),
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.xlabel("nwalk", fontsize=26)
plt.ylabel("init.walk", fontsize=26)
# plt.title("Resolution vs Run Time")
plt.savefig(f"../output/nwalk_init_walk.png")/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=model_runs_df,
x="Resolution (m)",
y="log10(Compute Time (s))",
hue="Location",
style="Particle Density",
# size="scalar",
err_style="bars",
# errorbar=("se", 2),
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.xlabel("Resolution (m)", fontsize=26)
plt.ylabel("log10(Compute Time (s))", fontsize=26)
# plt.title("Resolution vs Run Time")
plt.savefig(f"../output/compute_time_by_resolution.png")/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
# model_runs_df['log10(run_time)'] = np.log10(model_runs_df['run_time'])
sns.lineplot(
data=model_runs_df,
x="Particle Density",
y="log10(Compute Time (s))",
hue="Location",
style="Resolution (m)",
# size="AR",
err_style="bars",
# errorbar=("se", 2),
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
# g = sns.JointGrid(data=model_runs_df, x="Particle Density", y="log10(run_time)", space=0)
# g.plot_joint(sns.kdeplot,
# fill=True, clip=((0, 3), (-2.0, 3.0)),
# thresh=0, levels=100, cmap="rocket")
# g.plot_marginals(sns.histplot, palette="rocket", hue="Location", alpha=1, bins=25, data=model_runs_df)
plt.xticks([0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2])
plt.xlabel("Particle Density", fontsize=26)
plt.ylabel("log10(Compute Time (s))", fontsize=26)
plt.savefig(f"../output/compute_time_by_particle_density.png")/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=model_runs_df,
x="Time at Step (min)",
y="Max Depth (m)",
hue="Location",
style="Resolution (m)",
size="Resolution (m)",
err_style="bars",
# errorbar=("se", 2),
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.xlabel("Time at Step (min)", fontsize=26)
plt.ylabel("Max Depth (m)", fontsize=26)
# plt.title("Simulation Time Step vs Max Water Depth")
plt.savefig(f"../output/simulated_timestep_max_water_depth.png")/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
sns.set_theme(style="darkgrid")
sns.set_context("paper")
sns.color_palette("crest", as_cmap=True)
g = sns.catplot(
data=model_runs_df,
x="Time at Step (min)",
y="Mean flow velocity (m/s)",
hue="Location",
col="Particle Density",
row="Resolution (m)",
palette="YlGnBu_d",
sharex=False,
sharey=False,
# errorbar="se",
kind="strip",
height=6, aspect=.75,
)
g.despine(left=True)/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/axisgrid.py:118: UserWarning: The figure layout has changed to tight
self._figure.tight_layout(*args, **kwargs)
sns.set_theme(style="darkgrid")
sns.set_context("paper")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=results_df,
x="resolution",
y="run_time",
hue="Location",
style="scalar",
# size="scalar",
err_style="bars", errorbar=("se", 2),
palette="magma",
markers=True,
alpha=0.75,
# errorbar=('ci', 95),
)
plt.title("Resolution vs Run Time")sns.set_theme(style="darkgrid")
sns.set_context("paper")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=results_df,
x="scalar",
y="run_time",
hue="Location",
style="resolution",
# size="scalar",
err_style="bars", #errorbar=("se", 2),
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
plt.title("Particles Density vs Run Time")
# plt.savefig(f"../output/agu2024_particles_run_time.png")sns.set_theme(style="darkgrid")
sns.set_context("paper")
sns.color_palette("crest", as_cmap=True)
# fig, ax = plt.subplots(figsize=(12, 8))
sns.relplot(
data=results_df, x="resolution", y="run_time",
col="Location",
hue="Location", style="scalar",
kind="line"
)
# sns.lineplot(
# data=grouped_results_df,
# x="scalar",
# y="run_time",
# hue="site_name",
# style="resolution",
# # size="scalar",
# err_style="bars", #errorbar=("se", 2),
# palette="magma",
# markers=True,
# alpha=0.75,
# errorbar=('ci', 95),
# )
plt.title("Particles Density vs Run Time")/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.
with pd.option_context('mode.use_inf_as_na', True):
/home/coreywhite/.local/lib/python3.10/site-packages/seaborn/axisgrid.py:118: UserWarning: The figure layout has changed to tight
self._figure.tight_layout(*args, **kwargs)
Text(0.5, 1.0, 'Particles Density vs Run Time')
sns.relplot(
data=results_df, x="particles", y="run_time",
col="Location",
hue="Location", style="scalar",
kind="line"
)sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
# sns.lineplot(
# data=grouped_results_df.query("stat_type == 'average'"),
# # x="p_density",
# x="ars",
# y="max",
# # y="run_time_min",
# hue="site_name",
# size="scalar",
# palette="crest_r",
# markers=True,
# # style='resolution',
# alpha=0.75,
# errorbar=('ci', 95)
# )
# ax2 = plt.twinx()
sns.lineplot(
data=grouped_results_df.query("stat_type == 'average'"),
# x="p_density",
x="ars",
y="run_time",
# y="run_time_min",
hue="Location",
# size="resolution",
palette="magma",
markers=True,
style='resolution',
alpha=0.75,
errorbar=('ci', 95),
# ax=ax2
)
plt.xlabel("ARS", fontsize=26)
plt.ylabel("Compute Time (s)", fontsize=26)
# plt.title("Run time vs. ARS", fontsize=32)
# plt.legend(title="Particle Density", fontsize=18)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1.25,1))
# sns.move_legend(ax2, "upper left", bbox_to_anchor=(1.25,0.25))
# ax2.set_ylabel("Resolution (m)", fontsize=26)
# plt.savefig(os.path.join("../output", site, mapset, f'{site}_run_time_res_line_plot.png'))
plt.savefig(f"../output/sensitivity7_run_time_ars_plot.png")
plt.show()# g = sns.JointGrid(data=grouped_results_df.query("stat_type == 'average'"), x="ars", y="run_time", space=0)
# g.plot_joint(sns.kdeplot,
# fill=True, clip=((0, 3), (0, 200)),
# thresh=0, levels=100, cmap="rocket")
# g.plot_marginals(sns.histplot, color="#03051A", alpha=1, bins=25)
# Plot sepal width as a function of sepal_length across days
g = sns.lmplot(
data=grouped_results_df.query("stat_type == 'average'"),
x="ars", y="run_time", hue="Location",
height=5
)
# Use more informative axis labels than are provided by default
g.set_axis_labels("ARS", "Compute Time (Sec)")sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.despine(fig, left=True, bottom=True)
# scalar_ranking = ["I1", "SI2", "SI1", "VS2", "VS1", "VVS2", "VVS1", "IF"]
sns.scatterplot(
# x="ars",
# y="run_time",
x="log10(ars)",
y="log10(run_time)",
hue="Location", size="resolution",
style="scalar",
# palette="ch:r=-.2,d=.3_r",
palette="magma",
# hue_order=clarity_ranking,
sizes=(10, 50), linewidth=0,
data=grouped_results_df.query("stat_type == 'average'"), ax=ax
)
# sns.regplot(
# data=grouped_results_df.query("stat_type == 'average' and Location == 'clay-center'"),
# x="ars",
# y="run_time",
# order=2,
# color="black",
# ci=95,
# scatter=False,
# line_kws=dict(linewidth=1, linestyle="--"),
# )
# sns.regplot(
# data=grouped_results_df.query("stat_type == 'average' and Location == 'coweeta'"),
# x="ars",
# y="run_time",
# order=2,
# color="black",
# ci=95,
# scatter=False,
# line_kws=dict(linewidth=1, linestyle="--"),
# )
# sns.regplot(
# data=grouped_results_df.query("stat_type == 'average' and Location == 'SJER'"),
# x="ars",
# y="run_time",
# order=2,
# color="black",
# ci=95,
# scatter=False,
# line_kws=dict(linewidth=1, linestyle="--"),
# )
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.xlabel("ARS", fontsize=26)
plt.ylabel("log10(Compute Time (Sec))", fontsize=26)
plt.savefig(f"../output/sensitivity7_ars_run_time_loc_res_scalar_plot.png")sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=grouped_results_df,
x="log10(particles)",
y="log10(run_time)",
hue="Location",
# size="resolution",
style="resolution",
# weights="error",
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
plt.xlabel("log10(Particles)", fontsize=26)
plt.ylabel("log10(Compute Time (s))", fontsize=26)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
# plt.title("Particles vs Run Time")
# plt.savefig(f"../output/agu2024_particles_run_time.png")
plt.savefig(f"../output/particles_run_time.png")sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=grouped_results_df,
x="cells",
y="log10(particles)",
hue="Location",
style="scalar",
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.title("Particles vs Resolution")
# plt.savefig(f"../output/agu2024_particles_resolution.png")sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=grouped_results_df.query("stat_type == 'average'"),
x="log10(particles)",
y="log10(run_time)",
hue="cells",
style="Location",
# size="scalar",
palette="magma_r",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.xlabel("log10(Particles)", fontsize=26)
plt.ylabel("log10(Compute Time (s))", fontsize=26)
# plt.title("ARS vs log10(Run Time)")
plt.savefig(f"../output/agu2024_ars_run_time.png")sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=grouped_results_df.query("stat_type == 'average'"),
x="log10(particles)",
y="max",
hue="Location",
# style="minute",
palette="magma_r",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.title("log10(particles) by Max Depth")sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=grouped_results_df.query("stat_type == 'average'"),
x=grouped_results_df.query("stat_type == 'average'")["minute"].astype(int),
y="mean",
hue="Location",
style="resolution",
size="resolution",
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
# plt.title("Mean Depth by Output Step")
plt.xlabel("Output Step (Minutes)", fontsize=26)
plt.ylabel("Mean Depth (m)", fontsize=26)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.savefig(f"../output/agu2024_minute_mean_resolution.png")sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=grouped_results_df.query("stat_type == 'maximum'"),
x=grouped_results_df.query("stat_type == 'maximum'")["minute"].astype(int),
y="mean",
hue="Location",
size="resolution",
style="resolution",
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
plt.xlabel("Output Step (Minutes)", fontsize=26)
plt.ylabel("Maximum Depth (m)", fontsize=26)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
# plt.title("Maximum Depth by Output Step")
plt.savefig(f"../output/agu2024_minute_max_resolution.png")sns.set_theme(style="darkgrid")
sns.set_context("paper")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=grouped_results_df.query("stat_type == 'minimum'"),
x=grouped_results_df.query("stat_type == 'minimum'")["minute"].astype(int),
y="mean",
hue="Location",
style="resolution",
size="resolution",
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
# plt.title("Min Depth by Time Step")
plt.xlabel("Output Step (Minutes)", fontsize=26)
plt.ylabel("Minimum Depth (m)", fontsize=26)
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.savefig(f"../output/agu2024_minute_min_resolution.png")sns.set_theme(style="darkgrid")
sns.set_context("talk")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=grouped_results_df.query("stat_type == 'stddev'"),
x=grouped_results_df.query("stat_type == 'stddev'")["minute"].astype(int),
y="mean",
hue="Location",
style="resolution",
size="resolution",
palette="magma",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
plt.title("Stddev Depth by Time Step")
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.savefig(f"../output/agu2024_minute_std_resolution.png")sns.set_theme(style="darkgrid")
sns.set_context("paper")
sns.color_palette("crest", as_cmap=True)
fig, ax = plt.subplots(figsize=(12, 8))
sns.lineplot(
data=grouped_results_df.query("stat_type == 'average' & Location == 'clay-center'"),
x=grouped_results_df.query("stat_type == 'average' & Location == 'clay-center'")["minute"].astype(int),
y="mean",
hue="resolution",
# style="resolution",
size="scalar",
palette="summer",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
sns.lineplot(
data=grouped_results_df.query("stat_type == 'average' & Location == 'SJER'"),
x=grouped_results_df.query("stat_type == 'average' & Location == 'SJER'")["minute"].astype(int),
y="mean",
hue="resolution",
# style="scalar",
size="scalar",
palette="cool",
markers=True,
alpha=0.75,
errorbar=('ci', 95),
)
plt.title("Min Depth by Time Step")
plt.savefig(f"../output/agu2024_minute_average_scalar.png")