diff --git a/docs/appendix/yaml.rst b/docs/appendix/yaml.rst index 5f1f3030..3e496f71 100644 --- a/docs/appendix/yaml.rst +++ b/docs/appendix/yaml.rst @@ -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 ``nonlinear`` when nonlinear xticks including all thresholds are desired. Any other selection (default = None) will choose xticks that are equally spaced between min(threshold_list):max(threshold_list) and likely won't include all thresholds. + **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']) diff --git a/docs/applications/forecasts.rst b/docs/applications/forecasts.rst index f3b8e57b..ef18c42f 100644 --- a/docs/applications/forecasts.rst +++ b/docs/applications/forecasts.rst @@ -10,10 +10,10 @@ including a newly developed research forecast model called RAP-chem every day in near real time against the AirNow surface observations of ozone, PM\ :sub:`2.5`\, CO, and NO\ :sub:`2` and AERONET AOD measurements. -Check out the full analysis for each forecast `here `__. +Check out the full analysis for each forecast `here `__. This includes a new feature developed by NOAA GSL summer student, Mackenzie Arnold, -to `interactively view plots for individual surface sites online `__. +to `interactively view plots for individual surface sites online `__. The code to produce this analysis using MELODIES MONET is in the ``examples/forecast_evaluation`` folder on GitHub. diff --git a/melodies_monet/driver.py b/melodies_monet/driver.py index 1b3eec94..543b470f 100644 --- a/melodies_monet/driver.py +++ b/melodies_monet/driver.py @@ -1502,6 +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'] + threshold_tick_style = grp_dict.get('threshold_tick_style',None) # first get the observational obs labels pair1 = self.paired[list(self.paired.keys())[0]] @@ -2392,7 +2393,8 @@ def plotting(self): text_dict=text_dict, domain_type=domain_type, domain_name=domain_name, - model_name_list=model_name_list) + model_name_list=model_name_list, + threshold_tick_style=threshold_tick_style) #save figure plt.tight_layout() savefig(outname +'.'+score_name+'.png', loc=1, logo_height=100) diff --git a/melodies_monet/plots/surfplots.py b/melodies_monet/plots/surfplots.py index 8e541343..9cafd4b1 100755 --- a/melodies_monet/plots/surfplots.py +++ b/melodies_monet/plots/surfplots.py @@ -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): +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 @@ -1566,7 +1566,10 @@ def Plot_CSI(score_name_input,threshold_list_input, comb_bx_input,plot_dict,fig_ #Make Plot for i in range(len(CSI_output)): - plt.plot(threshold_list,CSI_output[i],'-*',label=model_name_list[i]) #CHANGE THIS ONE, MAIN PROGRAM + if threshold_tick_style == 'nonlinear': + 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]) ax.set_xlabel('Threshold',fontsize = text_kwargs['fontsize']*0.8) ax.set_ylabel(score_name_input,fontsize = text_kwargs['fontsize']*0.8) ax.tick_params(labelsize=text_kwargs['fontsize']*0.8) @@ -1575,8 +1578,14 @@ def Plot_CSI(score_name_input,threshold_list_input, comb_bx_input,plot_dict,fig_ plt.grid() #add '>' to xticks - labels = ['>'+item.get_text() for item in ax.get_xticklabels()] - ax.set_xticklabels(labels) + if threshold_tick_style == 'nonlinear': + 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) + else: + labels = ['>'+item.get_text() for item in ax.get_xticklabels()] + ax.set_xticklabels(labels) + if domain_type is not None and domain_name is not None: if domain_type == 'epa_region': ax.set_title('EPA Region ' + domain_name,fontweight='bold',**text_kwargs)