Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


 

 

 

Section


Column
width60%


Panel

  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 or , in GRIB or NetCDF format


Panel
titleNew 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 .


Image Added

Code Block
languagepy
titlePython 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'
)







Column
width30%


Panel
titleQuick links :

Import data:

Jupyter notebooks:

Gallery:

 

 





 

 

 

HTML
<div id="magics">	
</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script src="http://software.ecmwf.int/wiki/download/attachments/13207038/magdoc.js"></script>
<link rel="stylesheet" type="text/css" href="http://software.ecmwf.int/wiki/download/attachments/13207038/magics.css" />
<link rel="stylesheet" type="text/css" href="http://software.ecmwf.int/wiki/download/attachments/13207038/jquery.miniColors.css" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://software.ecmwf.int/wiki/download/attachments/13207038/jquery.miniColors.js"></script>

 <script>
	load("http://software.ecmwf.int/wiki/download/attachments/14158128/cont.json");
</script>

 

Panel
titleNew 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.

Image Added

Code Block
languagepy
collapsetrue
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",
)

Image Added

 

 

 

Info
titleNew 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.

Image Added

 

Code Block
languagepython
titlecontour_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.

Image Added

 

Code Block
titlecontour_automatic_setting
mcont(contour_automatic_setting = "ecchart")

 

HTML
<meta name="keywords" content="Louison, legend"/> <meta name="keywords" content="contour_line_thickness, contour_line_colour, contour_highlight, contour_highlight_style"/>