protected void copyTo1DJavaArray(IndexIterator iter, Object javaArray) { float[] ja = (float []) javaArray; for (int i=0; i<ja.length; i++) ja[i] = iter.getFloatNext(); }
protected void copyTo1DJavaArray(IndexIterator iter, Object javaArray) { float[] ja = (float []) javaArray; for (int i=0; i<ja.length; i++) ja[i] = iter.getFloatNext(); }
/** * Return the next float in the local iterator. * Uses the local iterator, which is not thread-safe. Use getIndexIterator if you need thread-safety. * * @return next element as a float, same as IndexIterator.getFloatNext(). */ public float nextFloat() { return ii.getFloatNext(); }
protected void copyTo1DJavaArray(IndexIterator iter, Object javaArray) { float[] ja = (float []) javaArray; for (int i=0; i<ja.length; i++) ja[i] = iter.getFloatNext(); }
/** * Return the next float in the local iterator. * Uses the local iterator, which is not thread-safe. Use getIndexIterator if you need thread-safety. * * @return next element as a float, same as IndexIterator.getFloatNext(). */ public float nextFloat() { return ii.getFloatNext(); }
/** * Return the next float in the local iterator. * Uses the local iterator, which is not thread-safe. Use getIndexIterator if you need thread-safety. * * @return next element as a float, same as IndexIterator.getFloatNext(). */ public float nextFloat() { return ii.getFloatNext(); }
raster.setSample(x, y, dstBand, it.getFloatNext()); break;
private int getXIndex(Array aAxis, double value, int side) { IndexIterator aIter = aAxis.getIndexIterator(); int count = 0; int isInd = 0; double aValue = aIter.getFloatNext(); if ((aValue == value) || (aValue > value)) { return 0; } while (aIter.hasNext() && (aValue < value)) { count++; aValue = aIter.getFloatNext(); if (aValue == value) { isInd = 1; } } if (isInd == 1) { count += side; } count -= side; return count; }
int getXIndex(Array aAxis, double value, int side) { IndexIterator aIter = aAxis.getIndexIterator(); int count = 0; int isInd = 0; double aValue = aIter.getFloatNext(); if ((aValue == value) || (aValue > value)) { return 0; } while (aIter.hasNext() && (aValue < value)) { count++; aValue = aIter.getFloatNext(); if (aValue == value) { isInd = 1; } } if (isInd == 1) { count += side; } count -= side; return count; }
int getYIndex(Array aAxis, double value, int side) { IndexIterator aIter = aAxis.getIndexIterator(); int count = 0; int isInd = 0; double aValue = aIter.getFloatNext(); if ((aValue == value) || (aValue < value)) { return 0; } while (aIter.hasNext() && (aValue > value)) { count++; aValue = aIter.getFloatNext(); if (aValue == value) { isInd = 1; } } if (isInd == 1) { count += side; } count -= side; return count; }
int getLatIndex(Array lat, double value, int side) { IndexIterator latIter = lat.getIndexIterator(); int count = 0; int isInd = 0; //LatLonPoint p0 = new LatLonPointImpl(lat.getFloat(ind.set(0)), 0); double xlat = latIter.getFloatNext(); if (xlat == value) { return 0; } while (latIter.hasNext() && (xlat > value)) { count++; xlat = latIter.getFloatNext(); if (xlat == value) { isInd = 1; } } if (isInd == 1) { count += side; } count -= side; return count; }
protected void copyFloats(int recnum, StructureMembers.Member m, IndexIterator result) { IndexIterator dataIter = getArray(recnum, m).getIndexIterator(); while (dataIter.hasNext()) result.setFloatNext(dataIter.getFloatNext()); }
protected void copyFloats(int recnum, StructureMembers.Member m, IndexIterator result) { IndexIterator dataIter = getArray(recnum, m).getIndexIterator(); while (dataIter.hasNext()) result.setFloatNext(dataIter.getFloatNext()); }
protected void copyFloats(int recnum, StructureMembers.Member m, IndexIterator result) { IndexIterator dataIter = getArray(recnum, m).getIndexIterator(); while (dataIter.hasNext()) result.setFloatNext(dataIter.getFloatNext()); }
/** * copy array a to array result as floats * The values from the arrays a are converted to float (if needed), * and then converted to the type of result (if needed). * * @param result copy to here * @param a copy from here * * @throws IllegalArgumentException a and result are not conformable */ public static void copyFloat(Array result, Array a) throws IllegalArgumentException { if (!conformable(a, result)) throw new IllegalArgumentException("copy arrays are not conformable"); IndexIterator iterA = a.getIndexIterator(); IndexIterator iterR = result.getIndexIterator(); while (iterA.hasNext()) iterR.setFloatNext(iterA.getFloatNext()); }
/** * copy array a to array result as floats * The values from the arrays a are converted to float (if needed), * and then converted to the type of result (if needed). * * @param result copy to here * @param a copy from here * * @throws IllegalArgumentException a and result are not conformable */ public static void copyFloat(Array result, Array a) throws IllegalArgumentException { if (!conformable(a, result)) throw new IllegalArgumentException("copy arrays are not conformable"); IndexIterator iterA = a.getIndexIterator(); IndexIterator iterR = result.getIndexIterator(); while (iterA.hasNext()) iterR.setFloatNext(iterA.getFloatNext()); }
/** * copy array a to array result as floats * The values from the arrays a are converted to float (if needed), * and then converted to the type of result (if needed). * * @param result copy to here * @param a copy from here * * @throws IllegalArgumentException a and result are not conformable */ public static void copyFloat(Array result, Array a) throws IllegalArgumentException { if (!conformable(a, result)) throw new IllegalArgumentException("copy arrays are not conformable"); IndexIterator iterA = a.getIndexIterator(); IndexIterator iterR = result.getIndexIterator(); while (iterA.hasNext()) iterR.setFloatNext(iterA.getFloatNext()); }
private float testReadScalar(Variable v) throws IOException { if (show) System.out.printf(" read %s%n", v.getNameAndDimensions()); assert (null != v); Array a = v.read(); assert (null != a); IndexIterator ii = a.getIndexIterator(); return ii.getFloatNext(); }
/** * Replace missing values with dataMinMax.min - 1.0; return a floating point data array. * * @param grid GridDatatype * @param data input data array * @return floating point data array with missing values replaced. */ private ArrayFloat replaceMissingValues(IsMissingEvaluator grid, Array data, MAMath.MinMax dataMinMax) { float minValue = (float) (dataMinMax.min - 1.0); ArrayFloat floatArray = (ArrayFloat) Array.factory(DataType.FLOAT, data.getShape()); IndexIterator dataIter = data.getIndexIterator(); IndexIterator floatIter = floatArray.getIndexIterator(); while (dataIter.hasNext()) { float v = dataIter.getFloatNext(); if (grid.isMissing((double) v)) { v = minValue; } floatIter.setFloatNext(v); } return floatArray; }
private double geoShiftGetXstart(Array lon, double inc) { Index ilon = lon.getIndex(); int[] lonShape = lon.getShape(); IndexIterator lonIter = lon.getIndexIterator(); double xlon = 0.0; LatLonPoint p0 = new LatLonPointImpl(0, lon.getFloat(ilon.set(0))); LatLonPoint pN = new LatLonPointImpl(0, lon.getFloat(ilon.set(lonShape[0] - 1))); xlon = p0.getLongitude(); while (lonIter.hasNext()) { float l = lonIter.getFloatNext(); LatLonPoint pn = new LatLonPointImpl(0, l); if (pn.getLongitude() < xlon) { xlon = pn.getLongitude(); } } if (p0.getLongitude() == pN.getLongitude()) { xlon = xlon - inc; } return xlon; }