ucar.ma2.Array.copyToNDJavaArray()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中ucar.ma2.Array.copyToNDJavaArray()方法的一些代码示例,展示了Array.copyToNDJavaArray()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array.copyToNDJavaArray()方法的具体详情如下:
包路径:ucar.ma2.Array
类名称:Array
方法名:copyToNDJavaArray

Array.copyToNDJavaArray介绍

[英]Copy this array to a n-Dimensional Java primitive array of type getElementType() and rank getRank(). Makes a copy of the data.
[中]将此数组复制到getElementType()和rank getRank()类型的n维Java基元数组中。制作数据的副本。

代码示例

代码示例来源:origin: Unidata/thredds

private void typeSpecifics(Object javaArray) {
 System.out.println("typeSpecifics: "+javaArray);
 Array aa;
 try {
  aa = Array.makeFromJavaArray(javaArray, false);
 } catch (Exception e) {
  System.out.println("TestJavaArray: "+e);
  assert(false);
  return;
 }
 Object newArray = aa.copyToNDJavaArray();
 testEquals( javaArray, newArray);
}

代码示例来源:origin: ome/formats-gpl

@Override
public Object getArray(String path, int[] origin, int[] shape)
 throws ServiceException
{
 String groupName = getDirectory(path);
 String variableName = getName(path);
 Group group = getGroup(groupName);
 Variable variable = group.findVariable(variableName);
 try {
  if (origin != null && shape != null) {
   return variable.read(origin, shape).reduce().copyToNDJavaArray();
  }
  return variable.read().copyToNDJavaArray();
 }
 catch (InvalidRangeException e) {
  throw new ServiceException(e);
 }
 catch (IOException e) {
  throw new ServiceException(e);
 }
 catch (NullPointerException e) {
  return null;
 }
}

代码示例来源:origin: openmicroscopy/bioformats

@Override
public Object getArray(String path, int[] origin, int[] shape)
 throws ServiceException
{
 String groupName = getDirectory(path);
 String variableName = getName(path);
 Group group = getGroup(groupName);
 Variable variable = group.findVariable(variableName);
 try {
  if (origin != null && shape != null) {
   return variable.read(origin, shape).reduce().copyToNDJavaArray();
  }
  return variable.read().copyToNDJavaArray();
 }
 catch (InvalidRangeException e) {
  throw new ServiceException(e);
 }
 catch (IOException e) {
  throw new ServiceException(e);
 }
 catch (NullPointerException e) {
  return null;
 }
}

代码示例来源:origin: Unidata/thredds

assert( aa.getDouble(ima.set(i,j,k)) == tData[i][j][k]);
double[][][] newArray = (double [][][]) aa.copyToNDJavaArray();
for (int i=0; i<shape[0]; i++)
 for (int j=0; j<shape[1]; j++)

代码示例来源:origin: Unidata/thredds

assert( newArray[2] == 3.0);
newArray = (double []) aa.copyToNDJavaArray();
assert( newArray[0] == 1.0);
assert( newArray[1] == 2.0);

代码示例来源:origin: Unidata/thredds

int[] actuals = (int[]) fooArray.copyToNDJavaArray();
Assert.assertArrayEquals(expecteds, actuals);

相关文章

微信公众号

最新文章

更多