| 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 = 'contour1' |
| 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_map_projection = 'cylindrical') |
| 22 |
|
| 23 |
|
| 24 |
#Coastlines setting |
| 25 |
coast = mcoast( map_grid = "on", |
| 26 |
map_grid_colour = "tan", |
| 27 |
map_coastline_land_shade = 'on', |
| 28 |
map_coastline_land_shade_colour = 'cream', |
| 29 |
map_coastline_colour = "tan") |
| 30 |
|
| 31 |
|
| 32 |
#Import the z500 data |
| 33 |
z500 = mgrib(grib_input_file_name = "z500.grb", |
| 34 |
grib_id = "z500") |
| 35 |
|
| 36 |
|
| 37 |
#Define the simple contouring for z500 |
| 38 |
z500_contour = mcont( legend = "off", |
| 39 |
contour_line_colour = "navy", |
| 40 |
contour_line_thickness = 2, |
| 41 |
contour_label = "on", |
| 42 |
contour_highlight_colour = "navy", |
| 43 |
contour_highlight_thickness = 6 ) |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
title = mtext( |
| 50 |
text_lines = ["<font size='1'>Simple Contouring...</font>", |
| 51 |
"<font colour='evergreen'>contour_level_selection_type = count</font> ", |
| 52 |
" calculate a reasonable contour interval from the min and max of the displayed field"], |
| 53 |
text_justification = "left", |
| 54 |
text_font_size = 0.8, |
| 55 |
text_colour = "charcoal") |
| 56 |
|
| 57 |
|
| 58 |
#To the plot |
| 59 |
plot(output, projection, coast, z500, z500_contour, title) |
| 60 |
|
| 61 |
#For documentation only |
| 62 |
tofortran(ref, output, projection, coast, z500, z500_contour, title) |
| 63 |
tomv4(ref, z500_contour) |
| 64 |
tohtml(ref, z500, z500_contour) |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|