Skip to content

Commit

Permalink
plot over station for observation
Browse files Browse the repository at this point in the history
  • Loading branch information
ERKuipers committed Dec 18, 2024
1 parent 942aba4 commit bc084b5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions comparison/visualization/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, DataDir, vector_adminMap):
]#['tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan', ] # adjust pls if you want
self.linestyles = ['-', '--','-.' ]
self.markerstyles =['o','v', 's']
self.comparisonTypes = ['Observation', 'Impact']
self.comparisonTypes = ['Observation']#, 'Impact']
self.DataDir=DataDir
self.gdf_shape=checkVectorFormat(vector_adminMap, shapeType='polygon')
self.cmap_r = 'RdYlBu_r' # 'cmc.batlow_r' # Reversed for FAR
Expand Down Expand Up @@ -229,7 +229,7 @@ def performance_over_leadtime_all(self, admin_units, standard_RP=5): #, standard
plt.savefig(filePath)
plt.show()

def performance_over_return_period_all(self, admin_units, standard_leadtime=168):
def performance_over_return_period_all(self, admin_units, standard_leadtime=168, thresholdtype='return_periods'):
data_all_admin = []
for admin_unit in admin_units:
data = collect_performance_measures_over_station(admin_unit, self.DataDir, cfg.leadtimes, cfg.RPsyr, cfg.percentiles)
Expand All @@ -249,13 +249,13 @@ def performance_over_return_period_all(self, admin_units, standard_leadtime=168)
for model, marker in zip(self.models, self.markerstyles):
for comparison_type, linestyle in zip(self.comparisonTypes, self.linestyles):
ax.plot(return_periods,
data_all_admin[admin_units.index(admin_unit)][1]['POD'][model][comparison_type][:, lt_idx],
data_all_admin[admin_units.index(admin_unit)][1]['POD'][model][comparison_type][thresholdtype][:, lt_idx],
color=color,
linestyle=linestyle,
marker=marker,
markersize=self.markersize)

ax.set_xlabel('Return Period (years)')
ax.set_xlabel(f'{thresholdtype}')
ax.set_ylabel('POD')
ax.set_xlim(RP_x_lim)
ax.set_ylim([-0.05, 1.05])
Expand All @@ -269,7 +269,7 @@ def performance_over_return_period_all(self, admin_units, standard_leadtime=168)
for model, marker in zip(self.models, self.markerstyles):
for comparison_type, linestyle in zip(self.comparisonTypes, self.linestyles):
ax.plot(return_periods,
data_all_admin[admin_units.index(admin_unit)][1]['FAR'][model][comparison_type][:, lt_idx],
data_all_admin[admin_units.index(admin_unit)][1]['FAR'][model][comparison_type][thresholdtype][:, lt_idx],
color=color,
linestyle=linestyle,
marker=marker,
Expand All @@ -285,7 +285,7 @@ def performance_over_return_period_all(self, admin_units, standard_leadtime=168)
from matplotlib.lines import Line2D
custom_lines = [
Line2D([0], [0], color='black', linestyle=self.linestyles[0], label='Observation'),
Line2D([0], [0], color='black', linestyle=self.linestyles[1], label='Impact'),
#Line2D([0], [0], color='black', linestyle=self.linestyles[1], label='Impact'),
#Line2D([0], [0], color='black', linestyle=self.linestyles[2], label='PTM'),
Line2D([0], [0], color='black', marker=self.markerstyles[0], linestyle='None', label='GloFAS'),
Line2D([0], [0], color='black', marker=self.markerstyles[1], linestyle='None', label='Google Flood Hub'),
Expand Down

0 comments on commit bc084b5

Please sign in to comment.