本文整理汇总了Python中org.meteoinfo.data.ArrayMath类的典型用法代码示例。如果您正苦于以下问题:Python ArrayMath类的具体用法?Python ArrayMath怎么用?Python ArrayMath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArrayMath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __rdiv__
def __rdiv__(self, other):
r = None
if isinstance(other, MIArray):
r = MIArray(ArrayMath.div(other.array, self.array))
else:
r = MIArray(ArrayMath.div(other, self.array))
return r
示例2: __mul__
def __mul__(self, other):
r = None
if isinstance(other, MIArray):
r = MIArray(ArrayMath.mul(self.array, other.array))
else:
r = MIArray(ArrayMath.mul(self.array, other))
return r
示例3: median
def median(self, axis=None):
'''
Compute tha median along the specified axis.
:param axis: (*int*) Axis along which the standard deviation is computed.
The default is to compute the standard deviation of the flattened array.
returns: (*array_like*) Median result
'''
if axis is None:
return ArrayMath.median(self.array)
else:
return MIArray(ArrayMath.median(self.array, axis))
示例4: inpolygon
def inpolygon(self, x, y, polygon):
if isinstance(polygon, tuple):
x_p = polygon[0]
y_p = polygon[1]
if isinstance(x_p, MIArray):
x_p = x_p.aslist()
if isinstance(y_p, MIArray):
y_p = y_p.aslist()
return MIArray(ArrayMath.inPolygon(self.array, x.aslist(), y.aslist(), x_p, y_p))
else:
if isinstance(polygon, MILayer):
polygon = polygon.layer
return MIArray(ArrayMath.inPolygon(self.array, x.aslist(), y.aslist(), polygon))
示例5: sum
def sum(self, axis=None):
'''
Sum of array elements over a given axis.
:param axis: (*int*) Axis along which the standard deviation is computed.
The default is to compute the standard deviation of the flattened array.
returns: (*array_like*) Sum result
'''
if axis is None:
return ArrayMath.sum(self.array)
else:
r = ArrayMath.sum(self.array, axis)
return MIArray(r)
示例6: max
def max(self, axis=None):
'''
Get maximum value along an axis.
:param axis: (*int*) Axis along which the maximum is computed. The default is to
compute the maximum of the flattened array.
:returns: Maximum values.
'''
if axis is None:
r = ArrayMath.max(self.array)
return r
else:
r = ArrayMath.max(self.array, axis)
return MIArray(r)
示例7: std
def std(self, axis=None):
'''
Compute the standard deviation along the specified axis.
:param x: (*array_like or list*) Input values.
:param axis: (*int*) Axis along which the standard deviation is computed.
The default is to compute the standard deviation of the flattened array.
returns: (*array_like*) Standart deviation result.
'''
if axis is None:
r = ArrayMath.std(self.array)
return r
else:
r = ArrayMath.std(self.array, axis)
return MIArray(r)
示例8: prod
def prod(self):
'''
Return the product of array elements.
:returns: (*float*) Produce value.
'''
return ArrayMath.prodDouble(self.array)
示例9: argmax
def argmax(self, axis=None):
'''
Returns the indices of the minimum values along an axis.
:param axis: (*int*) By default, the index is into the flattened array, otherwise
along the specified axis.
:returns: Array of indices into the array. It has the same shape as a.shape with the
dimension along axis removed.
'''
if axis is None:
r = ArrayMath.argMax(self.array)
return r
else:
r = ArrayMath.argMax(self.array, axis)
return MIArray(r)
示例10: contains_nan
def contains_nan(self):
'''
Check if the array contains nan value.
:returns: (*boolean*) True if contains nan, otherwise return False.
'''
return ArrayMath.containsNaN(self.array)
示例11: sign
def sign(self):
'''
Returns an element-wise indication of the sign of a number.
The sign function returns -1 if x < 0, 0 if x==0, 1 if x > 0. nan is returned for nan inputs.
'''
return MIArray(ArrayMath.sign(self.array))
示例12: abs
def abs(self):
'''
Calculate the absolute value element-wise.
:returns: An array containing the absolute value of each element in x.
For complex input, a + ib, the absolute value is \sqrt{ a^2 + b^2 }.
'''
return MIArray(ArrayMath.abs(self.array))
示例13: take
def take(self, indices):
'''
Take elements from an array along an axis.
:param indices: (*array_like*) The indices of the values to extract.
:returns: (*array*) The returned array has the same type as a.
'''
ilist = [indices]
r = ArrayMath.take(self.array, ilist)
return MIArray(r)
示例14: transpose
def transpose(self):
'''
Transpose 2-D array.
:returns: Transposed array.
'''
if self.ndim == 1:
return self[:]
dim1 = 0
dim2 = 1
r = ArrayMath.transpose(self.asarray(), dim1, dim2)
return MIArray(r)
示例15: maskout
def maskout(self, x, y, polygon, fill_value=Double.NaN):
if isinstance(x, MIArray):
xl = x.aslist()
else:
xl = x
if isinstance(y, MIArray):
yl = y.aslist()
else:
yl = y
if isinstance(polygon, MILayer):
polygon = polygon.layer
return MIArray(ArrayMath.maskout(self.array, xl, yl, polygon, fill_value))