Versions Compared

Key

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

...

Now extract the dates and times of the fields and combine them into a list of date variables. There is more than one way to organise this code, but here is one suggestion:

Code Block
languagepy
# obtain two lists - one of dates and one of times
d = grib_get_long(fs, 'validityDate')
t = grib_get_long(fs, 'validityTime')

# times are in hours, like 1200 is 12:00, so we have to divide by 100
# to get them into hours, then by 24 to get them into fractions of days
dates = d + (t / 2400 24) # ASSUME the times are in hours, like 1200 is 12:00
print(dates)

# but these are still numbers - we need to all the date() function to convert
# into proper date variables, and we need to loop through the list
date_list = nil
loop dt in dates
    date_list = date_list & [date(dt)]
end loop
print(date_list)

Now construct an Input Visualiser icon which you will drop into the Macro Editor: ensure that the Input X Type is set to type Date and enter some dummy values so that useful Macro code generated. Replace the values of input_date_x_values and input_y_values with your lists of data.

...

Info

In Organising Macros we will see how to put similar code into functions in order to reduce duplication of code.

...

Extra Work

Customise the time series plot:

...