To use this library with your Jython scripting, you just need to "import Numeric". You might find it convenient to makes sure there are no name conflicts by using something like this:
Code: Select all
import Numeric as N
You can then do things like:
Code: Select all
a=N.array([1,2,3])
b=N.array([3,2,1])
print a,b
[1 2 3] [3 2 1]
print N.greater(a,b)
[0 0 1]
print N.sin(a)
[0.841470984808 0.909297426826 0.14112000806]
c = a*b
print c
[3 4 3]
More complete documentation of the available methods along with lots of examples can be found at sites like:
http://gfesuite.noaa.gov/AWIPS/ob7.2a/doc/onlinehelp/numdoc.html
Although this applies to the newer NumPy package, so some methods there will not be applicable.
Here is a listing of what is in JNumeric, though:
Code: Select all
['ArrayType', 'Complex', 'Complex128', 'Complex64', 'FFT', 'Float', 'Float32', 'Float64', 'Int', 'Int16', 'Int32', 'Int64', 'Int8',
'LittleEndian', 'NewAxis', , 'add', 'alltrue', 'arange', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh',
'argmax', 'argmin', 'argsort', 'array', 'arrayrange', 'asarray', 'bitwise_and', 'bitwise_not', 'bitwise_or', 'bitwise_xor',
'ceil', 'choose', 'classDictInit', 'clip', 'compress', 'concatenate', 'conjugate', 'convolve', 'cos', 'cosh', 'cross_correlate',
'cumproduct', 'cumsum', 'diagonal', 'divide', 'dot', 'e', 'equal', 'exp', 'floor', 'fromfunction', 'fromstring', 'greater',
'greater_equal', 'identity', 'imaginary', 'indices', 'innerproduct', 'less', 'less_equal', 'log', 'log10', 'logical_and',
'logical_not', 'logical_or', 'logical_xor', 'maximum', 'minimum', 'multiply', 'nonzero', 'not_equal', 'ones', 'pi', 'power',
'product', 'ravel', 'real', 'remainder', 'repeat', 'reshape', 'resize', 'searchsorted', 'shape', 'sin', 'sinh', 'sometrue',
'sort', 'sqrt', 'subtract', 'sum', 'take', 'tan', 'tanh', 'trace', 'transpose', 'umath', 'where', 'zeros']