mcont ( macro/python ) pcont ( fortran )


Contouring is achieved by calling the action routine pcont, i.e. call pcont . The call may be preceded by one or more calls to Magics parameter setting routines. pcont will only take into account those parameters set before the routine is called. Any calls to Magics parameter setting routines after pcont is called are only relevant to future action routines.

When the action routine pcont is called, it will plot contours based on the input data supplied and according to the user's instructions. The input data may have different organizations: GRIB code data, regular latitude/longitude grid, gaussian grid. Before pcont is called, the user must define how he wants the data to be contoured, i.e. location of the data, dimensions of the array, input field organization etc. This is done by calling Magics parameter setting routines. Data may be passed in an array, in GRIB or NetCDF format

New in 3.0.1 - Predefined palettes

From Magics 2.0.1, Magics offers the ability of using a large variety of predefined palettes .

Have a look at the already defined palettes and do not hesitate to send us your favourites ones, we will integrate them .


Python example
#Defining the contour
contour = mcont(
    contour = 'off',
    contour_hilo = 'off',
    contour_interval = 2.0,
    contour_label = 'off',
    contour_level_selection_type = 'interval',
    contour_shade = 'on',
    contour_shade_palette_name = 'eccharts_rainbow_purple_red_25',
    contour_shade_colour_method = 'palette',
    contour_shade_max_level = 22.0,
    contour_shade_method = 'area_fill',
    contour_shade_min_level = -28.0,
    legend = 'on'
)




Quick links :

Import data:

Jupyter notebooks:

Gallery:

 

 

 

 

 

contdescriptiondefaultYour Selection
This controls the plotting of isolines, contour bands and grid points.[version 3.1.0]
legendTurn legend on or off off
contourTurn contouring on or off on
contour_line_styleCertain parameters will be scaled into more user-friendly units if the data has not been manipulated Certain parameters will be scaled into more user-friendly units if the data has been manipulated Style of contour line solid
contour_line_thicknessThickness of contour line 1
contour_line_colour_rainbowif On, rainbow colouring method will be used. off
contour_line_colourColour of contour line press to change colourMore on colours...blue
contour_line_colour_rainbow_methodMethod of generating the colours for isoline calculate
contour_line_colour_rainbow_max_level_colourColour to be used for the max level press to change colourMore on colours...blue
contour_line_colour_rainbow_min_level_colourColour to be used for the mainlevel press to change colourMore on colours...red
contour_line_colour_rainbow_directionDirection of colour sequencing for colouring anti_clockwise
contour_line_colour_rainbow_colour_listList of colours to be used in rainbow isolines Enter a list of strings: val1/val2/val3stringarray()
contour_line_colour_rainbow_colour_list_policyWhat to do if the list of colours is smaller that the list of contour: lastone/cycle lastone
contour_line_thickness_rainbow_listList of thickness to used when rainbow method is on intarray()
contour_line_thickness_rainbow_list_policyWhat to do if the list of thickness is smaller that the list of contour: lastone/cycle lastone
contour_line_style_rainbow_listList of line style to used when rainbow method is on Enter a list of strings: val1/val2/val3stringarray()
contour_line_style_rainbow_list_policyWhat to do if the list of line styles is smaller that the list of contour: lastone/cycle lastone
contour_highlightPlot contour highlights (ON/OFF) on
contour_highlight_styleStyle of highlighting (SOLID/ DASH/ DOT/ CHAIN_DASH/ CHAIN_DOT) solid
contour_reference_levelContour level reference 0.0
contour_highlight_colourColour of highlight line press to change colourMore on colours...blue
contour_highlight_thicknessThickness of highlight line 3
contour_highlight_frequencyFrequency of highlight line 4
contour_level_selection_typecount: calculate a reasonable contour interval taking into account the min/max and the requested number of isolines. interval: regularly spaced intervals using the reference_level as base.level_list: uses the given list of levels. count
contour_max_levelHighest level for contours to be drawn 1.0e+21
contour_min_levelLowest level for contours to be drawn -1.0e+21
contour_shade_max_levelHighest level for contours to be shaded 1.0e+21
contour_shade_min_levelLowest level for contours to be shaded -1.0e+21
contour_level_countCount or number of levels to be plotted. Magics will try to find "nice levels", this means that the number of levels could be slightly different from the asked number of levels 10
contour_level_toleranceTolerance: Do not use nice levels if the number of levels is really to different [count +/- tolerance] 2
contour_intervalInterval in data units between two contour lines 8.0
contour_level_listList of contour levels to be plotted Enter a list of float: 4.5/5./1.floatarray()
contour_labelPlot labels on contour lines on
contour_label_typeType of label (TEXT/NUMBER/BOTH) number
contour_label_textText for labels
contour_label_heightHeight of contour labels 0.3
contour_label_formatFormat of contour labels (MAGICS Format/(AUTOMATIC)) (automatic)
contour_label_blankingLabel Blanking on
contour_label_quality(LOW/MEDIUM/HIGH) low
contour_label_fontName of the font sansserif
contour_label_font_styleStyle of the font bold/italic normal
contour_label_colourColour of contour labels contour_line_colour
contour_label_frequencyEvery Nth contour line is labelled 2
contour_shadeTurn shading on off
contour_shade_techniqueTechnique used for shading (POLYGON_SHADING/ CELL_SHADING/ MARKER) polygon_shading
contour_shade_methodMethod used for shading (DOT/ AREA_FILL/ HATCH) dot
contour_shade_dot_sizeSize of dot in shading pattern 0.02
contour_shade_max_level_densityDots/square centimetre in highest shading band 50.0
contour_shade_min_level_densityDots/square centimetre in lowest shading band 1.0
contour_shade_hatch_indexThe hatching pattern(s) to use. 0 Provides an automatic sequence of patterns, other values set a constant pattern across all contour bands. 0
contour_shade_hatch_thicknessThickness of hatch lines 1
contour_shade_hatch_densityNumber of hatch lines per cm. 18.0
contour_grid_shading_positionMiddle : the point is in the midlle of the cell, bottom_left : the point is in the bottom left corner middle
contour_shade_cell_resolutionNumber of cells per cm for CELL shading 10
contour_shade_cell_methodNMethod of determining the colour of a cell (INTERPOLATE/ NEAREST) nearest
contour_shade_cell_resolution_methodif adaptive, magics will switch to grid_shading when the data resolution is greater that the requested resolution classic
contour_shade_colour_tableColour table to be used with MARKER shading technique Enter a list of strings: val1/val2/val3stringarray()
contour_shade_height_tableHeight table to be used with MARKER shading technique Enter a list of float: 4.5/5./1.floatarray()
contour_shade_marker_table_typeindex: using contour_shade_marker_table and definiing the markers by index, name: using contour_shade_marker_name_table and defining the symbols by their names index
contour_shade_marker_tableMarker table to be used with MARKER shading technique Enter a list of integer: 5/9/12intarray()
contour_shade_marker_name_tableMarker name table to be used with MARKER shading technique Enter a list of strings: val1/val2/val3stringarray()
contour_shade_colour_methodMethod of generating the colours of the bands in contour shading (list/calculate/advanced) calculate
contour_shade_max_level_colourHighest shading band colour press to change colourMore on colours...blue
contour_shade_min_level_colourLowest shading band colour press to change colourMore on colours...red
contour_shade_colour_directionDirection of colour sequencing for shading (CLOCKWISE/ ANTI_CLOCKWISE) anti_clockwise
contour_shade_colour_listList of colours to be used in contour shading. Enter a list of strings: val1/val2/val3stringarray()
contour_shade_palette_nameColour used at the stops : the gradeint will be calculated between 2 consecutive ones. Find about the available palettes ...
contour_shade_palette_policyWhat to do if the list of colours is smaller that the list of levels: lastone/cycle lastone
contour_legend_onlyInform the contour object do generate only the legend and not the plot! off
contour_methodContouring method automatic
contour_akima_x_resolutionX resolution of Akima interpolation 1.5
contour_akima_y_resolutionY resolution of Akima interpolation 1.5
contour_interpolation_floorAny value below this floor will be forced to the floor value.avoid the bubbles artificially created by the interpolation method -INT_MAX
contour_interpolation_ceilingany value above this ceiling will be forced to the ceiling value.avoid the bubbles artificially created by the interpolation method INT_MAX
contour_automatic_settingTurn the automatic setting of contouring attributes off
contour_hiloPlot local maxima/minima off
contour_hilo_typeType of high/low (TEXT/NUMBER/BOTH) text
contour_hilo_heightAdded for backwards compatibility with existing Metview Contour icons/macros Height of local maxima/minima text or numbers 0.4
contour_hilo_quality(LOW/MEDIUM/HIGH) low
contour_hi_colourColour of local maxima text or number press to change colourMore on colours...blue
contour_lo_colourColour of local minima text or number press to change colourMore on colours...blue
contour_hilo_formatFormat of HILO numbers (MAGICS Format/(AUTOMATIC)) (automatic)
contour_hi_textText to represent local maxima H
contour_lo_textText to represent local minima L
contour_hilo_blankingBlank around highs and lows (ON/OFF) off
contour_hilo_window_sizeSize of the window used to calculate the Hi/Lo 3
contour_hilo_reduction_radiusSearch radius (in grid points) for reducing the number of minima 0.0
contour_hilo_suppress_radiusRadius of HiLo search in grid points (default value is for global cylindrical map) 15.0
contour_hilo_max_valueLocal HiLo above specified value are not drawn 1.0e+21
contour_hilo_min_valueLocal HiLo below specified value are not drawn -1.0e+21
contour_hi_max_valueLocal HI above specified value are not drawn 1.0e+21
contour_hi_min_valueLocal HI below specified value are not drawn -1.0e+21
contour_lo_max_valueLocal Lo above specified value are not drawn 1.0e+21
contour_lo_min_valueLocal Lo below specified value are not drawn -1.0e+21
contour_hilo_markerPlot hilo marker (ON/OFF) off
contour_hilo_marker_heightHeight of HILO marker symbol 0.1
contour_hilo_marker_indexTable number of marker symbol. See chapter on Plotting Attributes 3
contour_hilo_marker_colourColour of grid point markers(Full choice of colours) press to change colourMore on colours...red
contour_grid_value_plotPlot Grid point values off
contour_grid_value_typeFor Gaussian fields, plot normal (regular) values or reduced grid values. (NORMAL/REDUCED/akima). If akima, the akima grid values will be plotted normal
contour_grid_value_plot_type(VALUE/MARKER/BOTH) value
contour_grid_value_minThe minimum value for which grid point values are to be plotted -1.0e+21
contour_grid_value_maxThe maximum value for which grid point values are to be plotted 1.0e+21
contour_grid_value_lat_frequencyThe grid point values in every Nth latitude row are plotted 1
contour_grid_value_lon_frequencyThe grid point values in every Nth longitude column are plotted 1
contour_grid_value_heightHeight of grid point values 0.25
contour_grid_value_colourColour of grid point values (Full choice of colours) press to change colourMore on colours...blue
contour_grid_value_formatFormat of grid point values (MAGICS Format/(AUTOMATIC)) (automatic)
contour_grid_value_quality(LOW/MEDIUM/HIGH) low
contour_grid_value_justification(LEFT/CENTRE/RIGHT) centre
contour_grid_value_vertical_align(NORMAL/TOP/CAP/HALF/BASE/BOTTOM) base
contour_grid_value_marker_heightHeight of grid point markers 0.25
contour_grid_value_marker_colourColour of grid point markers (Full choice of colours) press to change colourMore on colours...red
contour_grid_value_marker_qual(LOW/MEDIUM/HIGH) low
contour_grid_value_marker_indexTable number of marker index. See Appendix for Plotting Attributes 3
contour_grid_value_positionPosition of the value top

 

New in 3-0.0 : Improvment of the gradient colours settings

This version comes with a more complete implementation of the gradients colour setting.

This method can be used to create a list of colours giving a smooth transition between 2 colours. 

The main control parameters of this new technique are shown in this small example.

contour_level_list = [-15,-0.5, 0.5,15]

contour_shade_colour_method = "gradients",

contour_gradients_colour_list = ['blue','white', 'red'],

contour_gradients_step_list = [50, 1, 50]

This setting will create the following list of colours : 50 colours between -15 and -0.5, 1 between -0.5 and 05 and 50 between 0.5 and 50.

contour = mcont(contour = "off",
                     legend = "on",
                     contour_shade = "on",
                     contour_level_selection_type = "level_list",
                     contour_level_list = [-15.00, -0.5, 0.5, 15.00],
                     contour_label = "off",
                     contour_label_height = 0.40,
                     contour_label_colour = "charcoal",
                     contour_label_frequency = 1,
                     contour_shade_method = "area_fill",
                     contour_shade_colour_method = "gradients",
                     contour_gradients_colour_list = ['blue','white','white', 'red'],
                     contour_gradients_step_list = [50, 1, 50]
                     )

legend = mlegend(legend_display_type = "continuous",
                 legend_entry_border='off',
                 legend_text_colour = "charcoal",
                 legend_values_list= [-15., -10, -5, 0, 5, 10, 15],
                 legend_text_composition = 'user_text_only',
                 legend_user_maximum = "on",
)

 

 

 

New in 2.20

 A contour_line_colour_rainbow parameter  has been introduced, allowing the user to specify a different colour for each isoline.There are 2 ways to specify the list of colours to use, the setting being very similar of the colour settings for shading, ie: define the list, or let Magics computes the list given a max and min colour.

 

contour_line_colour_rainbow
 mcont(contour_level_selection_type = "interval",
	contour_line_colour_rainbow_max_level_colour = "red",
	contour_line_colour_rainbow = "on",
	contour_highlight = "off",
	contour_line_colour_rainbow_direction = "clockwise",
	contour_line_colour_rainbow_min_level_colour = "blue",
	contour_line_colour_rainbow_method = "calculate",
	contour_interval = 1.00)
 

A contour_automatic_setting parameter has also been introduced, if set to ecchart, Magics will try to match the parameter with one of the predefined ecChart style. In one is found all the other contour parameters setiings will be ignored.

 

contour_automatic_setting
mcont(contour_automatic_setting = "ecchart")

9 Comments

  1. I believe contour_hilo_height key is missing in this documentation page.

  2. Where can I find which markers correspond to the different indices for contour_grid_value_marker_index? The metview doc also refers to this page.

    1.  

      1. Thanks. When trying the link, I get back to the confluence 'dashboard', not to the expected page?

        1. Sorry, I typed it wrong .. must be better now

  3. Does the option contour_hilo_plot_value still exist ?

    Nicole.

    1. I am not sure that  contour_hilo_plot_value was an option in magics6, but I think..

      contour_hilo = 'on

      contour_hilo_type = 'number'

      .. Should do what you want..

      Happy new Year!

      Sylvie

       

       

  4. I try to use "contour_hilo_position_file_name" to obtain a file (geopoint) with high or low positions, value in a file. Thanks