komanawa.basgra_nz_py.supporting_functions.plotting#

Author: Matt Hanson Created: 1/09/2020 9:22 AM

Functions#

get_output_metadata([return_dict])

note all keys are have been made uppper for consistancy.

plot_multiple_date_range(data, start_date, end_date[, ...])

as per plot multiple results but for a specific date range.

plot_multiple_monthly_results(data[, outdir, ...])

plot multiple basgra results against each other shifts january to be in the middle.

plot_multiple_monthly_violin_box(data[, outdir, ...])

plot multiple basgra results as a violin plot each other shifts january to be in the middle.

plot_multiple_results(data[, outdir, out_vars, ...])

plot multiple basgra results against each other

Module Contents#

get_output_metadata(return_dict=True)[source]#

note all keys are have been made uppper for consistancy.

Parameters:

return_dict – boolean True return nested dictionary, otherwies returne dataframe

Returns:

plot_multiple_date_range(data, start_date, end_date, outdir=None, out_vars=_outvars, fig_size=(10, 8), title_str='', rolling=None, main_kwargs={}, rolling_kwargs={}, label_rolling=False, label_main=True, show=True)[source]#

as per plot multiple results but for a specific date range.

Parameters:
  • data – dictionary of key: outputs of run_basgra()

  • start_date – the start date for the range to be plotted

  • end_date – the end date for the rnage to be plotted

  • outdir – none or directory, if not None then makes outdir and saves plots

  • out_vars

    variables to make figures for, default is:

    (‘WAL’, ‘WCLM’, ‘WCL’, ‘RAIN’, ‘IRRIG’, ‘DRAIN’, ‘RUNOFF’, ‘EVAP’, ‘TRAN’, ‘DM’, ‘YIELD’, ‘BASAL’, ‘ROOTD’, ‘WAFC’)

  • title_str – a string to append to the front of the title

  • rolling – None or int, generate a rolling mean of rolling days

  • main_kwargs – other kwargs passed directly to the plot function for the main plot

  • rolling_kwargs – other kwargs passed directly to the plot function for the rolling average

  • label_rolling – bool if True labels are created for the rolling plot if either is true then creates a legend

  • label_main – bool if True labels are created for the main plot if either is true then creates a legend

  • show – bool if true call plt.show before function return

Returns:

axs: dict(data.keys():plt.ax)

plot_multiple_monthly_results(data, outdir=None, out_vars=_outvars, fig_size=(10, 8), title_str='', main_kwargs={}, label_main=True, show=True)[source]#

plot multiple basgra results against each other shifts january to be in the middle.

Parameters:
  • data – dictionary of key: outputs of run_basgra() grouped by the month, index=range(1,13)

  • outdir – none or directory, if not None then makes outdir and saves plots

  • out_vars

    variables to make figures for, default is:

    (‘WAL’, ‘WCLM’, ‘WCL’, ‘RAIN’, ‘IRRIG’, ‘DRAIN’, ‘RUNOFF’, ‘EVAP’, ‘TRAN’, ‘DM’, ‘YIELD’,’BASAL’, ‘ROOTD’, ‘WAFC’)

  • title_str – a string to append to the front of the title

  • main_kwargs – other kwargs passed directly to the plot function for the main plot

  • label_main – bool if True labels are created for the main plot if either is true then creates a legend

  • show – bool if true call plt.show before function return

Returns:

axs: dict(data.keys():plt.ax)

plot_multiple_monthly_violin_box(data, outdir=None, out_vars=_outvars, fig_size=(10, 8), title_str='', main_kwargs={}, label_main=True, show=True, violin_plot=False)[source]#

plot multiple basgra results as a violin plot each other shifts january to be in the middle.

Parameters:
  • data – dictionary of key: outputs of run_basgra() grouped by the month, index=range(1,13)

  • outdir – none or directory, if not None then makes outdir and saves plots

  • out_vars

    variables to make figures for, default is:

    (‘WAL’, ‘WCLM’, ‘WCL’, ‘RAIN’, ‘IRRIG’, ‘DRAIN’, ‘RUNOFF’, ‘EVAP’, ‘TRAN’, ‘DM’, ‘YIELD’, ‘BASAL’, ‘ROOTD’, ‘WAFC’)

  • title_str – a string to append to the front of the title

  • main_kwargs – other kwargs passed directly to the plot function for the main plot

  • label_main – bool if True labels are created for the main plot if either is true then creates a legend

  • show – bool if true call plt.show before function return

  • violin_plot – bool if True plot violin plots if False plot boxplots

Returns:

axs: dict(data.keys():plt.ax)

plot_multiple_results(data, outdir=None, out_vars=_outvars, fig_size=(10, 8), title_str='', rolling=None, main_kwargs={}, rolling_kwargs={}, label_rolling=False, label_main=True, show=True)[source]#

plot multiple basgra results against each other

Parameters:
  • data – dictionary of key: outputs of run_basgra()

  • outdir – none or directory, if not None then makes outdir and saves plots

  • out_vars

    variables to make figures for, default is:

    (‘WAL’, ‘WCLM’, ‘WCL’, ‘RAIN’, ‘IRRIG’, ‘DRAIN’, ‘RUNOFF’, ‘EVAP’, ‘TRAN’, ‘DM’, ‘YIELD’, ‘BASAL’, ‘ROOTD’, ‘WAFC’)

  • title_str – a string to append to the front of the title

  • rolling – None or int, generate a rolling mean of rolling days

  • main_kwargs – other kwargs passed directly to the plot function for the main plot

  • rolling_kwargs – other kwargs passed directly to the plot function for the rolling average

  • label_rolling – bool if True labels are created for the rolling plot if either is true then creates a legend

  • label_main – bool if True labels are created for the main plot if either is true then creates a legend

  • show – bool if true call plt.show before function return

Returns:

axs: dict(data.keys():plt.ax)