Gri: Write commands

Chapters: 1: Introduction 2: Simple example 3: Invocation 4: Finer Control 5: X-Y Plots 6: Contour Plots 7: Image Plots 8: Examples 9: Gri Commands 10: Programming 11: Environment 12: Emacs Mode 13: History 14: Installation 15: Gri Bugs 16: Test Suite 17: Gri in Press 18: Acknowledgments 19: License Indices: Concepts Commands Variables | ### 9.3.53: The ``write`' commands The ``write`' commands write various things. If the filename is ``stdout`', the information is written to the standard output device (ie, the screen); if it is ``stderr`', the information is written to the standard error device (ie, the screen). IMPORTANT NOTE: The ``write`' commands append to the output file, as opposed to overwriting the contents of the file. Therefore if you've run the Gri script before, and want fresh output, make sure to do something like the following
    system rm -f the_grid.dat
    write grid to grid.dat
Write Columns: Write columns to a file Write Contour: Write contour (x,y) data to a file Write Grid: Write grid data to a file Write Image: Write various properties of image to a file #### 9.3.53.1: ``write columns`'
    `write columns to \filename'
Append data columns to the end of the indicated file. #### 9.3.53.2: ``write contour`'
    `write contour .value. to \filename'
Append to the named file the (x,y) pairs defining the contour of the indicated value. The first line of output is a header line, containing two numbers: the contour value and the missing value. Then the (x,y) pairs are written a line at a time, with missing values being used to indicate ends of segments. A blank line is written after the last data pair. For example, if the contour contained two closed regions, Gri would output a pair of missing values as one of the xy pairs, to denote the separation of the two curves. You could read and plot the output as in this example
    write contour 10 to contour.out
    open contour.out
    read .contour_value. .missing.
    set missing value .missing.
    read columns x y
    draw curve
#### 9.3.53.3: ``write grid`'
    `write grid to \filename [bycolumns]'
Append grid to the end of the named file. Storage is in ``%f`' format, and is in normal image order. If the keyword ``bycolumns`' is present, then the grid is transposed first, in such a way that ``read grid data bycolumns`' performed on that file will read back the original grid data. #### 9.3.53.4: ``write image`'
    `write image ... to \filename'
The variants of this command write various things about the image to the named file, as illustrated in the following table. ``write image to image.dat`' Append image to the end of the named file. Storage is by unsigned-char, and is in normal image order. There is no header. ``write image rasterfile to image.dat`' Append image to the end of the named file, in Sun Rasterfile format. ``write image pgm to mask.dat`' Append image mask to the end of the named file, in PGM 'rawbits' format. ``write image mask to mask.dat`' Append image mask to the end of the named file. Storage is by unsigned-char, and is in normal image order. ``write image mask rasterfile to mask.dat`' Append image mask to the end of the named file, in Sun Rasterfile format. ``write image mask pgm to mask.dat`' Append image mask to the end of the named file, in PGM 'rawbits' format. ``write image colorscale to colorscale.dat`' Append image colorscale transform to the end of the named file. Storage is a series of 256 lines, each containing 3 numbers (for Red, Green and Blue) in the range 0 to 1. The file is suitable for reading with the ``read image colorscale`' command. ``write image grayscale to grayscale.dat`' Append image grayscale transform to the end of the named file. Storage is a series of 256 lines, each containing a number in the range 0 to 1. The file is suitable for reading with the ``read image grayscale`' command.