Scroll pdf ignore | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Text Plotting
...
A plot's title should not be underestimated - it provides vital information about what is being displayed.
During the exercises, remember to give your icons useful names!
Automatic Titles
The Text Plotting icon controls the content and appearance of the title. By default, it contains this:
Text Line Count | 1 |
Text Line 1 | <magics_title/> |
So we have a single-line title which uses the default content defined by Magics, Metview's plotting engine.
...
There is no automatic title for BUFR, geopoints or ASCII table data.
Customising an automatic title
Visualise the supplied GRIB file relative_humidity.grib to see its automatic title.
Create a new Text Plotting icon and try to get the title to look similar to the image above. You should play with the parameters Text Colour, Text Font, Text Font Style and Text Font Size.
Positioning a title
Make a duplicate of your Text Plotting icon. We will move the title to another location in the plot using the new icon. Use the following parameters:
Text Mode | Positional |
Text Box X Position | X coordinate of lower left corner of text box (in cm) |
Text Box Y Position | Y coordinate of lower left corner of text box (in cm) |
Text Box X Length | Width of the box (in cm) |
Text Box Y Length | Height of the box (in cm) |
Text Box Blanking | On |
Text Border | On |
Remember that Metview uses an A4 page by default, which is 29.7cm wide by 21.0cm high. Try to figure out the coordinates of the box, or look in the solutions folder!
...
- there can be only one Text Plotting icon where Text Mode is Title - dropping new such icons into the plot replace the current title
- dropping different Positional Text Plotting icons into the plot add text boxes; but dropping the same Positional icon multiple times (e.g. with modifications in between) will not accumulate - the text box will be updated
...
If you know (or can figure out from some Macro code) exactly what your plot is going to show, then you can construct a title with no automatically computed elements. Or you can combine the two.
...
Dealing with multiple overlaid fields
Adapt your macro to also read and plot overlay the geopotential data . Use the supplied rh_shade icon to colour the relative humidity field:
...
We should also update the parameter names in the title - let's assume that each frame will contain the same parameters (they contain different levels), so we could change field_namesname
to this:
Code Block | ||
---|---|---|
| ||
field_namesname = grib_get_string(rh[1], 'name') & ' / ' & grib_get_string(z[1], 'name') |
Extra Work
Meta-data references in Macro
Continue the work of updating the macro first macro to use nothing but meta-data references so that it does not extract anything from the GRIB header itself and everything is taken at plot time.
Text boxes
To exemplify the Text Plotting's dropping rules, do the following:
- Visualise GRIB file relative_humidity.grib
- apply a Text Plotting icon to move the title to another location (this icon was created previously)
- apply a new Text Plotting icon to remove the default automatic title
- apply a new Text Plotting icon to draw a chosen text near the top-left corner of the plot and customise its colour, font, style and size
- apply a new Text Plotting icon to draw a chosen text around the middle of the plot and customise its border and box-blanking
Next, create a Macro program, name it custom_text_boxes, using all the above icons.
Meta-data references in Macro
The The title just shows the date - add the time of the data.