Versions Compared

Key

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


 

These functions work with files and other I/O tasks.


Anchor
append

...

append
none append ( string,any,... )

...

Writes output to a file specified by its name or by a filehandler previously assigned to it by the file() function. The output file type depends on the type that is being written - in exactly the same way as it does for the write() function (see below). As the name implies, append() never overwrites previously existing output. 


Anchor
exist
exist
 
number exist ( string )

This function checks whether a file or directory exists. The single argument is the file or directory name - you must specify the full path . The function returns a number, 1 if the file exists and 0 otherwise. Use it combined with fail() or stop() for error checking :

if (not(exist("/home/xy/xyz/metview/grib_file"))) then
    fail("specified input file does not exist!")
end if
(...)


Anchor
file

...

file
filehandler file ( string )

Assigns a file handler to a file whose name is the function argument. The file handler can be used in place of the file name in file output functions - write() and append() .


Anchor

...

newpage
newpage
none newpage ( display window )

Forces a new page to be taken in the current PostScript file.


Anchor
print

...

print
none print (...)

Prints all its arguments to the output area of the main user interface (and to that of any opened macro editor window).


Anchor
read

...

read
fieldset read ( string )
observations read ( string )
geopoints read ( string )
list read ( string )
netcdf read ( string )

...

The variable of type list is used to hold the contents of an ASCII file - the elements of this list variable are themselves lists, each holding a line of text. The elements of these sub lists are the text line tokens (component strings) arising from the parsing of the text. 


Anchor
read_table
read_table
table read_table ( definition )

Reads an ASCII table-based file such as a comma separated value (CSV) file. Use the Table Reader icon to construct the input definition for this function.


Anchor
tmpfile

...

tmpfile
string tmpfile ( )

Reserves and returns a unique file name (inside the Metview cache directory) for a temporary file. Returned filenames are unique even when there are several copies of the same macro being executed simultaneously.


Anchor

...

write
write
none write ( string,any,... )
none write ( filehandler,any,... )

...