mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
update NDArray and DimArray for better array wrap
This commit is contained in:
parent
ee78df31cc
commit
c7605e7b15
@ -6207,14 +6207,15 @@ public class GraphicFactory {
|
||||
int rowNum = shape[0];
|
||||
double x1, x2, x3, x4, v;
|
||||
PolygonBreak pb;
|
||||
if (!x_s.getIndexPrivate().isFastIterator())
|
||||
x_s = x_s.copy();
|
||||
if (!y_s.getIndexPrivate().isFastIterator())
|
||||
y_s = y_s.copy();
|
||||
if (!a.getIndexPrivate().isFastIterator())
|
||||
a = a.copy();
|
||||
x_s = x_s.copyIfView();
|
||||
y_s = y_s.copyIfView();
|
||||
a = a.copyIfView();
|
||||
for (int i = 0; i < rowNum - 1; i++) {
|
||||
for (int j = 0; j < colNum - 1; j++) {
|
||||
v = a.getDouble(i * colNum + j);
|
||||
if (Double.isNaN(v)) {
|
||||
continue;
|
||||
}
|
||||
x1 = x_s.getDouble(i * colNum + j);
|
||||
x2 = x_s.getDouble(i * colNum + j + 1);
|
||||
x3 = x_s.getDouble((i + 1) * colNum + j);
|
||||
@ -6227,7 +6228,6 @@ public class GraphicFactory {
|
||||
points.add(new PointD(x2, y_s.getDouble(i * colNum + j + 1)));
|
||||
points.add((PointD) points.get(0).clone());
|
||||
ps.setPoints(points);
|
||||
v = a.getDouble(i * colNum + j);
|
||||
pb = (PolygonBreak) ls.findLegendBreak(v);
|
||||
Graphic graphic = new Graphic(ps, pb);
|
||||
gc.add(graphic);
|
||||
|
||||
@ -67,7 +67,7 @@ import java.util.zip.ZipInputStream;
|
||||
public static String getVersion() {
|
||||
String version = GlobalUtil.class.getPackage().getImplementationVersion();
|
||||
if (version == null || version.equals("")) {
|
||||
version = "3.9";
|
||||
version = "3.9.1";
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ import ucar.nc2.NetcdfFile;
|
||||
import ucar.nc2.NetcdfFileWriter;
|
||||
import ucar.nc2.NetcdfFiles;
|
||||
import ucar.nc2.dataset.NetcdfDataset;
|
||||
import ucar.nc2.dataset.NetcdfDatasets;
|
||||
import ucar.nc2.iosp.hdf5.H5header;
|
||||
import ucar.unidata.io.RandomAccessFile;
|
||||
|
||||
@ -395,8 +396,9 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
public void readDataInfo(String fileName, boolean keepOpen) {
|
||||
try {
|
||||
this.setFileName(fileName);
|
||||
//ncDataset = NetcdfDatasets.openDataset(fileName);
|
||||
ncfile = NetcdfDataset.openFile(fileName, null);
|
||||
ncfile = NetcdfDatasets.openFile(fileName, null);
|
||||
//ncfile = NetcdfDataset.openFile(fileName, null);
|
||||
//ncfile = NetcdfFiles.open(fileName);
|
||||
readDataInfo(keepOpen);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(NetCDFDataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\traj">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\eof"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\calc"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\subplot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\scatter"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\projection"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\map\projection">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\contour"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\maskout"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\hdf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\grib"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\netcdf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\grads"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\calc"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\radar"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\projection"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_cdata_3.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\array\astype_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj_bd.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_cma_base_colorbar.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\map\projection\aeqd_proj_2.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_cdata_3.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\array\astype_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj_bd.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_cma_base_colorbar.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\map\projection\aeqd_proj_2.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -153,7 +153,7 @@ class MILayer(object):
|
||||
:returns: (*PyTableData') Attribute table.
|
||||
"""
|
||||
r = self._layer.getAttributeTable().getTable()
|
||||
return np.datatable(r)
|
||||
return np.PyTableData(r)
|
||||
|
||||
def cellvalue(self, fieldname, shapeindex):
|
||||
"""
|
||||
|
||||
Binary file not shown.
@ -346,14 +346,14 @@ class NDArray(object):
|
||||
return other
|
||||
|
||||
def __abs__(self):
|
||||
return NDArray(ArrayMath.abs(self._array))
|
||||
return self.array_wrap(ArrayMath.abs(self._array))
|
||||
|
||||
def __add__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.add(self._array, other)
|
||||
if r is None:
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __radd__(self, other):
|
||||
return NDArray.__add__(self, other)
|
||||
@ -362,22 +362,22 @@ class NDArray(object):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.sub(self._array, other)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __rsub__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.sub(other, self._array)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __mul__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.mul(self._array, other)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __rmul__(self, other):
|
||||
return NDArray.__mul__(self, other)
|
||||
@ -386,43 +386,43 @@ class NDArray(object):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.div(self._array, other)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __rdiv__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.div(other, self._array)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __floordiv__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.floorDiv(self._array, other)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __rfloordiv__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.floorDiv(other, self._array)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __mod__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.mod(self._array, other)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __rmod__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.mod(other, self._array)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __divmod__(self, other):
|
||||
return self.__floordiv__(other), self.__mod__(other)
|
||||
@ -434,80 +434,67 @@ class NDArray(object):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.pow(self._array, other)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __rpow__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = ArrayMath.pow(other, self._array)
|
||||
if r is None:
|
||||
raise ValueError('Dimension missmatch, can not broadcast!')
|
||||
return NDArray(r)
|
||||
raise ValueError('Dimension mismatch, can not broadcast!')
|
||||
return self.array_wrap(r)
|
||||
|
||||
def __neg__(self):
|
||||
r = NDArray(ArrayMath.sub(0, self._array))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.sub(0, self._array))
|
||||
|
||||
def __lt__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.lessThan(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.lessThan(self._array, other))
|
||||
|
||||
def __le__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.lessThanOrEqual(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.lessThanOrEqual(self._array, other))
|
||||
|
||||
def __eq__(self, other):
|
||||
if other is Ellipsis:
|
||||
return False
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.equal(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.equal(self._array, other))
|
||||
|
||||
def __ne__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.notEqual(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.notEqual(self._array, other))
|
||||
|
||||
def __gt__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.greaterThan(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.greaterThan(self._array, other))
|
||||
|
||||
def __ge__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.greaterThanOrEqual(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.greaterThanOrEqual(self._array, other))
|
||||
|
||||
def __and__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.bitAnd(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.bitAnd(self._array, other))
|
||||
|
||||
def __or__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.bitOr(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.bitOr(self._array, other))
|
||||
|
||||
def __xor__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.bitXor(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.bitXor(self._array, other))
|
||||
|
||||
def __invert__(self):
|
||||
r = NDArray(ArrayMath.bitInvert(self._array))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.bitInvert(self._array))
|
||||
|
||||
def __lshift__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.leftShift(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.leftShift(self._array, other))
|
||||
|
||||
def __rshift__(self, other):
|
||||
other = NDArray.__value_other(self, other)
|
||||
r = NDArray(ArrayMath.rightShift(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.rightShift(self._array, other))
|
||||
|
||||
def __iter__(self):
|
||||
"""
|
||||
@ -554,7 +541,7 @@ class NDArray(object):
|
||||
"""
|
||||
Copy array values to a new array.
|
||||
"""
|
||||
return NDArray(self._array.copy())
|
||||
return self.array_wrap(self._array.copy())
|
||||
|
||||
def view(self):
|
||||
"""
|
||||
@ -562,7 +549,7 @@ class NDArray(object):
|
||||
|
||||
:return: New view of array with the same data.
|
||||
"""
|
||||
return NDArray(ArrayUtil.view(self._array))
|
||||
return self.array_wrap(ArrayUtil.view(self._array))
|
||||
|
||||
def _ufunc_finalize(self, obj, axis=None):
|
||||
"""
|
||||
@ -640,8 +627,7 @@ class NDArray(object):
|
||||
"""
|
||||
if not isinstance(other, (list, tuple)):
|
||||
other = other.aslist()
|
||||
r = NDArray(ArrayMath.inValues(self._array, other))
|
||||
return r
|
||||
return self.array_wrap(ArrayMath.inValues(self._array, other))
|
||||
|
||||
def squeeze(self):
|
||||
"""
|
||||
@ -650,7 +636,7 @@ class NDArray(object):
|
||||
:returns: (*array_like*) The self array, but with all or a subset of the dimensions of length 1
|
||||
removed.
|
||||
"""
|
||||
return NDArray(self._array.reduce())
|
||||
return self.array_wrap(self._array.reduce())
|
||||
|
||||
def all(self, axis=None):
|
||||
"""
|
||||
@ -668,7 +654,7 @@ class NDArray(object):
|
||||
else:
|
||||
if axis < 0:
|
||||
axis += self.ndim
|
||||
return NDArray(ArrayMath.all(self._array, axis))
|
||||
return self.array_wrap(ArrayMath.all(self._array, axis), axis=axis)
|
||||
|
||||
def any(self, axis=None):
|
||||
"""
|
||||
@ -685,7 +671,7 @@ class NDArray(object):
|
||||
else:
|
||||
if axis < 0:
|
||||
axis += self.ndim
|
||||
return NDArray(ArrayMath.any(self._array, axis))
|
||||
return self.array_wrap(ArrayMath.any(self._array, axis), axis=axis)
|
||||
|
||||
def contains_nan(self):
|
||||
"""
|
||||
@ -717,19 +703,7 @@ class NDArray(object):
|
||||
if self.dtype == dtype:
|
||||
return self.copy()
|
||||
|
||||
# if dtype.kind == 'i':
|
||||
# r = NDArray(ArrayUtil.toInteger(self._array))
|
||||
# elif dtype.kind == 'f':
|
||||
# if dtype.name == 'float':
|
||||
# r = NDArray(ArrayUtil.toFloat(self._array))
|
||||
# else:
|
||||
# r = NDArray(ArrayUtil.toDouble(self._array))
|
||||
# elif dtype.kind == 'b':
|
||||
# r = NDArray(ArrayUtil.toBoolean(self._array))
|
||||
# else:
|
||||
# r = self
|
||||
r = NDArray(ArrayUtil.convertToDataType(self._array, dtype._dtype))
|
||||
return r
|
||||
return self.array_wrap(ArrayUtil.convertToDataType(self._array, dtype._dtype))
|
||||
|
||||
@property
|
||||
def real(self):
|
||||
@ -739,7 +713,7 @@ class NDArray(object):
|
||||
:return: (*array*) The real component of the complex argument.
|
||||
"""
|
||||
if self.dtype == _dtype.complex:
|
||||
return NDArray(ArrayMath.getReal(self._array))
|
||||
return self.array_wrap(ArrayMath.getReal(self._array))
|
||||
else:
|
||||
return self
|
||||
|
||||
@ -767,7 +741,7 @@ class NDArray(object):
|
||||
:return: (*array*) The image component of the complex argument.
|
||||
"""
|
||||
if self.dtype == _dtype.complex:
|
||||
return NDArray(ArrayMath.getImage(self._array))
|
||||
return self.array_wrap(ArrayMath.getImage(self._array))
|
||||
else:
|
||||
return self
|
||||
|
||||
@ -795,7 +769,7 @@ class NDArray(object):
|
||||
|
||||
:return: (*array*) Complex conjugate array.
|
||||
"""
|
||||
return NDArray(ArrayMath.conj(self._array))
|
||||
return self.array_wrap(ArrayMath.conj(self._array))
|
||||
|
||||
def min(self, axis=None):
|
||||
"""
|
||||
@ -819,7 +793,7 @@ class NDArray(object):
|
||||
return r
|
||||
else:
|
||||
r = ArrayMath.min(self._array, axis)
|
||||
return NDArray(r)
|
||||
return self.array_wrap(r, axis=axis)
|
||||
|
||||
def argmin(self, axis=None):
|
||||
"""
|
||||
@ -836,7 +810,7 @@ class NDArray(object):
|
||||
return r
|
||||
else:
|
||||
r = ArrayMath.argMin(self._array, axis)
|
||||
return NDArray(r)
|
||||
return self.array_wrap(r, axis=axis)
|
||||
|
||||
def argmax(self, axis=None):
|
||||
"""
|
||||
@ -853,7 +827,7 @@ class NDArray(object):
|
||||
return r
|
||||
else:
|
||||
r = ArrayMath.argMax(self._array, axis)
|
||||
return NDArray(r)
|
||||
return self.array_wrap(r, axis=axis)
|
||||
|
||||
def sort(self, axis=-1):
|
||||
"""
|
||||
@ -885,7 +859,7 @@ class NDArray(object):
|
||||
return r
|
||||
else:
|
||||
r = ArrayMath.max(self._array, axis)
|
||||
return NDArray(r)
|
||||
return self.array_wrap(r, axis=axis)
|
||||
|
||||
def sum(self, axis=None):
|
||||
"""
|
||||
@ -918,7 +892,7 @@ class NDArray(object):
|
||||
if axis < 0:
|
||||
axis = self.ndim + axis
|
||||
r = ArrayMath.sum(self._array, axis)
|
||||
return NDArray(r)
|
||||
return self.array_wrap(r, axis=axis)
|
||||
|
||||
def cumsum(self, axis=None):
|
||||
"""
|
||||
@ -951,7 +925,7 @@ class NDArray(object):
|
||||
: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 NDArray(ArrayMath.abs(self._array))
|
||||
return self.array_wrap(ArrayMath.abs(self._array))
|
||||
|
||||
def ceil(self):
|
||||
"""
|
||||
@ -959,7 +933,7 @@ class NDArray(object):
|
||||
|
||||
:return: The ceiling of each element.
|
||||
"""
|
||||
return NDArray(ArrayMath.ceil(self._array))
|
||||
return self.array_wrap(ArrayMath.ceil(self._array))
|
||||
|
||||
def floor(self):
|
||||
"""
|
||||
@ -967,7 +941,7 @@ class NDArray(object):
|
||||
|
||||
:return: The floor of each element.
|
||||
"""
|
||||
return NDArray(ArrayMath.floor(self._array))
|
||||
return self.array_wrap(ArrayMath.floor(self._array))
|
||||
|
||||
def round(self, decimals=0):
|
||||
"""
|
||||
@ -981,7 +955,7 @@ class NDArray(object):
|
||||
r = ArrayMath.round(self._array)
|
||||
else:
|
||||
r = ArrayMath.round(self._array, decimals)
|
||||
return NDArray(r)
|
||||
return self.array_wrap(r)
|
||||
|
||||
def clip(self, min=None, max=None):
|
||||
"""
|
||||
@ -1068,7 +1042,7 @@ class NDArray(object):
|
||||
if self.ndim == 1 or axis is None:
|
||||
return ArrayMath.median(self._array)
|
||||
else:
|
||||
return NDArray(ArrayMath.median(self._array, axis))
|
||||
return self.array_wrap(ArrayMath.median(self._array, axis), axis=axis)
|
||||
|
||||
def std(self, axis=None, ddof=0):
|
||||
"""
|
||||
@ -1086,7 +1060,7 @@ class NDArray(object):
|
||||
return r
|
||||
else:
|
||||
r = ArrayMath.std(self._array, axis, ddof)
|
||||
return NDArray(r)
|
||||
return self.array_wrap(r, axis=axis)
|
||||
|
||||
def var(self, axis=None, ddof=0):
|
||||
"""
|
||||
@ -1095,7 +1069,7 @@ class NDArray(object):
|
||||
:param axis: (*int*) Axis along which the variance is computed.
|
||||
The default is to compute the variance of the flattened array.
|
||||
:param ddof: (*int*) Delta Degrees of Freedom: the divisor used in the calculation is
|
||||
N - ddof, where N represents the number of elements. By default ddof is zero.
|
||||
N - ddof, where N represents the number of elements. By default, ddof is zero.
|
||||
|
||||
returns: (*array_like*) Variance result.
|
||||
"""
|
||||
@ -1104,49 +1078,49 @@ class NDArray(object):
|
||||
return r
|
||||
else:
|
||||
r = ArrayMath.var(self._array, axis, ddof)
|
||||
return NDArray(r)
|
||||
return self.array_wrap(r, axis=axis)
|
||||
|
||||
def square(self):
|
||||
return self.__mul__(self)
|
||||
|
||||
def sqrt(self):
|
||||
return NDArray(ArrayMath.sqrt(self._array))
|
||||
return self.array_wrap(ArrayMath.sqrt(self._array))
|
||||
|
||||
def sin(self):
|
||||
return NDArray(ArrayMath.sin(self._array))
|
||||
return self.array_wrap(ArrayMath.sin(self._array))
|
||||
|
||||
def sinh(self):
|
||||
return NDArray(ArrayMath.sinh(self._array))
|
||||
return self.array_wrap(ArrayMath.sinh(self._array))
|
||||
|
||||
def cos(self):
|
||||
return NDArray(ArrayMath.cos(self._array))
|
||||
return self.array_wrap(ArrayMath.cos(self._array))
|
||||
|
||||
def cosh(self):
|
||||
return NDArray(ArrayMath.cosh(self._array))
|
||||
return self.array_wrap(ArrayMath.cosh(self._array))
|
||||
|
||||
def tan(self):
|
||||
return NDArray(ArrayMath.tan(self._array))
|
||||
return self.array_wrap(ArrayMath.tan(self._array))
|
||||
|
||||
def tanh(self):
|
||||
return NDArray(ArrayMath.tanh(self._array))
|
||||
return self.array_wrap(ArrayMath.tanh(self._array))
|
||||
|
||||
def asin(self):
|
||||
return NDArray(ArrayMath.asin(self._array))
|
||||
return self.array_wrap(ArrayMath.asin(self._array))
|
||||
|
||||
def acos(self):
|
||||
return NDArray(ArrayMath.acos(self._array))
|
||||
return self.array_wrap(ArrayMath.acos(self._array))
|
||||
|
||||
def atan(self):
|
||||
return NDArray(ArrayMath.atan(self._array))
|
||||
return self.array_wrap(ArrayMath.atan(self._array))
|
||||
|
||||
def exp(self):
|
||||
return NDArray(ArrayMath.exp(self._array))
|
||||
return self.array_wrap(ArrayMath.exp(self._array))
|
||||
|
||||
def log(self):
|
||||
return NDArray(ArrayMath.log(self._array))
|
||||
return self.array_wrap(ArrayMath.log(self._array))
|
||||
|
||||
def log10(self):
|
||||
return NDArray(ArrayMath.log10(self._array))
|
||||
return self.array_wrap(ArrayMath.log10(self._array))
|
||||
|
||||
def sign(self):
|
||||
"""
|
||||
@ -1154,7 +1128,7 @@ class NDArray(object):
|
||||
|
||||
The sign function returns -1 if x < 0, 0 if x==0, 1 if x > 0. nan is returned for nan inputs.
|
||||
"""
|
||||
return NDArray(ArrayMath.sign(self._array))
|
||||
return self.array_wrap(ArrayMath.sign(self._array))
|
||||
|
||||
def dot(self, other):
|
||||
"""
|
||||
|
||||
Binary file not shown.
@ -311,120 +311,6 @@ class DimArray(NDArray):
|
||||
if onlyrange:
|
||||
data.base = self.get_base()
|
||||
return data
|
||||
|
||||
def __add__(self, other):
|
||||
r = super(DimArray, self).__add__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __radd__(self, other):
|
||||
return DimArray.__add__(self, other)
|
||||
|
||||
def __sub__(self, other):
|
||||
r = super(DimArray, self).__sub__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __rsub__(self, other):
|
||||
r = super(DimArray, self).__rsub__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __mul__(self, other):
|
||||
r = super(DimArray, self).__mul__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __rmul__(self, other):
|
||||
return DimArray.__mul__(self, other)
|
||||
|
||||
def __div__(self, other):
|
||||
r = super(DimArray, self).__div__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __rdiv__(self, other):
|
||||
r = super(DimArray, self).__rdiv__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __floordiv__(self, other):
|
||||
r = super(DimArray, self).__floordiv__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __rfloordiv__(self, other):
|
||||
r = super(DimArray, self).__rfloordiv__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __mod__(self, other):
|
||||
r = super(DimArray, self).__mod__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __rmod__(self, other):
|
||||
r = super(DimArray, self).__rmod__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __divmod__(self, other):
|
||||
r = super(DimArray, self).__divmod__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __rdivmod__(self, other):
|
||||
r = super(DimArray, self).__rdivmod__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __pow__(self, other):
|
||||
r = super(DimArray, self).__pow__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __rpow__(self, other):
|
||||
r = super(DimArray, self).__rpow__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __neg__(self):
|
||||
r = super(DimArray, self).__neg__()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __lt__(self, other):
|
||||
r = super(DimArray, self).__lt__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __le__(self, other):
|
||||
r = super(DimArray, self).__le__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __eq__(self, other):
|
||||
r = super(DimArray, self).__eq__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __ne__(self, other):
|
||||
r = super(DimArray, self).__ne__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __gt__(self, other):
|
||||
r = super(DimArray, self).__gt__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __ge__(self, other):
|
||||
r = super(DimArray, self).__ge__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __and__(self, other):
|
||||
r = super(DimArray, self).__and__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __or__(self, other):
|
||||
r = super(DimArray, self).__or__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __xor__(self, other):
|
||||
r = super(DimArray, self).__xor__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __invert__(self, other):
|
||||
r = super(DimArray, self).__invert__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __lshift__(self, other):
|
||||
r = super(DimArray, self).__lshift__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def __rshift__(self, other):
|
||||
r = super(DimArray, self).__rshift__(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
@property
|
||||
def array(self):
|
||||
@ -449,7 +335,7 @@ class DimArray(NDArray):
|
||||
:returns: (*list*) Member names
|
||||
"""
|
||||
if self._array.getDataType() != DataType.STRUCTURE:
|
||||
print 'This method is only valid for structure array!'
|
||||
print('This method is only valid for structure array!')
|
||||
return None
|
||||
|
||||
ms = self._array.getStructureMemberNames()
|
||||
@ -465,7 +351,7 @@ class DimArray(NDArray):
|
||||
:returns: (*array*) Extracted member array.
|
||||
"""
|
||||
if self._array.getDataType() != DataType.STRUCTURE:
|
||||
print 'This method is only valid for structure array!'
|
||||
print('This method is only valid for structure array!')
|
||||
return None
|
||||
|
||||
a = self._array.getArrayObject()
|
||||
@ -480,29 +366,6 @@ class DimArray(NDArray):
|
||||
|
||||
return r
|
||||
|
||||
def in_values(self, other):
|
||||
"""
|
||||
The returned array element set 1 when the input array element is in other, otherwise the
|
||||
element set 0.
|
||||
|
||||
:param other: (*array_like*) The array or list value.
|
||||
|
||||
:returns: (*array*) The array with element value of 1 or 0.
|
||||
"""
|
||||
r = super(DimArray, self).in_values(other)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def astype(self, dtype):
|
||||
"""
|
||||
Convert to another data type.
|
||||
|
||||
:param dtype: (*string*) Data type.
|
||||
|
||||
:returns: (*array*) Converted array.
|
||||
"""
|
||||
r = super(DimArray, self).astype(dtype)
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def value(self, indices):
|
||||
#print type(indices)
|
||||
if not isinstance(indices, tuple):
|
||||
@ -511,7 +374,7 @@ class DimArray(NDArray):
|
||||
indices = inds
|
||||
|
||||
if len(indices) != self.ndim:
|
||||
print 'indices must be ' + str(self.ndim) + ' dimensions!'
|
||||
print('indices must be ' + str(self.ndim) + ' dimensions!')
|
||||
return None
|
||||
|
||||
#origin = []
|
||||
@ -543,7 +406,7 @@ class DimArray(NDArray):
|
||||
else:
|
||||
step = int(k[2] / dim.getDeltaValue)
|
||||
else:
|
||||
print k
|
||||
print(k)
|
||||
return None
|
||||
|
||||
if step < 0:
|
||||
@ -568,12 +431,6 @@ class DimArray(NDArray):
|
||||
array = NDArray(rr)
|
||||
data = DimArray(array, dims, self.proj)
|
||||
return data
|
||||
|
||||
def copy(self):
|
||||
"""
|
||||
Copy array vlaues to a new array.
|
||||
"""
|
||||
return DimArray(self._array.copy(), self.dims, self.proj)
|
||||
|
||||
def _ufunc_finalize(self, obj, axis=None):
|
||||
"""
|
||||
@ -611,8 +468,12 @@ class DimArray(NDArray):
|
||||
else:
|
||||
dims = []
|
||||
for i in range(0, self.ndim):
|
||||
if i != axis:
|
||||
dims.append(self.dims[i])
|
||||
if isinstance(axis, (list, tuple)):
|
||||
if not i in axis:
|
||||
dims.append(self.dims[i])
|
||||
else:
|
||||
if i != axis:
|
||||
dims.append(self.dims[i])
|
||||
return DimArray(arr, dims, self.proj)
|
||||
else:
|
||||
return arr
|
||||
@ -858,72 +719,7 @@ class DimArray(NDArray):
|
||||
if dim.getLength() > 1:
|
||||
dims.append(dim)
|
||||
return DimArray(r, dims, self.proj)
|
||||
|
||||
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
|
||||
"""
|
||||
r = super(DimArray, self).sum(axis)
|
||||
if axis is None:
|
||||
return r
|
||||
else:
|
||||
dims = []
|
||||
for i in range(0, self.ndim):
|
||||
if i != axis:
|
||||
dims.append(self.dims[i])
|
||||
return DimArray(r, dims, self.proj)
|
||||
|
||||
def max(self, axis=None):
|
||||
"""
|
||||
Compute tha arithmetic maximum along the specified axis.
|
||||
|
||||
:param axis: (*int*) Axis along which the value is computed.
|
||||
The default is to compute the value of the flattened array.
|
||||
|
||||
returns: (*array_like*) Maximum result
|
||||
"""
|
||||
r = super(DimArray, self).max(axis)
|
||||
if isinstance(r, numbers.Number):
|
||||
return r
|
||||
else:
|
||||
dims = []
|
||||
for i in range(0, self.ndim):
|
||||
if isinstance(axis, (list, tuple)):
|
||||
if not i in axis:
|
||||
dims.append(self.dims[i])
|
||||
else:
|
||||
if i != axis:
|
||||
dims.append(self.dims[i])
|
||||
return DimArray(r, dims, self.proj)
|
||||
|
||||
def min(self, axis=None):
|
||||
"""
|
||||
Compute tha arithmetic minimum along the specified axis.
|
||||
|
||||
:param axis: (*int*) Axis along which the value is computed.
|
||||
The default is to compute the value of the flattened array.
|
||||
|
||||
returns: (*array_like*) Minimum result
|
||||
"""
|
||||
r = super(DimArray, self).min(axis)
|
||||
if isinstance(r, numbers.Number):
|
||||
return r
|
||||
else:
|
||||
dims = []
|
||||
for i in range(0, self.ndim):
|
||||
if isinstance(axis, (list, tuple)):
|
||||
if not i in axis:
|
||||
dims.append(self.dims[i])
|
||||
else:
|
||||
if i != axis:
|
||||
dims.append(self.dims[i])
|
||||
return DimArray(r, dims, self.proj)
|
||||
|
||||
def mean(self, axis=None, keepdims=False):
|
||||
"""
|
||||
Compute tha arithmetic mean along the specified axis.
|
||||
@ -948,177 +744,6 @@ class DimArray(NDArray):
|
||||
if i != axis:
|
||||
dims.append(self.dims[i])
|
||||
return DimArray(r, dims, self.proj)
|
||||
|
||||
def median(self, axis=None):
|
||||
"""
|
||||
Compute tha median along the specified axis.
|
||||
|
||||
:param axis: (*int*) Axis along which the value is computed.
|
||||
The default is to compute the value of the flattened array.
|
||||
|
||||
returns: (*array_like*) Median result
|
||||
"""
|
||||
r = super(DimArray, self).median(axis)
|
||||
if isinstance(r, numbers.Number):
|
||||
return r
|
||||
else:
|
||||
dims = []
|
||||
for i in range(0, self.ndim):
|
||||
if i != axis:
|
||||
dims.append(self.dims[i])
|
||||
return DimArray(r, dims, self.proj)
|
||||
|
||||
def std(self, axis=None, ddof=0):
|
||||
"""
|
||||
Compute the standard deviation 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.
|
||||
:param ddof: (*int*) Delta Degrees of Freedom: the divisor used in the calculation is
|
||||
N - ddof, where N represents the number of elements. By default ddof is zero.
|
||||
|
||||
returns: (*array_like*) Standart deviation result.
|
||||
"""
|
||||
r = super(DimArray, self).std(axis, ddof)
|
||||
if isinstance(r, numbers.Number):
|
||||
return r
|
||||
else:
|
||||
dims = []
|
||||
for i in range(0, self.ndim):
|
||||
if i != axis:
|
||||
dims.append(self.dims[i])
|
||||
return DimArray(r, dims, self.proj)
|
||||
|
||||
def var(self, axis=None, ddof=0):
|
||||
"""
|
||||
Compute the variance 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.
|
||||
:param ddof: (*int*) Delta Degrees of Freedom: the divisor used in the calculation is
|
||||
N - ddof, where N represents the number of elements. By default ddof is zero.
|
||||
|
||||
returns: (*array_like*) Variance result.
|
||||
"""
|
||||
r = super(DimArray, self).std(axis, ddof)
|
||||
if isinstance(r, numbers.Number):
|
||||
return r
|
||||
else:
|
||||
dims = []
|
||||
for i in range(0, self.ndim):
|
||||
if i != axis:
|
||||
dims.append(self.dims[i])
|
||||
return DimArray(r, dims, self.proj)
|
||||
|
||||
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 }.
|
||||
"""
|
||||
r = super(DimArray, self).abs()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def ceil(self):
|
||||
"""
|
||||
Return the ceiling of the input, element-wise.
|
||||
|
||||
:return: The ceiling of each element.
|
||||
"""
|
||||
r = super(DimArray, self).ceil()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def floor(self):
|
||||
"""
|
||||
Return the floor of the input, element-wise.
|
||||
|
||||
:return: The floor of each element.
|
||||
"""
|
||||
r = super(DimArray, self).floor()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def sqrt(self):
|
||||
"""
|
||||
Calculate sqrt value.
|
||||
|
||||
:returns: (*DimArray*) Sqrt value array.
|
||||
"""
|
||||
r = super(DimArray, self).sqrt()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def sin(self):
|
||||
"""
|
||||
Calculate sin value.
|
||||
|
||||
:returns: (*DimArray*) Sin value array.
|
||||
"""
|
||||
r = super(DimArray, self).sin()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def sinh(self):
|
||||
"""
|
||||
Calculate hyperbolic sin value.
|
||||
|
||||
:returns: (*DimArray*) Hyperbolic sin value array.
|
||||
"""
|
||||
r = super(DimArray, self).sinh()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def cos(self):
|
||||
r = super(DimArray, self).cos()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def cosh(self):
|
||||
"""
|
||||
Calculate hyperbolic cos value.
|
||||
|
||||
:returns: (*DimArray*) Hyperbolic cos value array.
|
||||
"""
|
||||
r = super(DimArray, self).cosh()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def tan(self):
|
||||
r = super(DimArray, self).tan()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def tanh(self):
|
||||
"""
|
||||
Calculate hyperbolic tan value.
|
||||
|
||||
:returns: (*DimArray*) Hyperbolic tan value array.
|
||||
"""
|
||||
r = super(DimArray, self).tanh()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def asin(self):
|
||||
r = super(DimArray, self).asin()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def acos(self):
|
||||
"""
|
||||
Calculate acos value.
|
||||
|
||||
:returns: (*DimArray*) Acos value array.
|
||||
"""
|
||||
r = super(DimArray, self).acos()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def atan(self):
|
||||
r = super(DimArray, self).atan()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def exp(self):
|
||||
r = super(DimArray, self).exp()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def log(self):
|
||||
r = super(DimArray, self).log()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def log10(self):
|
||||
r = super(DimArray, self).log10()
|
||||
return DimArray(r, self.dims, self.proj)
|
||||
|
||||
def rot90(self, k=1):
|
||||
"""
|
||||
@ -1466,7 +1091,7 @@ class DimArray(NDArray):
|
||||
:param float_format: (*string*) Float number format, such as '%.2f'.
|
||||
"""
|
||||
if self.ndim != 2:
|
||||
print 'The array must be 2 dimensional!'
|
||||
print('The array must be 2 dimensional!')
|
||||
return
|
||||
|
||||
gdata = self.asgridarray()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -24,7 +24,6 @@ from org.meteoinfo.math.linalg import LinalgUtil
|
||||
from org.python.core import PyComplex
|
||||
|
||||
import _dtype
|
||||
from dimarray import DimArray
|
||||
from ._ndarray import NDArray
|
||||
from org.meteoinfo.console.jython import JythonUtil
|
||||
|
||||
@ -41,7 +40,7 @@ __all__ = [
|
||||
'arcsin','asin','asmiarray','atleast_1d','atleast_2d','arctan','atan',
|
||||
'arctan2','atan2','average','histogram','broadcast_to','cdiff','ceil',
|
||||
'concatenate','conj','conjugate','convolve','corrcoef','cos','cosh','cylinder','degrees','delnan','diag','diff',
|
||||
'datatable','dot','empty','empty_like','exp','eye','flatnonzero','floor',
|
||||
'dot','empty','empty_like','exp','eye','flatnonzero','floor',
|
||||
'fmax','fmin','full','hcurl','hdivg','hstack','hypot','identity','indices','interp2d','interpn','isarray',
|
||||
'isclose','isfinite','isinf','isnan','isscalar','linspace','log','log10','logical_not','logspace',
|
||||
'magic','magnitude','max','maximum','mean','median','meshgrid','min','minimum','monthname',
|
||||
|
||||
Binary file not shown.
@ -464,7 +464,7 @@ class MapAxes(Axes):
|
||||
Axes.set_xticks(self, locs)
|
||||
else:
|
||||
gridline = self._axes.getGridLine()
|
||||
if isinstance(locs, (NDArray, DimArray)):
|
||||
if isinstance(locs, NDArray):
|
||||
locs = locs.aslist()
|
||||
gridline.setLongitudeLocations(locs)
|
||||
|
||||
@ -476,7 +476,7 @@ class MapAxes(Axes):
|
||||
Axes.set_yticks(self, locs)
|
||||
else:
|
||||
gridline = self._axes.getGridLine()
|
||||
if isinstance(locs, (NDArray, DimArray)):
|
||||
if isinstance(locs, NDArray):
|
||||
locs = locs.aslist()
|
||||
gridline.setLatitudeLocations(locs)
|
||||
|
||||
|
||||
Binary file not shown.
@ -21,7 +21,7 @@ import os
|
||||
import functools
|
||||
import mipylib.migl as migl
|
||||
import mipylib.miutil as miutil
|
||||
from mipylib.numeric.core import NDArray, DimArray
|
||||
from mipylib.numeric.core import NDArray
|
||||
import plotutil
|
||||
from ._axes import Axes, PolarAxes
|
||||
from ._axes3d import Axes3D
|
||||
@ -1325,7 +1325,7 @@ def xticks(*args, **kwargs):
|
||||
args = args[1:]
|
||||
if len(args) > 0:
|
||||
labels = args[0]
|
||||
if isinstance(labels, (NDArray, DimArray)):
|
||||
if isinstance(labels, NDArray):
|
||||
labels = labels.aslist()
|
||||
else:
|
||||
labels = None
|
||||
@ -1349,7 +1349,7 @@ def yticks(*args, **kwargs):
|
||||
if len(args) > 0:
|
||||
locs = args[0]
|
||||
if len(locs) > 0:
|
||||
if isinstance(locs, (NDArray, DimArray)):
|
||||
if isinstance(locs, NDArray):
|
||||
locs = locs.aslist()
|
||||
if isinstance(locs[0], datetime.datetime):
|
||||
for i in range(len(locs)):
|
||||
@ -1358,7 +1358,7 @@ def yticks(*args, **kwargs):
|
||||
args = args[1:]
|
||||
if len(args) > 0:
|
||||
labels = args[0]
|
||||
if isinstance(labels, (NDArray, DimArray)):
|
||||
if isinstance(labels, NDArray):
|
||||
labels = labels.aslist()
|
||||
else:
|
||||
labels = None
|
||||
@ -1385,7 +1385,7 @@ def zticks(*args, **kwargs):
|
||||
if len(args) > 0:
|
||||
locs = args[0]
|
||||
if len(locs) > 0:
|
||||
if isinstance(locs, (NDArray, DimArray)):
|
||||
if isinstance(locs, NDArray):
|
||||
locs = locs.aslist()
|
||||
if isinstance(locs[0], datetime.datetime):
|
||||
for i in range(len(locs)):
|
||||
@ -1394,7 +1394,7 @@ def zticks(*args, **kwargs):
|
||||
args = args[1:]
|
||||
if len(args) > 0:
|
||||
labels = args[0]
|
||||
if isinstance(labels, (NDArray, DimArray)):
|
||||
if isinstance(labels, NDArray):
|
||||
labels = labels.aslist()
|
||||
else:
|
||||
labels = None
|
||||
|
||||
Binary file not shown.
@ -19,7 +19,7 @@ from org.meteoinfo.chart import ChartText
|
||||
|
||||
from java.awt import Color, Font
|
||||
|
||||
from mipylib.numeric.core import NDArray, DimArray
|
||||
from mipylib.numeric.core import NDArray
|
||||
import mipylib.numeric as np
|
||||
import mipylib.miutil as miutil
|
||||
import mipylib.migl as migl
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -35,7 +35,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<revision>3.9</revision>
|
||||
<revision>3.9.1</revision>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user