Plots from operational simulations

class plots.pearps2m.oper_diags_plot.Config(OPTIONS)[source]

Bases: object

Configuration passed to S2MExtractor and to be used in vortex toolboxes.

  1. checks and converts dates

  2. creates output directories if they don’t exist.

__init__(OPTIONS)[source]
  1. checks and converts dates

  2. creates output directories if they don’t exist.

alternate_xpid = ['OPER@lafaysse']

Alternative experiment id

diroutput

output directory

diroutput_maps

output directory for maps

diroutput_plots

output directory for other plots

list_geometry = ['alp', 'pyr', 'cor', 'jur', 'mac', 'vog', 'postes']

List of geometries

list_members = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]

35 for determinstic member, 36 for sytron, 0-34 for PEARP members

previ = True

False for analysis, True for forecast

rundate

Date of model run bronx.stdtypes.date.Date

xpid = 'oper'

Operational chain

class plots.pearps2m.oper_diags_plot.EnsembleOperDiags[source]

Bases: EnsembleDiags

Class for operationally used plots.

__init__()[source]
alldiags()[source]

Calculate percentiles for all variables in list_var_spag and list_var_map.

attributes = {'DSN_T_ISBA': {'convert_unit': 100.0, 'label': 'Hauteur de neige (cm)'}, 'NAT_LEV': {'forcemax': 5.5, 'forcemin': -0.5, 'label': 'Risque naturel', 'ncolors': 6, 'palette': 'YlOrRd', 'ticks': ['Très faible', 'Faible', 'Mod. A', 'Mod. D', 'Fort', 'Très fort']}, 'PP_SD_1DY_ISBA': {'convert_unit': 1.0, 'forcemax': 60.0, 'forcemin': 0.0, 'label': 'Epaisseur de neige fraîche en 24h (cm)', 'palette': 'YlGnBu', 'seuiltext': 50.0}, 'RAINF_ISBA': {'convert_unit': 10800.0, 'forcemax': 60.0, 'forcemin': 0.0, 'label': 'Pluie en 3h (kg/m2/3h)', 'palette': 'YlGnBu', 'seuiltext': 50.0}, 'RAMSOND_ISBA': {'convert_unit': 100.0, 'forcemax': 60.0, 'forcemin': 0.0, 'label': 'Epaisseur mobilisable (cm)', 'palette': 'YlGnBu', 'seuiltext': 50.0}, 'REFRZTH_ISBA': {'convert_unit': 100.0, 'forcemax': 60.0, 'forcemin': 0.0, 'label': 'Epaisseur regelée (cm)', 'palette': 'YlGnBu', 'seuiltext': 50.0}, 'SD_1DY_ISBA': {'convert_unit': 100.0, 'forcemax': 60.0, 'forcemin': 0.0, 'label': 'Epaisseur de neige fraîche en 24h (cm)', 'palette': 'YlGnBu', 'seuiltext': 50.0}, 'SD_3DY_ISBA': {'convert_unit': 100.0, 'forcemax': 60.0, 'forcemin': 0.0, 'label': 'Epaisseur de neige fraîche en 72h (cm)', 'palette': 'YlGnBu', 'seuiltext': 50.0}, 'SNOMLT_ISBA': {'convert_unit': 10800.0, 'forcemax': 60.0, 'forcemin': 0.0, 'label': 'Ecoulement en 3h (kg/m2/3h)', 'palette': 'YlGnBu', 'seuiltext': 50.0}, 'WET_TH_ISBA': {'convert_unit': 100.0, 'forcemax': 60.0, 'forcemin': 0.0, 'label': 'Epaisseur humide (cm)', 'palette': 'YlGnBu', 'seuiltext': 50.0}, 'WSN_T_ISBA': {'label': 'Equivalent en eau (kg/m2)'}, 'naturalIndex': {'forcemax': 8.0, 'forcemin': 0.0, 'format': '%.1f', 'label': 'Indice de risque naturel', 'nolevel': True, 'palette': 'YlOrRd'}}

dict of plot attributes for each variable

formatplot = 'png'

plot format

list_q = [20, 50, 80]

list of quantiles

pack_spaghettis(suptitle, diroutput='.')[source]

Produce spaghetti plots for all variables in list_var_spag.

Parameters:
  • suptitle (unicode string) – Suptitle for all plots.

  • diroutput – directory to save the plots

pack_spaghettis_multipoints(list_pairs, suptitle, diroutput='.', **kwargs)[source]

Produce spaghetti plots with up to four points per plot for variables in list_var_spag_2points.

Each point gets a different color.

Parameters:
  • list_pairs (list of list) – list of indices to plot together on each plot

  • suptitle (unicode str) – common suptitle for all plots

  • diroutput – output directory

  • kwargs – arguments to be passed to plotting routines, notably “labels”

class plots.pearps2m.oper_diags_plot.EnsembleOperDiagsFlatMassif[source]

Bases: EnsembleOperDiags, EnsembleFlatMassif

Class for operationally plotting maps and spaghetti plots for ensembles with massif geometry and for the zero slope case.

levelmax = 3900

maximum height level to be treated

levelmin = 0

minimum heigth level to be treated

list_var_map = ['naturalIndex', 'SD_1DY_ISBA', 'SD_3DY_ISBA', 'SNOMLT_ISBA']

list of variables to plot maps for

list_var_spag = ['naturalIndex', 'DSN_T_ISBA', 'WSN_T_ISBA', 'SNOMLT_ISBA']

list of variables to do spaghetti plots for

pack_maps(domain, suptitle, diroutput='.')[source]

Produce maps for the variables given in list_var_map over the regions given in domain for each available altitude level and time step.

Each massif is colored corresponding to the second percentile value defined in list_q and the color map defined in attributes. At the center of each massif the values corresponding to the first three percentiles in list_q are marked.

Parameters:
  • domain – list of region identifiers (e.g., “alp”, “pyr”, “cor”)

  • suptitle (str) – common suptitle for all plots

  • diroutput – output directory to save the maps

class plots.pearps2m.oper_diags_plot.EnsembleOperDiagsNorthSouthMassif[source]

Bases: EnsembleOperDiags, EnsembleNorthSouthMassif

Class for operationally plot maps and spaghetti plots distinguishing between northern and southern orientation at each massif.

alldiags()[source]

Calculate percentiles for all variables in list_var_spag_2points and list_var_map.

ensemble = {}

ensemble data

get_pairs_ns()[source]

Get for each massif and altitude the pair of indices corresponding to values for the northern and southern slopes.

Returns:

indices corresponding to northern and southern slopes

Return type:

list of lists

levelmax = 3900

maximum height level to plot

levelmin = 0

minimum height level to plot

list_var_map = ['RAMSOND_ISBA', 'NAT_LEV', 'WET_TH_ISBA', 'REFRZTH_ISBA']

variable list for producing maps

list_var_spag = []

variable list for standard spaghetti plots

list_var_spag_2points = ['RAMSOND_ISBA', 'NAT_LEV', 'WET_TH_ISBA', 'REFRZTH_ISBA']

variable list for spaghetti plots combining northern and southern orientation

pack_maps(domain, suptitle, diroutput)[source]

Produce maps for the variables given in list_var_map over the regions given in domain for each available altitude level and time step.

For each massif a table with background colors and values corresponding to the percentiles in list_q and the color map defined in attributes is plotted near the center of each massif.

Parameters:
  • domain – list of region identifiers (e.g., “alp”, “pyr”, “cor”)

  • suptitle (str) – common suptitle for all plots

  • diroutput – output directory to save the maps

pack_spaghettis_ns(suptitle, diroutput='.')[source]

Do spaghetti plots with values for the northern and southern slope on the same plot.

Parameters:
  • suptitle – common suptitle for all plots

  • diroutput – directory to save the plots

versants = ['Nord 40°', 'Sud 40°']

labels for the two orientations

class plots.pearps2m.oper_diags_plot.EnsembleOperDiagsStations[source]

Bases: EnsembleOperDiags, EnsembleStation

Class for operationally plotting spaghetti plots for station based simulations.

list_var_map = []

list of variables to plot maps for

list_var_spag = ['DSN_T_ISBA', 'WSN_T_ISBA', 'RAMSOND_ISBA', 'WET_TH_ISBA', 'REFRZTH_ISBA', 'SNOMLT_ISBA']

list of variables to plot spaghetti plots for.

class plots.pearps2m.oper_diags_plot.PPQuantiles(filename)[source]

Bases: object

Class for handling files containing postprocessed (quantile) forecasts.

__init__(filename)[source]
levelmax = 3900

maximum height level to be treated

levelmin = 0

minimum heigth level to be treated

list_var_map = ['SD_1DY_ISBA', 'SD_12H_ISBA']

list of variables to plot maps for

list_var_spag = ['SD_1DY_ISBA', 'SD_12H_ISBA']

list of variables to do spaghetti plots for

quantilemaps(domain, suptitle, diroutput, mapindex=array([False, True, False, False, True, False, False, True, False]))[source]

Plots maps of quantile forecasts. For example EMOS postprocessed quantiles.

Parameters:
  • domain – domain (region) string to determine which map class to use

  • suptitle – Plot title highest level

  • diroutput – Output directory for the plots

  • mapindex – array of bool indicating for with indices of the quantile dimension (last dimension of the data array) maps should be drawn.

spaghetti_plots(suptitle, diroutput='.')[source]

Produce spaghetti plots for all variables in list_var_spag.

Parameters:
  • suptitle (unicode string) – Suptitle for all plots.

  • diroutput – directory to save the plots

plots.pearps2m.oper_diags_plot.main(c)[source]
Parameters:

c – config

plots.pearps2m.oper_diags_plot.pp_plots(c)[source]

downloads files with postprocessed quantiles and plots maps and spaghetti plots of them

Parameters:

c – config