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

11.1 OVERVIEW


External functions are user-written Fortran routines which are called from the Ferret command line just as internal Ferret functions (e.g. SIN, COS) are invoked. For example, you might create a routine to compute the amplitudes of the Fourier transform of a time series (the periodogram) and name your function "FFT_AMP". In Ferret you would use it like this:

LET my_fft = FFT_AMP(my_time_series)

Once the variable my_fft is defined, it can be used in other expressions, plotted, etc. External functions can be used in every way that Ferret internal functions are used and are distinguished only by their appearance after internal functions when the user issues a SHOW FUNC command.

A Ferret external function uses input arguments defined in a Ferret session and computes a result with user-supplied Fortran or C code. The external function specifies how the grid for the result will be generated. The axes can be inherited from the input arguments or specified in the external function code.

Utility functions, linked in when the external function is compiled, obtain information from Ferret about variables and grids. The utility functions are described in section 11.6.

Ferret external functions are compiled individually to create shared object (.so) files. These are dynamically linked with Ferret at run time. Ferret looks for shared object files in the directories specified in the FER_EXTERNAL_FUNCTIONS environment variable.