acof2boxed(filename)
area_on_globe(latitude,
longitude)
color_wheel(n,v,b)
cv(main_nao[,dim_number])
fix_longitude(longitude)
fuzzy_floor(x[,eps])
fuzzy_ceil(x[,eps])
gets_matrix(filename)
head(x[,n])
hsv2rgb(hsv)
isMissing(x)
isPresent(x)
magnify_interp(a, mag_factor)
merid_wt(longitude)
mixed_base(x,b)
outer(dyad,y[,x])
reverse(x[,verb_rank])
scaleAxisSpan(xstart,xend[,nmax[,nice]])
range(a)
tail(x[,n])
zone_wt(latitude)
nap_function_lib.tcl.
acof2boxed(filename)
Example:
nap "i = acof2boxed('abc.acof')"
area_on_globe(latitude, longitude)
Example:
% [nap "area_on_globe(-90 .. 0 ... 45, 0 .. 180 ... 45)"] value -format %.4f
0.0229 0.0092 0.0092 0.0092 0.0229
0.0781 0.0312 0.0312 0.0312 0.0781
0.2115 0.0846 0.0846 0.0846 0.2115
color_wheel(n,v,b)
Example:
nap "color_wheel(100,255,3#150)"
This produces a u8 array with shape
{3 100 100} & values from 0 to 255.
cv(main_nao[,dim_number])
coordinate_variable.
fix_longitude(longitude)
degrees_east.
fuzzy_floor(x[,eps])
floor() except allow for rounding error.
1e-9.
Example:
% [nap "fuzzy_floor({4.998 4.9998},1e-3)"]
4 5
fuzzy_ceil(x[,eps])
ceil() except allow for rounding error.
1e-9.
Example:
% [nap "fuzzy_ceil({5.002 5.0002},1e-3)"]
6 5
gets_matrix(filename)
Example:
gets_matrix('my_matrix.txt')
head(x[,n])
Example:
% [nap "head({3 1 9 2 7})"]
3
% [nap "head({3 1 9 2 7}, 2)"]
3 1
% [nap "head({3 1 9 2 7}, -2)"]
3 1 9
hsv2rgb(hsv)
Layer 0 along this dimension corresponds to hue as an angle in degrees. Angles of any sign or magnitude are allowed. Red = 0, yellow = 60, green = 120, cyan = 180, blue = −120, magenta = −60.
Layer 1 along this dimension corresponds to saturation in range 0.0 to 1.0.
Layer 2 along this dimension corresponds to "value". This has the same range as the RGB values, normally either 0.0 to 1.0 or 0 to 255. If you are casting the result to an integer & want a maximum of 255 then set the maximum to say 255.999. Otherwise you will get few if any 255s.
The result has the same shape as the argument (hsv).
See Foley, vanDam, Feiner and Hughes, Computer Graphics
Principles and Practice, Second Edition, 1990, ISBN 0201121107
page 593.
Example:
% [nap "hsv2rgb {180.0 0.5 100.0}"]
50 100 100
isMissing(x)
Example:
% [nap "isMissing {0 _ 9}"]
0 1 0
isPresent(x)
Example:
% [nap "isPresent {0 _ 9}"]
1 0 1
magnify_interp(a, mag_factor)
This function can be used to make images larger or smaller.
Example:
% [nap "magnify_interp({{1 2 3}{4 5 6}}, {1 3})"] value
1.00000 1.33333 1.66667 2.00000 2.33333 2.66667 3.00000
4.00000 4.33333 4.66667 5.00000 5.33333 5.66667 6.00000
magnify_nearest(a, mag_factor)
magnify_interp
except that the new values are defined by the nearest neighbour rather than interpolation.
Example:
% [nap "magnify_nearest({{1 2 3}{4 5 6}}, {1 3})"] value
1 1 2 2 2 3 3
4 4 5 5 5 6 6
merid_wt(longitude)
Example:
% [nap "merid_wt {-180 -90 -45 0 90 180}"]
0.125 0.1875 0.125 0.1875 0.25 0.125
mixed_base(x,b)
Following example converts 87 inches to yards, feet & inches:
% [nap "mixed_base(87, {3 12})"]
2 1 3
outer(dyad,y[,x])
dyad is name of either
Following example produces a multiplication table:
% [nap "outer('*', 1 .. 5)"]
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
reverse(x[,verb_rank])
Examples:
% [nap "reverse {1 9 0 7}"]
7 0 9 1
% [nap "reverse {{1 2 3}{4 5 6}}"]
4 5 6
1 2 3
% [nap "reverse({{1 2 3}{4 5 6}}, 1)"]
3 2 1
6 5 4
scaleAxis(xstart,xend[,nmax[,nice]])
{1 2 5})
//xend
(-30 .. 30) of 10
Example:
% [nap "axis = scaleAxis(-370, 580, 10, {10 20 25 50})"] value
-300 -200 -100 0 100 200 300 400 500
scaleAxisSpan(xstart,xend[,nmax[,nice]])
{1 2 5})
//xend
(-30 .. 30) of 10
Example:
% [nap "axis = scaleAxisSpan(-370, 580, 10, {10 20 25 50})"] value
-400 -200 0 200 400 600
range(a)
% [nap "range {{9 -1 -5}{2 9 3}}"]
-5 9
tail(x[,n])
nels(x)+n elements of x
i.e. drop −n from start.
Example:
% [nap "tail({3 1 9 2 7})"]
7
% [nap "tail({3 1 9 2 7}, 2)"]
2 7
% [nap "tail({3 1 9 2 7}, -2)"]
9 2 7
zone_wt(latitude)
Example:
% [nap "zone_wt(-90 .. 90 ... 30)"] value
0.0334936 0.125 0.216506 0.25 0.216506 0.125 0.0334936