credit.animation#

Attributes#

Functions#

kgkg_to_gkg(q)

k_to_c(temperature)

k_to_f(temperature)

gp_to_height_dam(gp)

pa_to_hpa(pressure)

plot_global_animation(forecast_dir, init_date, ...[, ...])

Customizable function for plotting animations of global CREDIT predictions.

plot_regional_animation(forecast_dir, init_date, ...)

Not implemented yet.

Module Contents#

credit.animation.projections#
credit.animation.kgkg_to_gkg(q)#
credit.animation.k_to_c(temperature)#
credit.animation.k_to_f(temperature)#
credit.animation.gp_to_height_dam(gp)#
credit.animation.pa_to_hpa(pressure)#
credit.animation.variable_transforms#
credit.animation.plot_global_animation(forecast_dir: str, init_date: str, forecast_step: int, final_forecast_step: int, output_video_file: str = './credit_prediction.mp4', contourf_config: dict = None, contour_config: dict = None, projection_type: str = 'robinson', projection_config: dict = None, title: str = 'CREDIT Prediction', date_format: str = '%Y-%m-%d %HZ', figure_kwargs: dict = None, axes_rect: tuple = (0.02, 0.02, 0.96, 0.96), fontsize: int = 12, coastline_kwargs: dict = None, border_kwargs: dict = None, colorbar_kwargs: dict = None, save_kwargs: dict = None)#

Customizable function for plotting animations of global CREDIT predictions.

This function enables plotting multiple weather fields on the same map and animating the map through time using matplotlib animation.

Parameters:
  • forecast_dir – Path to directory containing forecast netCDF files for a single init date

  • init_date – Date of initial conditions for forecast

  • forecast_step – Length of time between forecasts in hours. Usually 1 or 6

  • final_forecast_step – Lead time of last forecast step plotted in hours.

  • output_video_file – Path to output mp4 file.

  • contourf_config – dict containing settings for filled contour plot

  • contour_config – dict containing settings for contour plots organized by variable.

  • projection_type – Type of global projection. Default is ‘robinson’.

  • projection_config – dict containing settings for global projection plot

  • title – String for beginning of title

  • date_format – Format of date displayed in plot title

  • figure_kwargs – Kwargs for figure

  • axes_rect – Dimensions of figure axes (left, bottom, right, top) ranging from 0 to 1.

  • fontsize – Fontsize of title

  • coastline_kwargs – Properties for plotting coastlines.

  • border_kwargs – Properties for plotting national borders.

  • colorbar_kwargs – Properties for plotting colorbar.

  • save_kwargs – Properties for saving video.

Examples

How to configure a contourf:

q_config = dict(variable="Q_PRES",
                level=850,
                contourf_kwargs=dict(levels=[1, 2, 3, 4, 5],
                                     cmap="viridis",
                                     extend="max"))

How to configure a contour:

contour_config = dict(temp=dict(variable="T_PRES",
                                level=850,
                                contour_kwargs=dict(levels=[-10, -5, 0, 5, 10, 15, 20],
                                cmap="RdBu_r"),
                      z=dict(variable="Z_PRES",
                             level=850,
                             contour_kwargs=dict(levels=np.arange(120, 183, 3),
                                                 colors='k')
                             )
                     )
credit.animation.plot_regional_animation(forecast_dir: str, init_date: str, forecast_step: int, final_forecast_step: int, extent, output_video_file: str = './credit_prediction.mp4', contourf_config: dict = None, contour_config: dict = None, projection_type: str = 'robinson', projection_config: dict = None, title: str = 'CREDIT Prediction', date_format: str = '%Y-%m-%d %HZ', figure_kwargs: dict = None, axes_rect: tuple = (0.02, 0.02, 0.98, 0.96), fontsize: int = 12, coastline_kwargs: dict = None, border_kwargs: dict = None, colorbar_kwargs: dict = None, save_kwargs: dict = None)#

Not implemented yet.

Returns: