Versions Compared

Key

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

...

Code Block
languagexml
My title which has <b>bold</b>, <u>underlined</u> and <font color='rose'>coloured</font> text

 

Some Metview users have used coloured text in the title as an alternative legend.

If you are writing a macro, then you can use all of the string manipulation capabilities to construct the title. Type the following macro code, or try the one in the solutions folder. It calls the grib_get functions to retrieve meta-data from the GRIB header, then constructs a title using it.

Code Block
languagepy
rh = read("relative_humidity.grib")

field_name       = grib_get_string(rh[1], 'name')
field_valid_date = grib_get_string(rh[1], 'validityDate')
field_level      = grib_get_double(rh[1], 'level')

title_text = field_name & ' ' & field_valid_date & ' at level ' & field_level

title = mtext(text_line_1: title_text)

plot(rh, title)

This is fine for a single field, but notice that if you move between the two fields in the relative_humidity data, there are two different vertical levels - but we only have one title, and it was constructed using the meta-data from the first field.