Skip to content

Commit

Permalink
modified colorbar label and updated jupyter notebooks in docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
schwemro committed Mar 9, 2021
1 parent d63dfc4 commit 37aff98
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 76 deletions.
8 changes: 4 additions & 4 deletions de/de.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ def diag_polar_plot(obs, sim, sort=True, l=0.05, extended=False):
cbar = fig.colorbar(
dummie_cax, ax=ax, orientation="horizontal", ticks=[1, 0.5, 0], shrink=0.8
)
cbar.set_label("r [-]", labelpad=4)
cbar.set_label("r [-]\nTiming error", labelpad=4)
cbar.set_ticklabels(["1", "0.5", "<0"])
cbar.ax.tick_params(direction="in")

Expand Down Expand Up @@ -1348,7 +1348,7 @@ def diag_polar_plot(obs, sim, sort=True, l=0.05, extended=False):
cbar = fig.colorbar(
dummie_cax, ax=ax, orientation="horizontal", ticks=[1, 0.5, 0], shrink=0.8
)
cbar.set_label("r [-]", labelpad=4)
cbar.set_label("r [-]\nTiming error", labelpad=4)
cbar.set_ticklabels(["1", "0.5", "<0"])
cbar.ax.tick_params(direction="in")

Expand Down Expand Up @@ -1735,7 +1735,7 @@ def diag_polar_plot_multi(
cbar = fig.colorbar(
dummie_cax, ax=ax, orientation="horizontal", ticks=[1, 0.5, 0], shrink=0.8
)
cbar.set_label("r [-]", labelpad=4)
cbar.set_label("r [-]\nTiming error", labelpad=4)
cbar.set_ticklabels(["1", "0.5", "<0"])
cbar.ax.tick_params(direction="in")

Expand Down Expand Up @@ -1992,7 +1992,7 @@ def diag_polar_plot_multi(
cbar = fig.colorbar(
dummie_cax, ax=ax, orientation="horizontal", ticks=[1, 0.5, 0], shrink=0.8
)
cbar.set_label("r [-]", labelpad=4)
cbar.set_label("r [-]\nTiming error", labelpad=4)
cbar.set_ticklabels(["1", "0.5", "<0"])
cbar.ax.tick_params(direction="in")

Expand Down
9 changes: 3 additions & 6 deletions de/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def plot_obs_sim_ax(obs, sim, ax, fig_num): # pragma: no cover


def diag_polar_plot_multi_fc(
brel_mean, b_area, temp_cor, eff_de, b_dir, phi, b_hf, b_lf, b_tot,
brel_mean, temp_cor, eff_de, b_dir, phi, b_hf, b_lf, b_tot,
err_hf, err_lf, fc, l=0.05, ax_lim=1.2
): # pragma: no cover
r"""Multiple polar plot of Diagnostic-Efficiency (DE)
Expand All @@ -292,9 +292,6 @@ def diag_polar_plot_multi_fc(
brel_mean : (N,)array_like
relative mean bias as 1-D array
b_area : (N,)array_like
bias area as 1-D array
temp_cor : (N,)array_like
temporal correlation as 1-D array
Expand Down Expand Up @@ -665,7 +662,7 @@ def diag_polar_plot_multi_fc(
cbar = fig.colorbar(
dummie_cax, ax=ax, orientation="horizontal", ticks=[1, 0.5, 0], shrink=0.8
)
cbar.set_label(r"r [-]", fontsize=12, labelpad=8)
cbar.set_label("r [-]\nTiming error", labelpad=4)
cbar.set_ticklabels(["1", "0.5", "<0"])
cbar.ax.tick_params(direction="in", labelsize=10)

Expand Down Expand Up @@ -880,7 +877,7 @@ def polar_plot_multi_fc(
cbar = fig.colorbar(
dummie_cax, ax=ax, orientation="horizontal", ticks=[1, 0.5, 0], shrink=0.8
)
cbar.set_label(r"r [-]", fontsize=12, labelpad=8)
cbar.set_label("r [-]\nTiming error", labelpad=4)
cbar.set_ticklabels(["1", "0.5", "<0"])
cbar.ax.tick_params(direction="in", labelsize=10)

Expand Down
28 changes: 16 additions & 12 deletions docs/tutorials/01_proof_of_concept.ipynb

Large diffs are not rendered by default.

148 changes: 106 additions & 42 deletions docs/tutorials/02_modelling_example.ipynb

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions paper_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
# ==========================================================
# 619.11 km2; AI: 0.82
area = 619.11
path = Path(os.path.join(os.getcwd(), "examples/13331500_streamflow_qc.txt"))
path = PATH / "examples" / "13331500_streamflow_qc.txt"
## 191.55 km2; AI: 2.04
# area = 191.55
# path = os.path.join(os.getcwd(),
# 'examples/06332515_streamflow_qc.txt')
# path = PATH / "examples" / "06332515_streamflow_qc.txt"
#
## 190.65 km2; AI: 2.98
# area = 190.65
# path = os.path.join(os.getcwd(),
# 'examples/09512280_streamflow_qc.txt')
# path = PATH / "examples" / "09512280_streamflow_qc.txt"
#
## 66.57 km2; AI: 0.27
# area = 66.57
# path = os.path.join(os.getcwd(),
# 'examples/12114500_streamflow_qc.txt')
# path = PATH / "examples" / "12114500_streamflow_qc.txt"
#

# import observed time series
df_ts = util.import_camels_ts(path, sep=r"\s+", catch_area=area)
Expand Down Expand Up @@ -1181,7 +1181,6 @@
idx = ["0", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m"]
ids = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
brel_mean_arr = df_es["brel_mean"].values[ids]
b_area_arr = df_es["b_area"].values[ids]
temp_cor_arr = df_es["temp_cor"].values[ids]
b_dir_arr = df_es["b_dir"].values[ids]
de_arr = df_es["de"].values[ids]
Expand All @@ -1194,7 +1193,7 @@
err_lf_arr = df_es["err_lf"].values[ids]

fig_de = util.diag_polar_plot_multi_fc(
brel_mean_arr, b_area_arr, temp_cor_arr, de_arr, b_dir_arr, phi_arr,
brel_mean_arr, temp_cor_arr, de_arr, b_dir_arr, phi_arr,
b_hf_arr, b_lf_arr, b_tot_arr, err_hf_arr, err_lf_arr, idx
)
path = Path(os.path.join(PATH_FIG, "de_diag.pdf"))
Expand Down Expand Up @@ -1708,7 +1707,6 @@
### multi diagnostic polar plot ###
# make arrays
brel_mean_arr = df_eff_cam["brel_mean"].values
b_area_arr = df_eff_cam["b_area"].values
temp_cor_arr = df_eff_cam["temp_cor"].values
b_dir_arr = df_eff_cam["b_dir"].values
de_arr = df_eff_cam["de"].values
Expand All @@ -1722,7 +1720,6 @@

fig_de = util.diag_polar_plot_multi_fc(
brel_mean_arr,
b_area_arr,
temp_cor_arr,
de_arr,
b_dir_arr,
Expand Down Expand Up @@ -1752,4 +1749,3 @@
PATH_FIG, "kge_diag_real_case.pdf"
))
fig_kge.savefig(path_pdf, dpi=250)

Binary file modified tests/images/de/multi/test_multi_diag_polar_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/de/single/test_single_diag_polar_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 37aff98

Please sign in to comment.