Prev Up Next Index
Go backward to 4.3.2 Array Manipulation
Go up to 4.3 Examples
Go forward to 5 Header Formats

4.3.3 Sampling and Data Manipulation

With a wider range of descriptive possibilities, FreeForm can more easily be used for sampling and subsetting data, as in these examples.

The following array descriptor pair subsets a two-dimensional array, retrieving one quarter (the north-west quarter of the earth).

INPUT: ["latitude" -90 to 90] ["longitude" -179 to 180]
OUTPUT: ["latitude" 0 to 90] ["longitude" -179 to 0]  

The following array descriptor pair flips a two-dimensional array row-wise (vertically).

INPUT: ["row" 0 to 100] ["column" 13 to 42]
OUTPUT: ["row" 100 to 0] ["column" 13 to 42]  

The following array descriptor pair rotates a two-dimensional array 90 degrees (exchanging rows and columns).

INPUT: ["row" 0 to 10] ["column" 0 to 42]
OUTPUT: ["column" 0 to 42] ["row" 0 to 10]  

The following array descriptor pair outputs every other plane from a three-dimensional array (essentially cutting the depth resolution in half).

INPUT: ["plane" 1 to 18] ["row" 0 to 10] ["column" 0 to 42]
OUTPUT: ["plane" 1 to 18 by 2] ["row" 0 to 10] ["column" 0 to 42]  

The following array descriptor pair replicates every plane from a three-dimensional array three times (essentially tripling the depth).

INPUT: ["plane" 1 to 54 by 3] ["row" 0 to 10] ["column" 0 to 42]
OUTPUT: ["plane" 1 to 54] ["row" 0 to 10] ["column" 0 to 42]  

This array descriptor pair outputs the middle 1/27 of a three dimensional array with depth and width exchanged and height halved and flipped:

INPUT: ["plane" 1 to 27] ["row" 1 to 27] ["column" 1 to 27]
OUTPUT: ["column" 10 to 18] ["row" 18 to 10 by 2] ["plane" 10 to 18]  

Tom Sgouros and James Gallagher, 2006-02-12

Prev Up Next