Versions Compared

Key

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

...

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.

Info

Note: using the Grib Examiner is a good way to find the available keys to extract meta-data from a GRIB field.

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)

...