melodies_monet.plots.surfplots
Functions
|
|
|
|
|
List of default colors, lines, and markers to use if user does not specify them in the input yaml file. |
|
Combines data into acceptable format for box-plot |
|
get UTC offset in hour based on a point (lat/lon) |
|
Calculates 24-hour averages |
|
Calculates 8-hour rolling average daily |
|
Creates box-plot. |
|
Creates surface spatial bias plot. |
|
Creates surface spatial bias plot. |
|
Creates spatial overlay plot. |
|
Creates taylor plot. |
|
Creates timeseries plot. |
|
Define map projection. |
Creates new color map for difference plots |
- melodies_monet.plots.surfplots.calc_default_colors(p_index)
List of default colors, lines, and markers to use if user does not specify them in the input yaml file.
- Parameters
p_index (
integer
) – Number of pairs in analysis class- Returns
list
– List of dictionaries containing default colors, lines, and markers to use for plotting for the number of pairs in analysis class
- melodies_monet.plots.surfplots.calculate_boxplot(df, df_reg=None, column=None, label=None, plot_dict=None, comb_bx=None, label_bx=None)
Combines data into acceptable format for box-plot
- Parameters
df (
pandas.DataFrame
) – model/obs paired data to plotdf_reg (
pandas.DataFrame
) – model/obs paired regulatory data to plotcolumn (
str
) – Column label of variable to plotlabel (
str
) – Name of variable to use in plot legendcomb_bx (
dataframe
) – dataframe containing information to create box-plot from previous occurrence so can overlay multiple model results on plotlabel_bx (
list
) – list of string labels to use in box-plot from previous occurrence so can overlay multiple model results on plot
- Returns
dataframe
,list
– dataframe containing information to create box-plot list of string labels to use in box-plot
- melodies_monet.plots.surfplots.get_utcoffset(lat, lon)
get UTC offset in hour based on a point (lat/lon)
- Parameters
lat – Latitude (deg; -90. to 90.)
lon – Longitude (deg; -180. to 180.)
- Returns
UTC offset in hour
- melodies_monet.plots.surfplots.make_24hr_regulatory(df, col=None)
Calculates 24-hour averages
- Parameters
df (
dataframe
) – Model/obs pair of hourly datacol (
str
) – Column label of observation variable to apply the calculation
- Returns
dataframe
– dataframe with applied calculation
- melodies_monet.plots.surfplots.make_8hr_regulatory(df, col=None)
Calculates 8-hour rolling average daily
- Parameters
df (
dataframe
) – Model/obs pair of hourly datacol (
str
) – Column label of observation variable to apply the calculation
- Returns
dataframe
– dataframe with applied calculation
- melodies_monet.plots.surfplots.make_boxplot(comb_bx, label_bx, ylabel=None, vmin=None, vmax=None, outname='plot', domain_type=None, domain_name=None, plot_dict=None, fig_dict=None, text_dict=None, debug=False)
Creates box-plot.
- Parameters
comb_bx (
dataframe
) – dataframe containing information to create box-plot from calculate_boxplotlabel_bx (
list
) – list of string labels to use in box-plot from calculate_boxplotylabel (
str
) – Title of y-axisvmin (
real number
) – Min value to use on y-axisvmax (
real number
) – Max value to use on y-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 fileplot_dict (
dictionary
) – Dictionary containing information about plotting for each pair (e.g., color, linestyle, markerstyle)fig_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
– box plot
- melodies_monet.plots.surfplots.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.surfplots.make_spatial_bias_exceedance(df, column_o=None, label_o=None, column_m=None, label_m=None, ylabel=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 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 axisvdiff (
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 (
dict
) – Dictionary containing information about figuretext_dict (
dict
) – Dictionary containing information about textdebug (
bool
) – 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.surfplots.make_spatial_overlay(df, vmodel, column_o=None, label_o=None, column_m=None, label_m=None, ylabel=None, vmin=None, vmax=None, nlevels=None, proj=None, outname='plot', domain_type=None, domain_name=None, fig_dict=None, text_dict=None, debug=False)
Creates spatial overlay plot.
- Parameters
df (
dataframe
) – model/obs pair data to plotvmodel (
dataarray
) – slice of model 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 axisvmin (
real number
) – Min value to use on colorbar axisvmax (
real number
) – Max value to use on colorbar axisnlevels (
integer
) – Number of levels used in colorbar axisproj (
cartopy projection
) – cartopy projection to use in plotoutname (
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
– spatial overlay plot
- melodies_monet.plots.surfplots.make_taylor(df, df_reg=None, column_o=None, label_o='Obs', column_m=None, label_m='Model', dia=None, ylabel=None, ty_scale=1.5, domain_type=None, domain_name=None, plot_dict=None, fig_dict=None, text_dict=None, debug=False)
Creates taylor plot. Note sometimes model values are off the scale on this plot. This will be fixed soon.
- 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 observational variable to plotlabel_o (
str
) – Name of observational variable to use in plot legendcolumn_m (
str
) – Column label of model variable to plotlabel_m (
str
) – Name of model variable to use in plot legenddia (
dia
) – matplotlib ax from previous occurrence so can overlay obs and model results on the same plotylabel (
str
) – Title of x-axisty_scale (
real
) – Scale to apply to taylor plot to control the plotting rangedomain_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 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
class
– Taylor diagram class defined in MONET
- melodies_monet.plots.surfplots.make_timeseries(df, df_reg=None, column=None, label=None, ax=None, avg_window=None, ylabel=None, vmin=None, vmax=None, domain_type=None, domain_name=None, plot_dict=None, fig_dict=None, text_dict=None, debug=False)
Creates timeseries plot.
- Parameters
df (
pandas.DataFrame
) – model/obs paired data to plotdf_reg (
pandas.DataFrame
) – model/obs paired regulatory data to plotcolumn (
str
) – Column label of variable to plotlabel (
str
) – Name of variable to use in plot legendax (
ax
) – matplotlib ax from previous occurrence so can overlay obs and model results on the same plotavg_window (
rule
) – Pandas resampling rule (e.g., ‘H’, ‘D’)ylabel (
str
) – Title of y-axisvmin (
real number
) – Min value to use on y-axisvmax (
real number
) – Max value to use on y-axisdomain_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 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
ax
– matplotlib ax such that driver.py can iterate to overlay multiple models on the same plot
- melodies_monet.plots.surfplots.map_projection(m, *, model_name=None)
Define map projection.
- Parameters
m (
melodies_monet.driver.model
) – Model class instance.model_name (
str
, optional) – For example,'rrfs'
.m.model.lower()
used if not provided. If provided, will be used to create a new projection (i.e., an existingm.proj
projection won’t be returned).
- Returns
cartopy.crs.Projection
– Projection to be used by cartopy in plotting.
- melodies_monet.plots.surfplots.new_color_map()
Creates new color map for difference plots
- Returns
colormap
– Orange and blue color map