Skip to content

implement bar plot in FastEvaluation package #947

@iluise

Description

@iluise

Is your feature request related to a problem? Please describe.

Implement bar plots to visualize the Relative RMSE: experiment / reference between runs.

Describe the solution you'd like

Incorporate this code into the plotter:

import matplotlib.pyplot as plt
import numpy as np

fields = [
    "q_850",
]

data_ref = {
    "q_850": 1.125651E-03,
    "t_850": 1.151291E+00,
    "u_850": 1.916980E+00,
    "v_850": 1.840032E+00,
    "z_500": 1.075307E+02,
    "10u": 1.342692E+00,
    "10v": 1.363811E+00,
    "2t": 1.289473E+00,
}
# data_exp = {
#     "q_850": 1.147168E-03,
#     "t_850": 1.205859E+00,
#     "u_850": 1.968734E+00,
#     "v_850": 1.891413E+00,
#     "z_500": 1.216451E+02,
#     "10u": 1.214067,
#     "10v": 1.243045,
#     "2t": 1.068439E+00,
# }
data_exp = {
    "q_850": 1.122758E-03,
    "t_850": 1.146472E+00,
    "u_850": 1.918213E+00 ,
    "v_850": 1.836079E+00,
    "z_500": 1.096801E+02,
    "10u": 1.342595,
    "10v": 1.361598,
    "2t": 1.287225,
}



leg = []
vals = []
for k, v in data_ref.items():
    leg += [k]
    vals += [data_exp[k] / v]
vals = np.array(vals) - 1.0

cmap = plt.get_cmap("bwr")
vals_centered = 1.0 - ((vals / (vals / 0.5).min()) + 0.5)
colors = [cmap(v) for v in vals_centered]

fig = plt.figure(figsize=(10, 7), dpi=300)
ax = plt.gca()

ax.barh(np.arange(len(vals)), vals, color=colors, align="center", edgecolor="black", linewidth=0.5)
ax.set_yticks(np.arange(len(vals)), labels=leg)
ax.invert_yaxis()  # labels read top-to-bottom
ax.set_xlabel("Relative RMSE: experiment / reference")

plt.savefig("era5_no_adaln.png")

Describe alternatives you've considered

No response

Additional context

No response

Organisation

No response

Metadata

Metadata

Assignees

Labels

evalanything related to the model evaluation pipeline

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions