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

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

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

Array.arraycopy介绍

[英]Cover for System.arraycopy(). Works with the underlying data arrays. ArraySrc and ArrayDst must be the same primitive type. Exposed for efficiency; use at your own risk.
[中]覆盖系统。arraycopy()。使用底层数据数组。ArraySrc和ArrayST必须是相同的基元类型。为效率而暴露;使用风险自负。

代码示例

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

/**
 * Create a new Array by copying this Array to a new one with given shape
 *
 * @param shape the new shape
 * @return the new Array
 * @throws IllegalArgumentException new shape is not conformable
 */
public Array reshape(int[] shape) {
 Array result = factory(this.getDataType(), shape);
 if (result.getSize() != getSize())
  throw new IllegalArgumentException("reshape arrays must have same total size");
 Array.arraycopy(this, 0, result, 0, (int) getSize());
 return result;
}

代码示例来源:origin: edu.ucar/netcdf

/**
 * Create a new Array by copying this Array to a new one with given shape
 *
 * @param shape the new shape
 * @return the new Array
 * @throws IllegalArgumentException new shape is not conformable
 */
public Array reshape(int[] shape) {
 Array result = factory(this.getElementType(), shape);
 if (result.getSize() != getSize())
  throw new IllegalArgumentException("reshape arrays must have same total size");
 result.setUnsigned( isUnsigned());
 Array.arraycopy(this, 0, result, 0, (int) getSize());
 return result;
}

代码示例来源:origin: edu.ucar/cdm

/**
 * Create a new Array by copying this Array to a new one with given shape
 *
 * @param shape the new shape
 * @return the new Array
 * @throws IllegalArgumentException new shape is not conformable
 */
public Array reshape(int[] shape) {
 Array result = factory(this.getElementType(), shape);
 if (result.getSize() != getSize())
  throw new IllegalArgumentException("reshape arrays must have same total size");
 result.setUnsigned(isUnsigned());
 Array.arraycopy(this, 0, result, 0, (int) getSize());
 return result;
}

代码示例来源:origin: edu.ucar/netcdf

Array.arraycopy(varData, 0, sectionData, destPos, (int) varData.getSize());
destPos += varData.getSize();

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

runIdx, timeIdx, mainv.getFullName(), result.getSize(), destPos, allData.getSize());
Array.arraycopy(result, 0, allData, destPos, (int) result.getSize());
destPos += result.getSize();

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

@Override
protected Array read(DatasetOuterDimension dset, NetcdfFile ncfile) throws IOException {
 Array data = getData(dset.getId());
 if (data != null) return data;
 Attribute att = ncfile.findGlobalAttribute(gattName);
 if (att == null)
  throw new IllegalArgumentException("Unknown attribute name= " + gattName);
 data = att.getValues();
 if (dtype == null)
  dtype = DataType.getType(data);
 if (dset.ncoord == 1) // LOOK ??
  putData(dset.getId(), data);
 else {
  // duplicate the value to each of the coordinates
  Array allData = Array.factory(dtype, new int[]{dset.ncoord});
  for (int i = 0; i < dset.ncoord; i++)
   Array.arraycopy(data, 0, allData, i, 1); // LOOK generalize to vectors ??
  putData(dset.getId(), allData);
  data = allData;
 }
 return data;
}

代码示例来源:origin: edu.ucar/netcdf

public Array reallyRead(CancelTask cancelTask) throws IOException {
 Variable orgVar = ncd_2dtime.findVariable(mainv.getFullNameEscaped());
 int[] orgVarShape = orgVar.getShape();
 // calculate shape - wants it "all"  (we dont seem to have access to the derived variable, so must construct)
 int rank = orgVar.getRank()-1;
 int[] varShape = new int[rank];
 varShape[0] = invList.size();
 System.arraycopy(orgVarShape, 2, varShape, 1, rank - 1);
 Array allData = Array.factory(mainv.getDataType(), varShape);
 int destPos = 0;
 Section section = new Section(orgVar.getRanges());
 // loop over inventory
 for (Inventory inv : invList) {
  Array varData;
  try {
   section.setRange(0, new Range(inv.run, inv.run));
   section.setRange(1, new Range(inv.time, inv.time));
   varData = orgVar.read(section);
  } catch (InvalidRangeException e) {
   logger.error("read failed", e);
   throw new IllegalStateException(e.getMessage());
  }
  Array.arraycopy(varData, 0, allData, destPos, (int) varData.getSize());
  destPos += varData.getSize();
  if ((cancelTask != null) && cancelTask.isCancel())
   return null;
 }
 return allData;
}

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

System.out.printf("%d reallyRead %s %d bytes start at %d total size is %d%n", timeIdx, mainv.getFullName(), result.getSize(), destPos, allData.getSize());
Array.arraycopy(result, 0, allData, destPos, (int) result.getSize());
destPos += result.getSize();

代码示例来源:origin: edu.ucar/netcdf

@Override
protected Array read(DatasetOuterDimension dset, NetcdfFile ncfile) throws IOException {
 Array data = getData(dset.getId());
 if (data != null) return data;
 Attribute att = ncfile.findGlobalAttribute(gattName);
 if (att == null)
  throw new IllegalArgumentException("Unknown attribute name= " + gattName);
 data = att.getValues();
 if (dtype == null)
  dtype = DataType.getType(data.getElementType());
 if (dset.ncoord == 1) // LOOK ??
  putData(dset.getId(), data);
 else {
  // duplicate the value to each of the coordinates
  Array allData = Array.factory(dtype, new int[]{dset.ncoord});
  for (int i = 0; i < dset.ncoord; i++)
   Array.arraycopy(data, 0, allData, i, 1); // LOOK generalize to vectors ??
  putData(dset.getId(), allData);
  data = allData;
 }
 return data;
}

代码示例来源:origin: edu.ucar/cdm

Array.arraycopy(varData, 0, allData, resultPos, nelems);
resultPos += nelems;

代码示例来源:origin: edu.ucar/cdm

@Override
protected Array read(DatasetOuterDimension dset, NetcdfFile ncfile) throws IOException {
 Array data = getData(dset.getId());
 if (data != null) return data;
 Attribute att = ncfile.findGlobalAttribute(gattName);
 if (att == null)
  throw new IllegalArgumentException("Unknown attribute name= " + gattName);
 data = att.getValues();
 if (dtype == null)
  dtype = DataType.getType(data.getElementType());
 if (dset.ncoord == 1) // LOOK ??
  putData(dset.getId(), data);
 else {
  // duplicate the value to each of the coordinates
  Array allData = Array.factory(dtype, new int[]{dset.ncoord});
  for (int i = 0; i < dset.ncoord; i++)
   Array.arraycopy(data, 0, allData, i, 1); // LOOK generalize to vectors ??
  putData(dset.getId(), allData);
  data = allData;
 }
 return data;
}

代码示例来源:origin: edu.ucar/netcdf

Array.arraycopy(varData, 0, allData, resultPos, nelems);
resultPos += nelems;

代码示例来源:origin: edu.ucar/cdm

Array.arraycopy(varData, index.srcPos, allData, index.resultPos, index.nelems);
} catch (RuntimeException e) {
 System.out.println(index.toString());

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

Array.arraycopy(varData, index.srcPos, allData, index.resultPos, index.nelems);
} catch (RuntimeException e) {
 System.out.println(index.toString());

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

Array.arraycopy(varData, index.srcPos, allData, index.resultPos, index.nelems);
} catch (RuntimeException e) {
 System.out.println(" tiledSection: " + tiledSection);

代码示例来源:origin: edu.ucar/netcdf

System.out.printf("%d reallyRead %s %d bytes start at %d total size is %d%n", timeIdx, mainv.getFullName(), result.getSize(), destPos, allData.getSize());
Array.arraycopy(result, 0, allData, destPos, (int) result.getSize());
destPos += result.getSize();

代码示例来源:origin: edu.ucar/netcdf

Array.arraycopy(varData, index.srcPos, allData, index.resultPos, index.nelems);
} catch (RuntimeException e) {
 System.out.println(index.toString());

代码示例来源:origin: edu.ucar/cdm

runIdx, timeIdx, mainv.getFullName(), result.getSize(), destPos, allData.getSize());
Array.arraycopy(result, 0, allData, destPos, (int) result.getSize());
destPos += result.getSize();

代码示例来源:origin: edu.ucar/cdm

Array.arraycopy(varData, index.srcPos, allData, index.resultPos, index.nelems);
} catch (RuntimeException e) {
 System.out.println(" tiledSection: " + tiledSection);

代码示例来源:origin: edu.ucar/netcdf

Array.arraycopy(varData, index.srcPos, allData, index.resultPos, index.nelems);
} catch (RuntimeException e) {
 System.out.println(" tiledSection: " + tiledSection);

相关文章

微信公众号

最新文章

更多