...
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:, very similar to an exercise in Handling Time in Metview.
Code Block | ||
---|---|---|
| ||
#dates obtain= twonil loop listsdt - onein 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 ) # ASSUME the times are in hours, like 1200 is 12:00 print(dates) # but these are still numbers - we need to call the date() function to convert # into proper date variables, and we need to loop through the list to do it date_list = nil loop dt in dates date_list = date_list & [date(dt) dt = date(d) + hour(t/100) dates = dates & [dt] end loop print(date_listdates) |
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. In the macro, replace the values of input_date_x_values
and input_y_values
with your lists of data.
...