Versions Compared

Key

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

...

  • the write() function always takes a filename as its first argument, and it can take a string as its second argument
  • it always overwrites an existing file of the same name, so there exists another function, append() which will add your string to a new line on an existing file
  • so you will need to call write() once with the first line of text, and append() once with the list of parameters
  • the list of parameters will need to be flattened out into a string with '/' as the separator - this will need to be done in a loop with a string variable initialised to '', and each element added with the & operator
  • the global variable newline can be used to add a newline character between the lines

ODB

Image Added

ODB stands for Observational DataBase and is developed at ECMWF to manage very large observational data volumes through the ECMWF IFS/4DVAR-system. The data structure of an ODB database can be seen as a table of variables called columns. Right-click examine the ODB Database icon AMSUA.odb to see a list of the variables in the data. The Data tab provides access to the actual data itself. ODB data can be filtered using ODB/SQL queries. The supplied ODB Filter icon contains an ODB/SQL query to retrieve certain columns of data. Edit it - note that this pre-prepared icon is using the ODB Database icon AMSUA.odb icon as its data input. Look at the ODB Query field to get an idea of what data will be filtered. Now close the editor and examine the icon to see the filtered subset of data it has produced. The ODB Visualiser icon tb_plot tells Metview which columns of data to use for the visualisation; visualise it and apply the symb_colours icon to obtain a nice plot.

Extra Work

Optimisations to file writing

...

  • in fact, it could be done with a single write() function with the help of the built-in global variable newlineif we just build up a string representing the whole file with newline characters between lines
  • if writing many many lines, there is another syntax which avoids multiple file open and close operations:
    • Code Block
      fh = file('output.txt')  # open a file handle
      for i = 1 to 100 do
          write(fh, 'Line ' & i & newline)
      end for
      fh = 0 # close the file handle

...