nhood - Neighborhood arithmetic for 1-D and 2-D variables

SYNOPSIS

nhood  [ parameter=value ... ]  [ inputfile outputfile ]
nhood  [ parameter=value ... ]  [ inputfile ... directory ]

Parameters are: reduce, box_sides, min_good, expr_vars, expression, use_degrees, var_name, var_units, var_type, offset, scale_factor.

DESCRIPTION

nhood performs neighborhood arithmetic on data within small boxes for 1-D and 2-D variables. Complex expressions can combine several variables from an input dataset to create a variable in a new output dataset. All input variables must have the same dimensions, but not necessarily the same datatype. All arithmetic is done as 64-bit floating point calculations. Output data can be stored as any non-string datatype, including 8-bit or 16-bit scaled integers.

The output variable can either be the same size as the input variables, or reduced by factors determined by box size. For example, if the input variables are 750-by-1000, and the box size is 3-by-3, the output variable can either be 750-by-1000 or 250-by-333.

nhood supports the same arithmetic operations supported by emath and emath2 with the following exceptions. (See emath).

First, ij and nj refer to box dimension indices and sizes, NOT variable dimension indices and sizes.

Second, the following aggregate functions are supported by nhood.

min(x)        minimum of the values in the box
max(x)        maximum of the values in the box
ngood(x)      number of good values in the box
ave(x)        average of the values in the box
sum(x)        sum of the values in the box.
stdev(x)      standard deviation of the values in the box
variance(x)   variance of the values in the box
median(x)     median of the values in the box.

The user specifies the minimum number of good values in a given box needed to evaluate a given aggregate function.

PARAMETERS

reduce

Indicates that the output variable dimensions are to be reduced, based on box size. Valid reponses are [yes, no]. The default is no.

box_sides

One or two positive numbers indicating the size of the neighborhood box. The variables must have as many dimensions as the box has sides. The maximum size is 50. There is no default.

min_good

The number of good values needed to evaluate an aggregate function for a given box. This number must be between 1 and the product of the box sides. The default is half the product.

expr_vars

List of variables to use in the expression. Wildcards * and ? are allowed, provided that each wildcard term matches exactly one variable. This restriction forces the user to unambiguously specify variables in order. There is no default.

expression

The arithmetic/logical expression. There is no default.

use_degrees

OPTIONAL. If yes, output from trig functions is in degrees, and input to inverse trig functions is assumed to be in degrees. If no, output from trig functions is in radians, and input to inverse trig functions is assumed to be in radians. The default is yes.

var_name

The name of the output variable in the output TeraScan dataset. There is no default.

var_units

The units of the output variable. The default is no units.

var_type

The datatype of the output variable. Valid responses are [byte, short, long, float, and double]. The default is float.

offset, scale_factor

If the var_type is byte or short, the output data are scaled using the following linear transform:

stored output value = nearest int[(original value - offset)*scale_factor]

offset can be any number. scale_factor can be any non-zero number. The default values are 0 and 1 respectively.

EXAMPLES

Example 1. Simple high-pass filter.

[8] % emath
in/out files   : char(255) ? big big.out
reduce         : char(  3) ? [no]
box_sides      : int (  2) ? 3 3
min_good       : int       ? [4]
expr_vars      : char(255) ? [] *ch1
expression     : char(255) ? x1 - ave(x1)
var_name       : char( 31) ? noise
var_units      : char( 31) ? []
var_type       : char( 15) ? [float]

SEE ALSO

convolve, fakedata, emath, smear, subsample

NOTES

nhood copies the earth transform from the input dataset to the output, if the transform exists, and modifies it in the case of reduction.


Last Update: $Date: 1998/05/29 18:44:19 $