FISH Scripting Reference

FISH Introduction

FISH is an embedded programming language that enables the user to interact with and manipulate models, defining new variables and functions as needed. These functions may be used to extend, add to, or control the program. For example, FISH can be used to plot or print new variables, parameterize models, control model runs, create/calculate new model outputs, monitor results, and post-process model runs.

FISH was developed in response to users who wanted to perform operations in Itasca software that were either difficult or impossible with existing program structures. Rather than incorporate many new and specialized features into the programs, FISH was provided so that users could write functions to perform custom analyses. It is possible for someone without programming experience to write simple FISH functions. A first-time user can become adept and facile with FISH simply by going through Tutorial: Working with FISH. However, FISH programs can also become very complicated.

As with all programming tasks, FISH functions should be constructed in an incremental fashion, checking operations at each level before moving on to more complicated code. FISH does less error-checking than most compilers, so all functions should be tested on simple data sets before they are used for real applications.

FISH programs are embedded in a data file: lines following fish define are processed as a FISH function; the function terminates when the word end is encountered. Functions may invoke other functions, which may invoke others, and so on. The order in which functions are defined does not matter, so long as they are all defined before they are used (that is, invoked by a program command). Since the compiled form of a FISH function is stored in the program’s memory space, the model save command saves the function and the current values of associated variables.