List<Attribute> getGlobalAttributes() { if (dataset != null) { return dataset.getGlobalAttributes(); } return null; }
@Override public List<CoordinateAxis> getCoordinateAxes() { return cs.getCoordinateAxes(); } }
public double getIncrement() { if (!(coordinateAxis instanceof CoordinateAxis1D)) { return Double.NaN; } return convertAxis ? ((CoordinateAxis1D) coordinateAxis).getIncrement() * conversionFactor : ((CoordinateAxis1D) coordinateAxis).getIncrement(); }
@Override public boolean canHandle(CoordinateAxis axis) { if (axis != null && "time".equalsIgnoreCase(axis.getShortName()) && CLIMATOLOGICAL_UNITS.equalsIgnoreCase(axis.getUnitsString())) { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("Climatological Time Handler Spi can handle the axis"); } return true; } return false; }
/** Wraps a generic exception into a {@link IIOException}. */ protected IIOException netcdfFailure(final Exception e) throws IOException { return new IIOException( new StringBuilder("Can't read file ").append(dataset.getLocation()).toString(), e); }
private String getTimeAttribute(CoordinateSystem cs) { CoordinateAxis timeAxis = cs.getTaxis(); String name = timeAxis != null ? timeAxis.getFullName() : NetCDFUtilities.TIME_DIM; DimensionMapper dimensionMapper = reader.georeferencing.getDimensionMapper(); String timeAttribute = dimensionMapper.getDimension(name.toUpperCase()); if (timeAttribute == null) { // Fallback on standard name timeAttribute = dimensionMapper.getDimension(NetCDFUtilities.TIME_DIM); } return timeAttribute; }
public String getUnit() { return coordinateAxis.getUnitsString(); }
public AxisType getAxisType() { return coordinateAxis.getAxisType(); }
public boolean isRegular() { return coordinateAxis instanceof CoordinateAxis1D && ((CoordinateAxis1D) coordinateAxis).isRegular(); }
public String getName() { return coordinateAxis.getShortName(); }
private synchronized Array readSection(VariableAdapter wrapper, Section section) throws IIOException, IOException { try { // Due to underlying NetCDF file system access (RAF based) // and internal caching we do this call within a // synchronized block return wrapper.variableDS.read(section); } catch (InvalidRangeException e) { throw netcdfFailure(e); } }
public static NetcdfDataset acquireDataset(URI uri) throws IOException { if (getFormat(uri) == FileFormat.FC) { return acquireFeatureCollection(uri.toString()); } else { return NetcdfDataset.acquireDataset(uri.toString(), null); } }
public int getRank() { return variableDS.getRank() - ignoredDimensions.size(); }
/** @return the shape */ public int[] getShape() { return variableDS.getShape(); }
@Override public CoordinateAxis getTaxis() { return cs.getTaxis(); }
public VariableAdapter(NetCDFImageReader reader, Name coverageName, VariableDS variable) throws Exception { this.variableDS = variable; this.reader = reader; this.coverageName = coverageName; setName(variable.getFullName()); init(); }
/** * Look for a SPATIAL_REF global attribute and parsing it (as WKT) to setup a {@link * CoordinateReferenceSystem} * * @param dataset * @return */ public static CoordinateReferenceSystem parseProjection(NetcdfDataset dataset) { Attribute attribute = dataset.findAttribute(NetCDFUtilities.SPATIAL_REF); return CRSParser.parseWKT(attribute); }
@Override public boolean hasTimeAxis() { return cs.hasTimeAxis(); }
protected boolean isMissing(Object val) { if (val instanceof Number) { return coordinateAxis.isMissing(((Number) val).doubleValue()); } else { return val == null; } }