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

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

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

Array.getFloat介绍

[英]Get the array element at the current element of ima, as a float.
[中]以浮点形式获取ima当前元素处的数组元素。

代码示例

代码示例来源:origin: geotools/geotools

/**
 * Check whether the Y axis need to be flipped. Note that the method is synchronized since it
 * access the underlying Variable
 *
 * @param axis
 * @return
 * @throws IOException
 */
private synchronized boolean needFlipYAxis(CoordinateAxis axis) throws IOException {
  boolean flipYAxis = false;
  try {
    Array yAxisStart = axis.read(new Section().appendRange(2));
    float y1 = yAxisStart.getFloat(0);
    float y2 = yAxisStart.getFloat(1);
    if (y2 > y1) {
      flipYAxis = true;
    }
  } catch (InvalidRangeException e) {
    throw new RuntimeException(e);
  }
  return flipYAxis;
}

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

public float getFloatNext() {
 count++;
 currElement = counter.incr();
 return maa.getFloat(currElement);
}

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

/**
 * Get the value as a float for a scalar Variable.  May also be one-dimensional of length 1.
 *
 * @throws IOException                   if theres an IO Error
 * @throws UnsupportedOperationException if not a scalar Variable or one-dimensional of length 1.
 * @throws ForbiddenConversionException  if data type not convertible to float
 */
public float readScalarFloat() throws IOException {
 Array data = getScalarData();
 return data.getFloat(Index.scalarIndexImmutable);
}

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

public float getFloatNext() {
 count++;
 currElement = counter.incr();
 return maa.getFloat(currElement);
}

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

/**
 * Get the value as a float for a scalar Variable.  May also be one-dimensional of length 1.
 *
 * @throws IOException                   if theres an IO Error
 * @throws UnsupportedOperationException if not a scalar Variable or one-dimensional of length 1.
 * @throws ForbiddenConversionException  if data type not convertible to float
 */
public float readScalarFloat() throws IOException {
 Array data = getScalarData();
 return data.getFloat(Index.scalarIndexImmutable);
}

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

/**
 * Get member data of type float.
 * @param m get data from this StructureMembers.Member. Must be of type float.
 * @return scalar double value
 */
public float getScalarFloat(StructureMembers.Member m) {
 Array data = getArray(m);
 return data.getFloat(Index.scalarIndexImmutable);
}

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

private void dump(Array data, int col) {
 int[] shape = data.getShape();
 Index ima = data.getIndex();
 for (int j = 0; j < shape[0]; j++) {
  float dd = data.getFloat(ima.set(j, col));
  System.out.println(j + " value= " + dd);
 }
}

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

public float getScalarFloat(int recnum, StructureMembers.Member m) {
 if (m.getDataType() != DataType.FLOAT) throw new IllegalArgumentException("Type is "+m.getDataType()+", must be float");
 Array data = m.getDataArray();
 return data.getFloat( recnum * m.getSize()); // gets first one in the array
}

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

public float[] getJavaArrayFloat(int recnum, StructureMembers.Member m) {
 if (m.getDataType() != DataType.FLOAT) throw new IllegalArgumentException("Type is "+m.getDataType()+", must be float");
 int count = m.getSize();
 Array data = m.getDataArray();
 float[] pa = new float[count];
 for (int i=0; i<count; i++)
  pa[i] = data.getFloat( recnum * count + i);
 return pa;
}

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

public float getT(String tName, int swpNumber, int ray) throws IOException {
 Array timeData = ds.findVariable(tName).read();
 Index timeIndex = timeData.getIndex();
 return timeData.getFloat(timeIndex.set(swpNumber, ray));
}

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

public float getRadialDist(String dName, int gate) throws IOException {
 Array data = ds.findVariable(dName).read();
 Index index = data.getIndex();
 return data.getFloat(index.set(gate));
}

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

public float getRadialDistance(int gate) throws IOException {
 Variable sp = ds.findVariable("gate");
 Array spData = sp.read();
 sp.setCachedData(spData, false);
 Index index = spData.getIndex();
 return spData.getFloat(index.set(gate));
}

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

public float getAzimuth(int ray) throws IOException {
 Variable sp = ds.findVariable("azimuth");
 Array spData = sp.read();
 sp.setCachedData(spData, false);
 Index index = spData.getIndex();
 return spData.getFloat(index.set(ray));
}

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

public float getT(String tName, int swpNumber, int ray) throws IOException {
 Variable tvar = ds.findVariable(tName);
 Array timeData = tvar.read();
 tvar.setCachedData(timeData, false);
 Index timeIndex = timeData.getIndex();
 return timeData.getFloat(timeIndex.set(swpNumber, ray));
}

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

public float getT(String tName, int swpNumber, int ray) throws IOException {
 Variable tvar = ds.findVariable(tName);
 Array timeData = tvar.read();
 tvar.setCachedData(timeData, false);
 Index timeIndex = timeData.getIndex();
 return timeData.getFloat(timeIndex.set(swpNumber, ray));
}

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

public float getTime(int ray) throws IOException {
 Variable sp = ds.findVariable("rays_time");
 Array timeData = sp.read();
 sp.setCachedData(timeData, false);
 Index index = timeData.getIndex();
 return timeData.getFloat(index.set(ray));
}

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

public float getRadialDistance(int gate) throws IOException {
 Variable sp = ds.findVariable("gate");
 Array spData = sp.read();
 sp.setCachedData(spData, false);
 Index index = spData.getIndex();
 return spData.getFloat(index.set(gate));
}

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

public float getTime(int ray) throws IOException {
 Variable sp = ds.findVariable("rays_time");
 Array timeData = sp.read();
 sp.setCachedData(timeData, false);
 Index index = timeData.getIndex();
 return timeData.getFloat(index.set(ray));
}

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

public float getRadialDist(String dName, int gate) throws IOException {
 Variable dvar = ds.findVariable(dName);
 Array data = dvar.read();
 dvar.setCachedData(data, false);
 Index index = data.getIndex();
 return data.getFloat(index.set(gate));
}

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

@Test
public void testEcmwfExtendedComplexData2() throws IOException {
 final String testfile = "../grib/src/test/data/complex_packing2.grib1";
 try (NetcdfFile nc = NetcdfFile.open(testfile)) {
  Variable var = nc.findVariable("Snowfall_surface");
  Array data = var.read();
  float first = data.getFloat(0);
  Assert.assertEquals(.326607, first, 1e-6);
 }
}

相关文章

微信公众号

最新文章

更多