melodies_monet.plots.aircraftplots
aircraftplots.py this code is designed for plotting aircraft specific plot types
Functions
|
Creates secondary y-axis (altitude) for timeseries plot. |
|
Combines data into an acceptable format for violin plots, similar to calculate_boxplot for box plots. |
|
|
|
Creates a scatter density plot for the specified column (variable) in the paired DataFrame (df). |
|
Creates surface spatial bias plot. |
|
Creates altitude profile plot. |
|
Creates a violin plot using combined data from multiple model/observation datasets. |
- melodies_monet.plots.aircraftplots.add_yax2_altitude(ax, pairdf, altitude_yax2, text_kwargs, vmin_y2, vmax_y2)
Creates secondary y-axis (altitude) for timeseries plot.
- Parameters
ax (
ax
) – Matplotlib ax from previous occurrences so it can overlay obs and model results on the same plot.pairdf (
pandas.DataFrame
) – Model/obs paired data to plot.text_kwargs (
dictionary
) – Dictionary containing information about text.altitude_yax2 (
dictionary
) – Secondary y-axis (altitude) control options, including altitude_variable, altitude_ticks, etc.vmin_y2, vmax_y2 (
the value[0]
,value[1] respectively defined in filter_dict in altitude_yax2 in YAML control option
)
- Returns
ax (
ax
) – Matplotlib ax such that driver.py can iterate to overlay multiple models on the same plot.
- melodies_monet.plots.aircraftplots.calculate_violin(df, column=None, label=None, plot_dict=None, comb_violin=None, label_violin=None)
Combines data into an acceptable format for violin plots, similar to calculate_boxplot for box plots.
- Parameters
df (
pandas.DataFrame
) – DataFrame containing the model/obs paired data to plot.column (
str
) – Column label of the variable to plot.label (
str
) – Name of the variable to use in the plot legend.plot_dict (
dict
) – Dictionary containing color information for the plot.comb_violin (
pandas.DataFrame
) – DataFrame containing information to create violin plots from previous occurrences, to overlay multiple model results on one plot.label_violin (
list
) – List of dictionaries with string labels and colors to use in the violin plot from previous occurrences, to overlay multiple model results on one plot.
- Returns
comb_violin (
pandas.DataFrame
) – DataFrame containing information to create violin plots.label_violin (
list
) – List of dictionaries with string labels and colors to use in the violin plot.
- melodies_monet.plots.aircraftplots.make_scatter_density_plot(df, mod_var=None, obs_var=None, ax=None, color_map='viridis', xlabel=None, ylabel=None, title=None, fill=False, vmin_x=None, vmax_x=None, vmin_y=None, vmax_y=None, **kwargs)
Creates a scatter density plot for the specified column (variable) in the paired DataFrame (df).
- Parameters
df (
dataframe
) – Paired DataFrame containing the model and observation data to plotobs_var (
str
) – obs variable name in mapped pairsmod_var (
str
) – model variable name in mapped pairsax (
Matplotlib axis from a previous occurrence
tooverlay obs
andmodel results on the same plot
)color_map (
str
) – Colormap for the density (optional)xlabel (
str
) – Label for the x-axis (optional)ylabel (
str
) – Label for the y-axis (optional)title (
str
) – Title for the plot (optional)fill (
bool
) – Fill set to True for seaborn kde plot**kwargs (
dict
) – Additional keyword arguments for customization
- Returns
ax (
ax
) – Matplotlib ax such that driver.py can iterate to overlay multiple models on the same plot.
- melodies_monet.plots.aircraftplots.make_spatial_bias(df, df_reg=None, column_o=None, label_o=None, column_m=None, label_m=None, ylabel=None, ptile=None, vdiff=None, outname='plot', domain_type=None, domain_name=None, fig_dict=None, text_dict=None, debug=False)
Creates surface spatial bias plot.
- Parameters
df (
pandas.DataFrame
) – model/obs paired data to plotdf_reg (
pandas.DataFrame
) – model/obs paired regulatory data to plotcolumn_o (
str
) – Column label of observation variable to plotlabel_o (
str
) – Name of observation variable to use in plot titlecolumn_m (
str
) – Column label of model variable to plotlabel_m (
str
) – Name of model variable to use in plot titleylabel (
str
) – Title of colorbar axisptile (
integer
) – Percentile calculationvdiff (
float
) – Min and max value to use on colorbar axisoutname (
str
) – file location and name of plot (do not include .png)domain_type (
str
) – Domain type specified in input yaml filedomain_name (
str
) – Domain name specified in input yaml filefig_dict (
dictionary
) – Dictionary containing information about figuretext_dict (
dictionary
) – Dictionary containing information about textdebug (
boolean
) – Whether to plot interactively (True) or not (False). Flag for submitting jobs to supercomputer turn off interactive mode.
- Returns
plot
– surface bias plot
- melodies_monet.plots.aircraftplots.make_vertprofile(df, column=None, label=None, ax=None, bins=None, altitude_variable=None, ylabel=None, vmin=None, vmax=None, domain_type=None, domain_name=None, plot_dict=None, fig_dict=None, text_dict=None, debug=False, interquartile_style=None)
Creates altitude profile plot.
- Parameters
df (
pandas.DataFrame
) – Model/obs paired data to plot.column (
str
) – Column label of variable to plot.label (
str
) – Name of variable to use in plot legend.ax (
ax
) – Matplotlib ax from previous occurrence so it can overlay obs and model results on the same plot.bins (
int
orarray-like
) – Bins for binning the altitude variable.altitude_variable (
str
) – The Altitude variable in the paired df e.g., ‘MSL_GPS_Altitude_YANG’ylabel (
str
) – Title of y-axis.vmin (
float
) – Min value to use on y-axis.vmax (
float
) – Max value to use on y-axis.domain_type (
str
) – Domain type specified in input yaml filedomain_name (
str
) – Domain name specified in input yaml fileplot_dict (
dictionary
) – Dictionary containing information about plotting for each pair (e.g., color, linestyle, markerstyle).fig_dict (
dictionary
) – Dictionary containing information about the figure.text_dict (
dictionary
) – Dictionary containing information about text.debug (
bool
) – Whether to plot interactively (True) or not (False). Flag for submitting jobs to supercomputer turn off interactive mode.interquartile_style= str – Whether the vertical profile uses shading or box style for interquartile range
- Returns
ax (
ax
) – Matplotlib ax such that driver.py can iterate to overlay multiple models on the same plot.
- melodies_monet.plots.aircraftplots.make_violin_plot(comb_violin, label_violin, outname='plot', domain_type=None, domain_name=None, fig_dict=None, text_dict=None, debug=False, ylabel=None, vmin=None, vmax=None)
Creates a violin plot using combined data from multiple model/observation datasets.
- Parameters
comb_violin (
pandas.DataFrame
) – DataFrame containing combined data for all datasets to be plotted.label_violin (
list
) – List of dictionaries with string labels and colors to use in the violin plot.outname (
str
) – File location and name of plot (do not include .png).domain_type (
str
) – Domain type specified in the input yaml file.domain_name (
str
) – Domain name specified in the input yaml file.fig_dict (
dict
) – Dictionary containing information about figure properties.text_dict (
dict
) – Dictionary containing information about text properties.debug (
bool
) – If True, the plot will be shown interactively. Useful for debugging.ylabel (
str
, optional) – The label for the y-axis.vmin (
float
, optional) – The minimum value for the y-axis.vmax (
float
, optional) – The maximum value for the y-axis.
- Returns
None