private Array convertToDegrees(Variable v) { Array data; try { data = v.read(); data = data.reduce(); } catch (IOException ioe) { throw new RuntimeException("data read failed on " + v.getFullName() + "=" + ioe.getMessage()); } IndexIterator ii = data.getIndexIterator(); while (ii.hasNext()) { ii.setDoubleCurrent(Math.toDegrees(ii.getDoubleNext())); } return data; }
private Array convertToDegrees(Variable v) { Array data; try { data = v.read(); data = data.reduce(); } catch (IOException ioe) { throw new RuntimeException("data read failed on " + v.getFullName() + "=" + ioe.getMessage()); } IndexIterator ii = data.getIndexIterator(); while (ii.hasNext()) { ii.setDoubleCurrent(Math.toDegrees(ii.getDoubleNext())); } return data; }
private Array convertToDegrees(Variable v) { Array data; try { data = v.read(); data = data.reduce(); } catch (IOException ioe) { throw new RuntimeException("data read failed on " + v.getFullName() + "=" + ioe.getMessage()); } IndexIterator ii = data.getIndexIterator(); while (ii.hasNext()) { ii.setDoubleCurrent(Math.toDegrees(ii.getDoubleNext())); } return data; }
/** * Translate missing data to NaNs. Data must be DOUBLE or FLOAT * * @param in convert this array * @return same array, with missing values replaced by NaNs */ private Array convertMissing(Array in) { if (debugRead) System.out.println("convertMissing "); IndexIterator iterIn = in.getIndexIterator(); if (in.getElementType() == double.class) { while (iterIn.hasNext()) { double val = iterIn.getDoubleNext(); if (isMissing_(val)) iterIn.setDoubleCurrent(Double.NaN); } } else if (in.getElementType() == float.class) { while (iterIn.hasNext()) { float val = iterIn.getFloatNext(); if (isMissing_(val)) iterIn.setFloatCurrent(Float.NaN); } } return in; }
it.setDoubleCurrent( val * elevVarUnitsConversionFactor );
it.setDoubleCurrent( val * elevVarUnitsConversionFactor );
/** * Translate missing data to NaNs. Data must be DOUBLE or FLOAT * * @param in convert this array * @return same array, with missing values replaced by NaNs */ private Array convertMissing(Array in) { if (debugRead) System.out.println("convertMissing "); IndexIterator iterIn = in.getIndexIterator(); if (in.getElementType() == double.class) { while (iterIn.hasNext()) { double val = iterIn.getDoubleNext(); if (isMissing_(val)) iterIn.setDoubleCurrent(Double.NaN); } } else if (in.getElementType() == float.class) { while (iterIn.hasNext()) { float val = iterIn.getFloatNext(); if (isMissing_(val)) iterIn.setFloatCurrent(Float.NaN); } } return in; }
it.setDoubleCurrent( val * elevVarUnitsConversionFactor );
it.setDoubleCurrent( val * elevVarUnitsConversionFactor );
it.setDoubleCurrent( val * elevVarUnitsConversionFactor );
it.setDoubleCurrent( val * elevVarUnitsConversionFactor );
if (elevVar.getDataType() == DataType.DOUBLE) { double val = it.getDoubleNext(); it.setDoubleCurrent(val * elevVarUnitsConversionFactor); } else if (elevVar.getDataType() == DataType.FLOAT) { float val = it.getFloatNext();
IndexIterator ii = glatData.getIndexIterator(); while (ii.hasNext()) { ii.setDoubleCurrent(Math.toDegrees(ii.getDoubleNext())); ii = glonData.getIndexIterator(); while (ii.hasNext()) { ii.setDoubleCurrent(Math.toDegrees(ii.getDoubleNext()));
public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException { NcMLReader.wrapNcMLresource(ds, CoordSysBuilder.resourcesDir + "Zebra.ncml", cancelTask); // special time handling // the time coord var is created in the NcML // set its values = base_time + time_offset(time) Dimension timeDim = ds.findDimension("time"); Variable base_time = ds.findVariable("base_time"); Variable time_offset = ds.findVariable("time_offset"); Variable time = ds.findVariable("time"); if ((timeDim == null) || (base_time == null) || (time_offset == null) || (time == null)) return; Attribute att = base_time.findAttribute(CDM.UNITS); String units = (att != null) ? att.getStringValue() : "seconds since 1970-01-01 00:00 UTC"; time.addAttribute(new Attribute(CDM.UNITS, units)); Array data; try { double baseValue = base_time.readScalarDouble(); data = time_offset.read(); IndexIterator iter = data.getIndexIterator(); while (iter.hasNext()) iter.setDoubleCurrent(iter.getDoubleNext() + baseValue); } catch (java.io.IOException ioe) { parseInfo.format("ZebraConvention failed to create time Coord Axis for file %s err= %s\n", ds.getLocation(), ioe); return; } time.setCachedData(data, true); }
public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException { NcMLReader.wrapNcMLresource(ds, CoordSysBuilder.resourcesDir + "Zebra.ncml", cancelTask); // special time handling // the time coord var is created in the NcML // set its values = base_time + time_offset(time) Dimension timeDim = ds.findDimension("time"); Variable base_time = ds.findVariable("base_time"); Variable time_offset = ds.findVariable("time_offset"); Variable time = ds.findVariable("time"); if ((timeDim == null) || (base_time == null) || (time_offset == null) || (time == null)) return; Attribute att = base_time.findAttribute(CDM.UNITS); String units = (att != null) ? att.getStringValue() : "seconds since 1970-01-01 00:00 UTC"; time.addAttribute(new Attribute(CDM.UNITS, units)); Array data; try { double baseValue = base_time.readScalarDouble(); data = time_offset.read(); IndexIterator iter = data.getIndexIterator(); while (iter.hasNext()) iter.setDoubleCurrent(iter.getDoubleNext() + baseValue); } catch (java.io.IOException ioe) { parseInfo.format("ZebraConvention failed to create time Coord Axis for file %s err= %s%n", ds.getLocation(), ioe); return; } time.setCachedData(data, true); }
IndexIterator ii = glatData.getIndexIterator(); while (ii.hasNext()) { ii.setDoubleCurrent(Math.toDegrees(ii.getDoubleNext())); ii = glonData.getIndexIterator(); while (ii.hasNext()) { ii.setDoubleCurrent(Math.toDegrees(ii.getDoubleNext()));
public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException { NcMLReader.wrapNcMLresource(ds, CoordSysBuilder.resourcesDir + "Zebra.ncml", cancelTask); // special time handling // the time coord var is created in the NcML // set its values = base_time + time_offset(time) Dimension timeDim = ds.findDimension("time"); Variable base_time = ds.findVariable("base_time"); Variable time_offset = ds.findVariable("time_offset"); Variable time = ds.findVariable("time"); if ((timeDim == null) || (base_time == null) || (time_offset == null) || (time == null)) return; Attribute att = base_time.findAttribute(CDM.UNITS); String units = (att != null) ? att.getStringValue() : "seconds since 1970-01-01 00:00 UTC"; time.addAttribute(new Attribute(CDM.UNITS, units)); Array data; try { double baseValue = base_time.readScalarDouble(); data = time_offset.read(); IndexIterator iter = data.getIndexIterator(); while (iter.hasNext()) iter.setDoubleCurrent(iter.getDoubleNext() + baseValue); } catch (java.io.IOException ioe) { parseInfo.format("ZebraConvention failed to create time Coord Axis for file %s err= %s%n", ds.getLocation(), ioe); return; } time.setCachedData(data, true); }
IndexIterator ii = data.getIndexIterator(); while (ii.hasNext()) ii.setDoubleCurrent(factor * ii.getDoubleNext());
IndexIterator ii = data.getIndexIterator(); while (ii.hasNext()) ii.setDoubleCurrent(factor * ii.getDoubleNext());
IndexIterator ii = data.getIndexIterator(); while (ii.hasNext()) ii.setDoubleCurrent(factor * ii.getDoubleNext());