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

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

本文整理了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

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

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

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

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

  1. public int[] getCurrentCounter() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.current;
  6. }

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

  1. public int[] getCurrentCounter() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.current;
  6. }

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

  1. public int[] getCurrentCounter() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.current;
  6. }

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

  1. public int[] getCurrentCounter() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.current;
  6. }

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

  1. public String toString() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.toString();
  6. }
  7. public int[] getCurrentCounter() {

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

  1. public String toString() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.toString();
  6. }
  7. public int[] getCurrentCounter() {

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

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

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

  1. public String toString() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.toString();
  6. }

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

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

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

  1. public String toString() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.toString();
  6. }
  7. public int[] getCurrentCounter() {

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

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

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

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

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

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

相关文章