awips2/pythonPackages/scientific/Scientific/N.py
root 2b462d8665 Initial revision of AWIPS2 11.9.0-7p5
Former-commit-id: 06a8b51d6d [formerly a02aeb236c [formerly 9f19e3f712] [formerly 06a8b51d6d [formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]]
Former-commit-id: a02aeb236c [formerly 9f19e3f712]
Former-commit-id: a02aeb236c
Former-commit-id: 133dc97f67
2012-01-06 08:55:05 -06:00

32 lines
884 B
Python
Executable file

import Scientific_numerics_package_id
package = Scientific_numerics_package_id.getNumericsPackageName()
del Scientific_numerics_package_id
if package == "Numeric":
from Numeric import *
def int_sum(a, axis=0):
return add.reduce(a, axis)
def zeros_st(shape, other):
return zeros(shape, other.typecode())
array_type = ArrayType
elif package == "NumPy":
from numpy.oldnumeric import *
def int_sum(a, axis=0):
return add.reduce(a, axis)
def zeros_st(shape, other):
return zeros(shape, dtype=other.dtype)
from numpy import ndarray as array_type
elif package == "Numarray":
from numarray import *
def int_sum(a, axis=0):
return add.reduce(a, axis, type=Int)
def zeros_st(shape, other):
return zeros(shape, other.typecode())
else:
raise ImportError("Unknown numerics package " + package)