Skip to main content
  • Home
  • Documentation
  • FAQ
  • Downloads
  • Support
  • Current Release Notes
  • Ferret Users Guide
    • Users Guide Index
    • Commands Reference
    • 1. Introduction
    • 2. Data Set Basics
    • 3. Variables & Expressions
    • 4. Grids & Regions
    • 5. Animations & Gif Images
    • 6. Customizing Plots
    • 7. Handling String Data Symbols
    • 8. Working with Special Data Sets
    • 9. Computing Environment
    • 10. Converting to NetCDF
    • 11. Writing External Functions
    • Glossary
    • Appendix A: Functions
    • Appendix B: PPLUS Guide
    • Appendix C: Ferret-Specific PPLUS Enhancements
  • Previous Release Notes
  • Tutorials and Demos
    • Ferret Tour
    • DSG files: Discrete Sampling Geometries Demo
    • Ferret sorting demo
    • Fast Fourier Transforms demo
    • Empirical Orthogonal Functions demo
    • Ferret objective analysis demo
    • Ferret Palette Demo
    • Map projections
    • Ferret polygon vector demo
    • Ferret Graticules demo
    • Ferret Polytube Demo
    • Ferret Polymark Demo
    • Ferret Constant-Array demo
    • Ferret land_detail demo
    • COADS Tour
    • Levitus Tour
    • Use OPeNDAP
    • Ferret binary read demo
  • PyFerret
    • PyFerret Downloads and Install ../../faq/ferret-faqs.html
    • What is PyFerret?
    • Why use PyFerret?
    • PyFerret for the Ferret user
    • PyFerret command syntax: quick-start notes
    • PyFerret for the Python user
    • Graphics in PyFerret ?
    • New Ferret functionality
    • PyFerret Python functions and constants
    • PyFerret Python objects and methods
    • Ferret external functions in Python
    • Ferret Fortran external functions
    • PyFerret metadata-and-data dictionaries
  • OPeNDAP
    • OPeNDAP usage in Ferret
    • Use OPeNDAP Demo
    • Test OPeNDAP

9.4 HARD COPY AND METAFILE TRANSLATION


9.4.1 Hard copy: Ferret postscript and gif file output and PyFerret image files

In PyFerret, give the FRAME with a file type and file name. The options are PNG, PostScript, PDF and SVG files.  Note that metafiles are not used in PyFerret. If SET MODE METAFILE is issued in PyFerret, it will issue a NOTE, and continue.

Using Ferret, gif images may be saved as described below in Section 9.4.3.

Ferret can also write a metafile which is translated with a separate program outside of Ferret to a postscript file. For this method, follow these steps:

1) Within Ferret, enter the command

yes? SET MODE METAFILE

This tells Ferret to generate a graphic metafile (ANSI/ISO GKSM format) for each plot created thereafter. To stop making the metafiles type

yes? CANCEL MODE METAFILE

2) Produce each plot as you would normally. Each new plot on your screen generates an additional file named "metafile.plt.~n~" where "n" will be incremented for each metafile. Overlay commands do not produce additional metafiles. (The metafile name may be set by the SET MODE METAFILE command.)

3) After exiting from Ferret use the command Fprint.

Note: If it is necessary to use Fprint without exiting Ferret, then issue the command yes? PPL CLSPLT. This will close the current metafile. Note that neither overlays nor additional viewports can be added to the plot after the metafile has been closed.

Fprint is a script which translates metafiles generated by Ferret. It uses the program "gksm2ps" and is intended to simplify sending plots to printers, to an output file only, or to a workstation screen. See the next section, Metafile Translation, for a description of gksm2ps which has additional options.

The Fprint script translates metafiles to Encapsulated PostScript or X-window output. Your system manager should customize the script at your site to permit your specification of the actual printers you have as output devices. Fprint uses standard Unix command line syntax.

Fprint [-h] [-P printer || -o file_name || -X]
[-p orient] [-# n] [-l line] [-R] metafile(s)

 

 
Options  

-h

displays help on your terminal.

-P printer

Routes output to named printer. Files will not be renamed by previewing. You will be prompted, however, with an option to delete each metafile after previewing. The output window size will be equivalent to the default size in Ferret (SET WINDOW/SIZE=0.7).

-o file_name

Routes output to named disk postscript file.

-X

Routes output to your workstation screen. Files will not be renamed by previewing. You will be prompted, however, with an option to delete each metafile after previewing. The output window size will be equivalent to the default size in Ferret (SET WINDOW/SIZE=0.7).

-p orient

The page orientation option determines whether the plot will be placed on the page in landscape format, with the horizontal side longer than the vertical, or portrait, with the vertical side longer. Valid option values are "landscape" and "portrait". The default behavior is to orient the plot to best fit the page.

-# n

Specifies number of copies (n).

-l line

This option lets you specify line styles. Valid options are "ps" and "cps". "ps" uses dot-dashed line types; "cps" uses colored lines. The default is "ps" for monochrome printers and "cps" for color printers.

-R

Turns off the default behavior of the metafile translator to append a date stamp to metafile names when they are sent to a printer or a disk file. The default action is intended to distinguish metafiles that have been printed out; this option keeps the metafile names unmodified.

-C

Output a CMYK postscript file; default is RGB. See the FAQ on CMYK color, How can I get CMYK format for postscript files?

 

Examples

Examples

% Fprint metafile.plt

renders "metafile.plt" on the default printer identified by the environment variable PRINTER.

% Fprint -P myprinter -R metafile.plt*

renders all versions of "metafile.plt" on printer myprinter. Does not date stamp them.

% Fprint -o my_plot.ps metafile.plt.

9.4.2 Metafile translation

The command "gksm2ps" allows you to control the translation of the device-independent metafiles made by Ferret into device-specific output files. "gksm2ps" was written by Larry Oolman at the University of Wyoming and modified at NOAA/PMEL for use with Ferret. The "gksm2ps" command uses standard Unix command line syntax. See usage hints provided by the -h option.

gksm2ps [-h] [-p landscape||portrait] [-l ps||cps] [-d cps||phaser] \

[-X || -o <ps_output_file>] [-R] [-a] [-g WxH+X+Y] file(s)

The -g option (-g WxH+X+Y) provides detailed control over the size, position, and aspect ratio of the plot on the printed page.

 

 
Options  

-h

prints help message.

-p orient

The page orientation option determines whether the plot will be placed on the page in landscape format, with the horizontal side longer than the vertical, or portrait, with the vertical side longer. The default is to orient the plot to best fit the page.

-l line

This option permits specification of line styles in the hardcopy plot. Valid options are "ps" (the default) and "cps". "ps" renders lines as solid and dot-dashed and is suited for monochrome printers. "cps" renders lines in color.

-d devtype

The target device type of the translator. If the -d option is omitted and output is to a file gksm2ps will use devtype "ps".

 

Valid devtype values:

 

Cps ‚ color PostScript

-X

Sends the output to your X-window for preview.

-o ofile

The output will be directed to the file "ofile." Omit both this and the device type option when directing output to your workstation screen with -X. If neither -o nor -X is specified, gksm2ps creates a postscript file in the current directory called "gksm2ps_output.ps".

-a

Makes the plot the size of the original plot as specified in PPLUS inches (absolute size), rather than fitting the plot to the page (the default behavior).

-g WxH+X+Y

The -g option (-g WxH+X+Y) provides detailed control over the size, position, and aspect ratio of the plot on the printed page. The arguments W, H, X, and Y are given in units of points (1/72 of an inch).
  Normally when using this option you will want to specify an identical value for both W and H, the size (in points) you want the longer dimension of the plot to be. Unequal values of W and H will alter the aspect ratio of the plot relative to its appearance on your workstation screen.
 

The X and Y values are the offset of the lower left corner of the plot from the lower left corner of the page. If you want your plot's longer side to be 5 inches long, 3 inches right from the corner, and 2 inches up, for example, specify

> gksm2ps -o my_plot.ps -g 360x360+216+144 my_file.plt
> lpr my_plot.ps

-R

Turns off the default behavior of the metafile translator to append a date stamp to metafile names when they are sent to a printer or a disk file. The default action is intended to distinguish metafiles that have been printed out; this option keeps the metafile names unmodified.

If the user does not specify an output option (-o or -X) gksm2ps translates the metafile and produces a PostScript file called gksm2ps_output.ps. After translation by gksm2ps, metafiles are renamed with a date stamp unless -R was specified. To get hard copy printed, the output PostScript file needs to be sent to the appropriate printer.

9.4.3 Hard Copy: gif, png, pdf, ps, svg files.

To create gif graphics output, execute Ferret commands to produce a plot. Then use the FRAME command to save a graphics file.

In PyFerret, give the FRAME with a file type and file name. The options are PNG, PostScript, PDF and SVG files.

In classic Ferret use the command FRAME/FILE=filename.gif to write a gif-formatted file.

Or, start Ferret in gif mode,with the -gif command-line switch, to run Ferret without X server software. Execute the FRAME command to save the plot as a gif image.

% ferret -gif
yes? (commands that generate a plot..)
yes? FRAME/FILE=picture.gif

or

% pyferret -unmapped
yes? (commands that generate a plot..)
yes? FRAME/FILE=picture.png

For a complete description of the startup modes, refer to the Unix command line switches.