Debian Codegraph @

docs/confluence/contour/contour3.py

raw
1 # (C) Copyright 1996-2016 ECMWF.
2 #
3 # This software is licensed under the terms of the Apache Licence Version 2.0
4 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5 # In applying this licence, ECMWF does not waive the privileges and immunities
6 # granted to it by virtue of its status as an intergovernmental organisation nor
7 # does it submit to any jurisdiction.
8
9
10 #importing Magics module
11 from Magics.macro import *
12
13
14 ref = 'contour3'
15 #Setting of the output file name
16 output = output(output_formats = ['png'],
17 output_name_first_page_number = "off",
18 output_name = ref)
19
20 #Setting the coordinates of the geographical area
21 projection = mmap(subpage_upper_right_longitude = 50.00,
22 subpage_upper_right_latitude = 65.00,
23 subpage_lower_left_latitude = 25.00,
24 subpage_lower_left_longitude = -20.00,
25 subpage_map_projection = 'cylindrical')
26
27
28
29 #Coastlines setting
30 coast = mcoast( map_grid = "on",
31 map_grid_colour = "tan",
32 map_coastline_land_shade = 'on',
33 map_coastline_land_shade_colour = 'cream',
34 map_coastline_colour = "tan")
35
36
37 #Import the t850 data
38 t850 = mgrib(grib_input_file_name = "t850.grb",
39 grib_field_position = 1)
40
41
42
43 #Define a contour using a predefined contour level_list
44 contour = mcont( legend = "off",
45 contour_level_selection_type = "level_list",
46 contour_level_list=[-20., -10., -5., -2.5, -1, -0.5, 0., 0.5, 1, 2.5, 5, 10, 20],
47 contour_line_colour = "grey",
48 contour_line_thickness = 2,
49 contour_label = "off",
50 contour_highlight="off",
51 contour_grid_value_plot = "on",
52 contour_grid_value_plot_type = "both",
53 contour_grid_value_lat_frequency = 10,
54 contour_grid_value_lon_frequency = 10,
55 contour_grid_value_height = 0.3,
56 contour_grid_value_marker_height = 0.2)
57
58
59
60 title = mtext(
61 text_lines = ["<font size='1'>Display the grid values ...</font>",
62 "<font colour='evergreen'>contour_level_selection_type = level_list</font> ",
63 " uses a user-defined list of contour levels.",
64 "[-20., -10., -5., -2.5, -1, -0.5, 0., 0.5, 1, 2.5, 5, 10, 20]"],
65 text_justification = "left",
66 text_font_size = 0.8,
67 text_colour = "charcoal")
68
69
70 #To the plot
71 plot(output, projection, coast, t850, contour, title)
72
73 #For documentation only
74 tofortran(ref, output, projection, coast, t850, contour, title)
75 tomv4(ref, contour)
76 tohtml(ref, t850, contour)
77
78
79
80
81
82
83
84
85
86
87
88
89
90