public Map<String, Integer> mapIndex(int[] splittedIndex) { Map<String, Integer> resultIndex = new HashMap<String, Integer>(); for (int n = 0; n < splittedIndex.length; n++) { if (nDimensionIndex[n] != -1) { resultIndex.put( variableDS.getDimension(nDimensionIndex[n]).getFullName(), splittedIndex[n]); } } return resultIndex; }
.getDimension(variableDS.getRank() - NetCDFUtilities.X_DIMENSION) .getLength(); height = variableDS .getDimension(variableDS.getRank() - NetCDFUtilities.Y_DIMENSION) .getLength(); numBands = variableDS.getRank() > 2 ? variableDS.getDimension(2).getLength() : 1;
static public CoordinateAxis1DTime factory(NetcdfDataset ncd, VariableDS org, Formatter errMessages) throws IOException { if (org.getDataType() == DataType.CHAR) return new CoordinateAxis1DTime(ncd, org, errMessages, org.getDimension(0).getShortName()); else if (org.getDataType() == DataType.STRING) return new CoordinateAxis1DTime(ncd, org, errMessages, org.getDimensionsString()); else return new CoordinateAxis1DTime(ncd, org, errMessages); }
/** @throws Exception */ private void initSlicesInfo() throws Exception { int[] shape = variableDS.getShape(); numberOfSlices = 1; for (int i = 0; i < variableDS.getShape().length - 2; i++) { if (!ignoredDimensions.contains(variableDS.getDimension(i).getFullName())) { numberOfSlices *= shape[i]; } } }
obsDim = info.time.getDimension(info.time.getRank() - 1); // may be time(time) or time(traj, obs) else if (info.time.getParentStructure() != null) { parentDim = info.time.getDimension(0); info.set(Encoding.multidim, parentDim, obsDim); return true;
static public CoordinateAxis1DTime factory(NetcdfDataset ncd, VariableDS org, Formatter errMessages) throws IOException { if (org instanceof CoordinateAxis1DTime) return (CoordinateAxis1DTime) org; if (org.getDataType() == DataType.CHAR) return new CoordinateAxis1DTime(ncd, org, errMessages, org.getDimension(0).getShortName()); else if (org.getDataType() == DataType.STRING) return new CoordinateAxis1DTime(ncd, org, errMessages, org.getDimensionsString()); else return new CoordinateAxis1DTime(ncd, org, errMessages); }
/** * Return the value of a particular dimension. * * @param dimensionIndex the index of the dimension * @return the value */ @SuppressWarnings("unchecked") private <T> T getValueByIndex(int dimensionIndex, final Map<String, Integer> mappedIndex) { final Dimension dimension = variableDS.getDimension(dimensionIndex); return (T) reader.georeferencing .getCoordinateVariable(dimension.getFullName()) .read(mappedIndex); }
obsDim = info.time.getDimension(info.time.getRank() - 1); // may be time(time) or time(traj, obs) else if (info.time.getParentStructure() != null) { parentDim = info.time.getDimension(0); info.set(Encoding.multidim, parentDim, obsDim); return true;
static public CoordinateAxis1DTime factory(NetcdfDataset ncd, VariableDS org, Formatter errMessages) throws IOException { if (org instanceof CoordinateAxis1DTime) return (CoordinateAxis1DTime) org; if (org.getDataType() == DataType.CHAR) return new CoordinateAxis1DTime(ncd, org, errMessages, org.getDimension(0).getShortName()); else if (org.getDataType() == DataType.STRING) return new CoordinateAxis1DTime(ncd, org, errMessages, org.getDimensionsString()); else return new CoordinateAxis1DTime(ncd, org, errMessages); }
public Map<String, Integer> mapIndex(int[] splittedIndex) { Map<String, Integer> resultIndex = new HashMap<String, Integer>(); for (int n = 0; n < splittedIndex.length; n++) { if (nDimensionIndex[n] != -1) { resultIndex.put( variableDS.getDimension(nDimensionIndex[n]).getFullName(), splittedIndex[n]); } } return resultIndex; }
/** @throws Exception */ private void initSlicesInfo() throws Exception { int[] shape = variableDS.getShape(); numberOfSlices = 1; for (int i = 0; i < variableDS.getShape().length - 2; i++) { if (!ignoredDimensions.contains(variableDS.getDimension(i).getFullName())) { numberOfSlices *= shape[i]; } } }
private TableConfig getPointConfig(NetcdfDataset ds, EncodingInfo info, Formatter errlog) throws IOException { if (info.time.getRank() != 1) { errlog.format("CFpointObs type=point: coord time must have rank 1, coord var= %s %n", info.time.getNameAndDimensions()); return null; } Dimension obsDim = info.time.getDimension(0); TableConfig obsTable = makeSingle(ds, obsDim, errlog); obsTable.featureType = FeatureType.POINT; return obsTable; }
protected TableConfig getPointConfig(NetcdfDataset ds, EncodingInfo info, Formatter errlog) throws IOException { if (info.time.getRank() != 1) { errlog.format("CFpointObs type=point: coord time must have rank 1, coord var= %s %n", info.time.getNameAndDimensions()); return null; } Dimension obsDim = info.time.getDimension(0); TableConfig obsTable = makeSingle(ds, obsDim, errlog); obsTable.featureType = FeatureType.POINT; return obsTable; }
protected TableConfig getPointConfig(NetcdfDataset ds, EncodingInfo info, Formatter errlog) throws IOException { if (info.time.getRank() != 1) { errlog.format("CFpointObs type=point: coord time must have rank 1, coord var= %s %n", info.time.getNameAndDimensions()); return null; } Dimension obsDim = info.time.getDimension(0); TableConfig obsTable = makeSingle(ds, obsDim, errlog); obsTable.featureType = FeatureType.POINT; return obsTable; }
private boolean computeIsInterval() { intervalWasComputed = true; Attribute boundsAtt = findAttributeIgnoreCase(CF.BOUNDS); if ((null == boundsAtt) || !boundsAtt.isString()) return false; String boundsVarName = boundsAtt.getStringValue(); VariableDS boundsVar = (VariableDS) ncd.findVariable(getParentGroup(), boundsVarName); if (null == boundsVar) return false; if (3 != boundsVar.getRank()) return false; if (getDimension(0) != boundsVar.getDimension(0)) return false; if (getDimension(1) != boundsVar.getDimension(1)) return false; return 2 == boundsVar.getDimension(2).getLength(); }
/** * Return the value of a particular dimension. * * @param dimensionIndex the index of the dimension * @return the value */ @SuppressWarnings("unchecked") private <T> T getValueByIndex(int dimensionIndex, final Map<String, Integer> mappedIndex) { final Dimension dimension = variableDS.getDimension(dimensionIndex); return (T) reader.georeferencing .getCoordinateVariable(dimension.getFullName()) .read(mappedIndex); }
private boolean computeIsInterval() { intervalWasComputed = true; Attribute boundsAtt = findAttributeIgnoreCase(CF.BOUNDS); if ((null == boundsAtt) || !boundsAtt.isString()) return false; String boundsVarName = boundsAtt.getStringValue(); VariableDS boundsVar = (VariableDS) ncd.findVariable(getParentGroup(), boundsVarName); if (null == boundsVar) return false; if (3 != boundsVar.getRank()) return false; if (getDimension(0) != boundsVar.getDimension(0)) return false; return 2 == boundsVar.getDimension(2).getLength(); }
/** * */ private void initRange() { // set the rank rank = variableDS.getRank(); width = variableDS.getDimension(rank - UnidataUtilities.X_DIMENSION).getLength(); height = variableDS.getDimension(rank - UnidataUtilities.Y_DIMENSION).getLength(); numBands = rank > 2 ? variableDS.getDimension(2).getLength() : 1; final int bufferType = UnidataUtilities.getRawDataType(variableDS); sampleModel = new BandedSampleModel(bufferType, width, height, 1); // range type String description = variableDS.getDescription(); final StringBuilder sb = new StringBuilder(); final Set<SampleDimension> sampleDims = new HashSet<SampleDimension>(); sampleDims.add(new GridSampleDimension(description + ":sd", (Category[]) null, null)); InternationalString desc = null; if (description != null && !description.isEmpty()) { desc = new SimpleInternationalString(description); } final FieldType fieldType = new DefaultFieldType(new NameImpl(getName()), desc, sampleDims); sb.append(description != null ? description.toString() + "," : ""); final RangeType range = new DefaultRangeType(getName(), description, fieldType); this.setRangeType(range); }
obsDim = info.time.getDimension(info.time.getRank() - 1); // may be time(time) or time(stn, obs) else if (info.time.getParentStructure() != null) { Dimension stnDim = info.lat.getDimension(0); if (obsDim == stnDim) {
obsDim = info.time.getDimension(info.time.getRank() - 1); // may be time(time) or time(stn, obs) else if (info.time.getParentStructure() != null) { Dimension stnDim = info.lat.getDimension(0); if (obsDim == stnDim) {