Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
Change option name from xtick_style to threshold_tick_style
Change option value from 'equal' to 'unique'
  • Loading branch information
jordanschnell committed Nov 6, 2024
1 parent 1b15021 commit 3cf9ebe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/appendix/yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ for csi plot, list of model names (only) user choose to set as labels.

**score_name:** csi plot only. list of scores user can choose to plot. examples are "Critical Success Index' 'False Alarm Rate' 'Hit Rate'.

**threshold_tick_style:** csi plot only. (optional) control for spacing of threshold (x-axis) ticks. example: use ``unique`` when a unique xtick for each threshold value is desired. Any other selection (default = None) will choose xticks that are equally spaced between min(threshold_list):max(threshold_list).

**data:** This a list of model / observation pairs to be plotted where the
observation label is first and the model label is second
(e.g., ['airnow_cmaq_expt', 'airnow_rrfs_13km', 'airnow_wrfchem_v4.2'])
Expand Down
4 changes: 2 additions & 2 deletions melodies_monet/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ def plotting(self):
threshold_list = grp_dict['threshold_list']
score_name = grp_dict['score_name']
model_name_list = grp_dict['model_name_list']
xtick_style = grp_dict.get('xtick_style',None)
threshold_tick_style = grp_dict.get('threshold_tick_style',None)

# first get the observational obs labels
pair1 = self.paired[list(self.paired.keys())[0]]
Expand Down Expand Up @@ -2394,7 +2394,7 @@ def plotting(self):
domain_type=domain_type,
domain_name=domain_name,
model_name_list=model_name_list,
xtick_style=xtick_style)
threshold_tick_style=threshold_tick_style)
#save figure
plt.tight_layout()
savefig(outname +'.'+score_name+'.png', loc=1, logo_height=100)
Expand Down
6 changes: 3 additions & 3 deletions melodies_monet/plots/surfplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ def Calc_Score(score_name_input,threshold_input, model_input, obs_input):

return output_score

def Plot_CSI(score_name_input,threshold_list_input, comb_bx_input,plot_dict,fig_dict,text_dict,domain_type,domain_name,model_name_list,xtick_style):
def Plot_CSI(score_name_input,threshold_list_input, comb_bx_input,plot_dict,fig_dict,text_dict,domain_type,domain_name,model_name_list,threshold_tick_style):

CSI_output = [] #(2, threshold len)
threshold_list = threshold_list_input
Expand Down Expand Up @@ -1566,7 +1566,7 @@ def Plot_CSI(score_name_input,threshold_list_input, comb_bx_input,plot_dict,fig_

#Make Plot
for i in range(len(CSI_output)):
if xtick_style == 'equal':
if threshold_tick_style == 'unique':
plt.plot(range(len(threshold_list)),CSI_output[i],'-*',label=model_name_list[i])
else:
plt.plot(threshold_list,CSI_output[i],'-*',label=model_name_list[i])
Expand All @@ -1578,7 +1578,7 @@ def Plot_CSI(score_name_input,threshold_list_input, comb_bx_input,plot_dict,fig_
plt.grid()

#add '>' to xticks
if xtick_style == 'equal':
if threshold_tick_style == 'unique':
threshold_string_array = [str(x) for x in threshold_list]
labels = ['>'+item for item in threshold_string_array]
ax.set_xticks(range(len(threshold_list)),labels=labels)
Expand Down

0 comments on commit 3cf9ebe

Please sign in to comment.