ucar.ma2.Index.setCurrentCounter()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(77)

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

Index.setCurrentCounter介绍

[英]Set the current counter from the 1D "current element" currElement = offset + stride[0]*current[0] + ...
[中]从1D“当前元素”currElement=偏移量+跨距[0]*当前[0]+.设置当前计数器。。。

代码示例

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

public int[] getCurrentCounter() {
 if (counter == null)   // or counter == "" ?
  counter = Index.factory(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

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

public int[] getCurrentCounter() {
 if (counter == null)   // or counter == "" ?
  counter = Index.factory(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

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

public int[] getCurrentCounter() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

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

public int[] getCurrentCounter() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

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

public int[] getCurrentCounter() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

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

public int[] getCurrentCounter() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

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

public String toString() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}
public int[] getCurrentCounter() {

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

public String toString() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}
public int[] getCurrentCounter() {

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

public String toString() {
 if (counter == null || counter.toString().equals(""))   // not sure about the second condition
  counter = Index.factory(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}

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

public String toString() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}

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

public String toString() {
 if (counter == null || counter.toString().equals(""))   // not sure about the second condition
  counter = Index.factory(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}

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

public String toString() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}
public int[] getCurrentCounter() {

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

/**
 * Use this when this is a one dimensional array of Structures, or you are doing the index calculation yourself for
 * a multidimension array. This will read only the ith structure, and return the data as a StructureData object.
 * @param index index into 1D array
 * @return ith StructureData
 * @throws java.io.IOException on read error
 * @throws ucar.ma2.InvalidRangeException if index out of range
 */
public StructureData readStructure(int index) throws IOException, ucar.ma2.InvalidRangeException {
 Section section = null; // works for scalars i think
 if (getRank() == 1) {
  section = new Section().appendRange(index,index);
 } else if (getRank() > 1) {
  Index ii = Index.factory(shape); // convert to nD index
  ii.setCurrentCounter(index);
  int[] origin = ii.getCurrentCounter();
  section = new Section();
  for (int i=0;i<origin.length;i++)
   section.appendRange(origin[i], origin[i]);
 }
 Array dataArray = read(section);
 ArrayStructure data = (ArrayStructure) dataArray;
 return data.getStructureData(0);
}

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

/**
 * Use this when this is a one dimensional array of Structures, or you are doing the index calculation yourself for
 * a multidimension array. This will read only the ith structure, and return the data as a StructureData object.
 * @param index index into 1D array
 * @return ith StructureData
 * @throws java.io.IOException on read error
 * @throws ucar.ma2.InvalidRangeException if index out of range
 */
public StructureData readStructure(int index) throws IOException, ucar.ma2.InvalidRangeException {
 Section section = null; // works for scalars i think
 if (getRank() == 1) {
  section = new Section().appendRange(index,index);
 } else if (getRank() > 1) {
  Index ii = Index.factory(shape); // convert to nD index
  ii.setCurrentCounter(index);
  int[] origin = ii.getCurrentCounter();
  section = new Section();
  for (int anOrigin : origin)
   section.appendRange(anOrigin, anOrigin);
 }
 Array dataArray = read(section);
 ArrayStructure data = (ArrayStructure) dataArray;
 return data.getStructureData(0);
}

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

/**
 * Use this when this is a one dimensional array of Structures, or you are doing the index calculation yourself for
 * a multidimension array. This will read only the ith structure, and return the data as a StructureData object.
 * @param index index into 1D array
 * @return ith StructureData
 * @throws java.io.IOException on read error
 * @throws ucar.ma2.InvalidRangeException if index out of range
 */
public StructureData readStructure(int index) throws IOException, ucar.ma2.InvalidRangeException {
 Section section = null; // works for scalars i think
 if (getRank() == 1) {
  section = new Section().appendRange(index,index);
 } else if (getRank() > 1) {
  Index ii = Index.factory(shape); // convert to nD index
  ii.setCurrentCounter(index);
  int[] origin = ii.getCurrentCounter();
  section = new Section();
  for (int anOrigin : origin)
   section.appendRange(anOrigin, anOrigin);
 }
 Array dataArray = read(section);
 ArrayStructure data = (ArrayStructure) dataArray;
 return data.getStructureData(0);
}

相关文章