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

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

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

Array.copy介绍

[英]Create a copy of this Array, copying the data so that physical order is the same as logical order
[中]创建此阵列的副本,复制数据,以便物理顺序与逻辑顺序相同

代码示例

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

/**
 * Create a new MAVector that is the same as this one, with a copy of the backing store.
 */
public MAVector copy() {
 return new MAVector( a.copy());
}

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

/**
 * Create a new MAMatrix that is the same as this one, with a copy of the backing store.
 */
public MAMatrix copy() {
 return new MAMatrix( a.copy());
}

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

/**
 * Copy this array to a 1D Java primitive array of type getElementType(), with the physical order
 * of the result the same as logical order.
 *
 * @return a Java 1D array of type getElementType().
 */
public Object copyTo1DJavaArray() {
 Array newA = copy();
 return newA.getStorage();
}

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

/**
 * Create a new MAMatrix that is the same as this one, with a copy of the backing store.
 */
public MAMatrix copy() {
 return new MAMatrix( a.copy());
}

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

/**
 * Create a new MAMatrix that is the same as this one, with a copy of the backing store.
 */
public MAMatrix copy() {
 return new MAMatrix( a.copy());
}

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

/**
 * Create a new MAVector that is the same as this one, with a copy of the backing store.
 */
public MAVector copy() {
 return new MAVector( a.copy());
}

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

/**
 * Create a new MAVector that is the same as this one, with a copy of the backing store.
 */
public MAVector copy() {
 return new MAVector( a.copy());
}

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

/**
 * Copy this array to a 1D Java primitive array of type getElementType(), with the physical order
 * of the result the same as logical order.
 *
 * @return a Java 1D array of type getElementType().
 */
public Object copyTo1DJavaArray() {
 Array newA = copy();
 return newA.getStorage();
}

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

/**
 * Copy this array to a 1D Java primitive array of type getElementType(), with the physical order
 * of the result the same as logical order.
 *
 * @return a Java 1D array of type getElementType().
 */
public Object copyTo1DJavaArray() {
 Array newA = copy();
 return newA.getStorage();
}

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

protected Array _read() throws IOException {
 // caching overrides the proxyReader
 // check if already cached
 if (cache.data != null) {
  if (debugCaching) System.out.println("got data from cache " + getFullName());
  return cache.data.copy();
 }
 Array data = proxyReader.reallyRead(this, null);
 // optionally cache it
 if (isCaching()) {
  setCachedData(data);
  if (debugCaching) System.out.println("cache " + getFullName());
  return cache.data.copy(); // dont let users get their nasty hands on cached data
 } else {
  return data;
 }
}

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

protected Array _read() throws IOException {
 // caching overrides the proxyReader
 // check if already cached
 if (cache != null && cache.data != null) {
  if (debugCaching) System.out.println("got data from cache " + getFullName());
  return cache.data.copy();
 }
 Array data = proxyReader.reallyRead(this, null);
 // optionally cache it
 if (isCaching()) {
  setCachedData(data);
  if (debugCaching) System.out.println("cache " + getFullName());
  return cache.data.copy(); // dont let users get their nasty hands on cached data
 } else {
  return data;
 }
}

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

protected Array _read() throws IOException {
 // caching overrides the proxyReader
 // check if already cached
 if (cache.data != null) {
  if (debugCaching) System.out.println("got data from cache " + getFullName());
  return cache.data.copy();
 }
 Array data = proxyReader.reallyRead(this, null);
 // optionally cache it
 if (isCaching()) {
  setCachedData(data);
  if (debugCaching) System.out.println("cache " + getFullName());
  return cache.data.copy(); // dont let users get their nasty hands on cached data
 } else {
  return data;
 }
}

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

public StructureDataIterator getStructureDataIterator(Cursor cursor, int bufferSize) throws IOException {
 StructureData parentStruct = cursor.tableData[2];
 if (parentStruct instanceof StructureDataProxy) parentStruct =  ((StructureDataProxy) parentStruct).getOriginalStructureData(); // tricky dicky
 int middleIndex = cursor.recnum[1];
 ArrayStructureMA asma = new ArrayStructureMA(sm, new int[]{inner.getLength()});
 for (String colName : cols.keySet()) {
  Array data = parentStruct.getArray(colName);
  Array myData = data.slice(0, middleIndex);
  StructureMembers.Member childm = sm.findMember(colName);
  childm.setDataArray (myData.copy());           // must make copy - ArrayStucture doesnt deal with logical views
 }
 return asma.getStructureDataIterator();
}

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

@Override
public StructureDataIterator getStructureDataIterator(Cursor cursor) throws IOException {
 StructureData parentStruct = cursor.tableData[2];
 if (parentStruct instanceof StructureDataProxy)
  parentStruct = ((StructureDataProxy) parentStruct).getOriginalStructureData(); // tricky dicky
 int middleIndex = cursor.recnum[1];
 ArrayStructureMA asma = new ArrayStructureMA(sm, new int[]{inner.getLength()});
 for (String colName : cols.keySet()) {
  Array data = parentStruct.getArray(colName);
  Array myData = data.slice(0, middleIndex);
  StructureMembers.Member childm = sm.findMember(colName);
  childm.setDataArray(myData.copy());           // must make copy - ArrayStucture doesnt deal with logical views
 }
 return asma.getStructureDataIterator();
}

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

protected Array _read(Section section) throws IOException, InvalidRangeException {
 // check if its really a full read
 if ((null == section) || section.computeSize() == getSize())
  return _read();
 // full read was cached
 if (isCaching()) {
  if (cache.data == null) {
   setCachedData(  _read()); // read and cache entire array
   if (debugCaching) System.out.println("cache " + getFullName());
  }
  if (debugCaching) System.out.println("got data from cache " + getFullName());
  return cache.data.sectionNoReduce(section.getRanges()).copy(); // subset it, return copy
 }
 return proxyReader.reallyRead(this, section, null);
}

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

protected Array _read(Section section) throws IOException, InvalidRangeException {
 // check if its really a full read
 if ((null == section) || section.computeSize() == getSize())
  return _read();
 // full read was cached
 if (isCaching()) {
  if (cache.data == null) {
   setCachedData(_read()); // read and cache entire array
   if (debugCaching) System.out.println("cache " + getFullName());
  }
  if (debugCaching) System.out.println("got data from cache " + getFullName());
  return cache.data.sectionNoReduce(section.getRanges()).copy(); // subset it, return copy
 }
 return proxyReader.reallyRead(this, section, null);
}

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

protected Array _read(Section section) throws IOException, InvalidRangeException {
 // check if its really a full read
 if ((null == section) || section.computeSize() == getSize())
  return _read();
 // full read was cached
 if (isCaching()) {
  if (cache.data == null) {
   setCachedData(_read()); // read and cache entire array
   if (debugCaching) System.out.println("cache " + getFullName());
  }
  if (debugCaching) System.out.println("got data from cache " + getFullName());
  return cache.data.sectionNoReduce(section.getRanges()).copy(); // subset it, return copy
 }
 return proxyReader.reallyRead(this, section, null);
}

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

public StructureDataIterator getStructureDataIterator(Cursor cursor, int bufferSize) throws IOException {
 StructureData parentStruct = cursor.tableData[2];
 int middleIndex = cursor.recnum[1];
 ArrayStructureMA asma = new ArrayStructureMA(sm, new int[]{inner.getLength()});
 for (VariableSimpleIF v : cols) {
  Array data = parentStruct.getArray(v.getShortName());
  Array myData = data.slice(0, middleIndex);
  StructureMembers.Member childm = sm.findMember(v.getShortName());
  childm.setDataArray (myData.copy()); // must make copy - ARrayStucture doesnt deal with logical views
 }
 return asma.getStructureDataIterator();
}

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

/**
 * Read the data for each variable passed in
 *
 * @param v2
 * @param section
 * @return output data
 * @throws IOException
 * @throws ucar.ma2.InvalidRangeException
 */
public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException {
 // subset
 Object data;
 Array outputData;
 byte[] vdata = null;
 NOWRadheader.Vinfo vinfo;
 ByteBuffer bos;
 List<Range> ranges = section.getRanges();
 vinfo = (NOWRadheader.Vinfo) v2.getSPobject();
 vdata = headerParser.getData((int) vinfo.hoff);
 bos = ByteBuffer.wrap(vdata);
 data = readOneScanData(bos, vinfo, v2.getShortName());
 outputData = Array.factory(v2.getDataType(), v2.getShape(), data);
 outputData = outputData.flip(1);
 // outputData = outputData.flip(2);
 return (outputData.sectionNoReduce(ranges).copy());
 // return outputData;
}

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

@Test
public void testArrayObjectIter() throws InvalidRangeException {
 Array arrayObject = Array.factory(DataType.OPAQUE, new int[] {30});
 testArrayObjectIter(arrayObject, 30);
 Array arrayObjectSubset = arrayObject.sectionNoReduce(new Section("1:20").getRanges()); // subset it
 testArrayObjectIter(arrayObjectSubset, 20);
 Array arrayObjectSubsetCopy = arrayObjectSubset.copy();
 testArrayObjectIter(arrayObjectSubsetCopy, 20);
}

相关文章

微信公众号

最新文章

更多