...
Section |
---|
Column |
---|
| Info |
---|
|
mgrib action to load the data |
---|
grib_input_file_name |
mcont action to define a contouring |
---|
contour_line_colour | contour_line_thickness | contour_highlight_colour | contour_highlight_thickness | contour_hilo | contour_level_selection_type | contour_interval | legend | contour_legend_text |
|
Code Block |
---|
theme | Confluence |
---|
language | python |
---|
title | Python - Coastlines |
---|
collapse | true |
---|
| from Magics.macro import *
#setting the output
output = output(
output_formats = ['png'],
output_name = "map_step3",
output_name_first_page_number = "off"
)
#settings of the geographical area
area = mmap(subpage_map_projection="cylindrical",
subpage_lower_left_longitude=-110.,
subpage_lower_left_latitude=20.,
subpage_upper_right_longitude=-30.,
subpage_upper_right_latitude=70.,
)
#settings of the caostlines
coast = mcoast(map_coastline_land_shade = "on",
map_coastline_land_shade_colour = "cream",
map_grid_line_style = "dash",
map_grid_colour = "grey",
map_label = "on",
map_coastline_colour = "grey")
#Loading the msl Grib data
msl = mgrib(grib_input_file_name="msl.grib")
#Defining the controur
contour = mcont(contour_highlight_colour= "black",
contour_highlight_thickness= 4,
contour_hilo= "off",
contour_interval= 5.,
contour_label= "on",
contour_label_frequency= 2,
contour_label_height= 0.4,
contour_level_selection_type= "interval",
contour_line_colour= "black",
contour_line_thickness= 2,
legend='on',
contour_legend_text= "Mean Sea Level Pressure",
)
plot(output, area, coast, msl, contour) |
|
Column |
---|
| |
|
Adding a text
Magics allows the user to add of or several lines of text. The position of the text is by default above the plot, but some parameters aloow it to be moved around.
A basic html formatting can be used for colour, style, and font size.
Visualising the precipitation field
The goal of this exercise is to discover a bit more the diverse styles of visualisation offered the mcont object.
Here we will work with shading, and we will use a different technique to setup the levels we want to contourThe mtext object has to be inserted in the plot command to see the text on the result.
Column |
---|
|
Code Block |
---|
theme | Confluence |
---|
language | python |
---|
title | Python - Title |
---|
collapse | true |
---|
| from Magics.macro import *
#settings of the png output
output = output(
output_formats = ['png'],
output_name = "coast",
output_name_first_page_number = "off"
)
##settings of the coastlines attributes
coast = mcoast(
map_coastline_land_shade = "on",
map_coastline_land_shade_colour = "cream",
map_grid_line_style = "dash",
map_grid_colour = "brown",
map_label_colour = "brown",
map_coastline_colour = "brown"
)
##settings of the text (notice the Html formatting)
title = mtext(
text_lines = ["Hello World!", " <b>This is my first plot</b> !"],
text_font_size = "0.7",
text_colour = "charcoal"
)
#The plot command will now use the coast and title objects
plot(output, coast, title) |
|
...