private Variable identifyIdVariable(NetcdfDataset ds, CF.FeatureType ftype) { Variable result; switch (ftype) { case timeSeriesProfile: case timeSeries: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TIMESERIES_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.STATION_ID); // old way for backwards compatibility case trajectory: case trajectoryProfile: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.TRAJECTORY_ID); // old way for backwards compatibility case profile: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.PROFILE_ID); // old way for backwards compatibility default: return null; } }
private Variable identifyIdVariable(NetcdfDataset ds, CF.FeatureType ftype) { Variable result; switch (ftype) { case timeSeriesProfile: case timeSeries: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TIMESERIES_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.STATION_ID); // old way for backwards compatibility case trajectory: case trajectoryProfile: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.TRAJECTORY_ID); // old way for backwards compatibility case profile: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.PROFILE_ID); // old way for backwards compatibility default: return null; } }
private Variable identifyIdVariable(NetcdfDataset ds, CF.FeatureType ftype) { Variable result; switch (ftype) { case timeSeriesProfile: case timeSeries: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TIMESERIES_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.STATION_ID); // old way for backwards compatibility case trajectory: case trajectoryProfile: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.TRAJECTORY_ID); // old way for backwards compatibility case profile: result = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); if (result != null) return result; return Evaluator.findVariableWithAttributeValue(ds, CF.STANDARD_NAME, CF.PROFILE_ID); // old way for backwards compatibility default: return null; } }
/** * Find first variable with given attribute name and value * * @param ds in this dataset * @param attName attribute name, case insensitive * @param attValue attribute value, case sensitive * @return name of first variable with given attribute name and value, or null */ static public String findNameOfVariableWithAttributeValue(NetcdfDataset ds, String attName, String attValue) { Variable v = findVariableWithAttributeValue(ds, attName, attValue); return (v == null) ? null : v.getShortName(); }
/** * Find first variable with given attribute name and value * * @param ds in this dataset * @param attName attribute name, case insensitive * @param attValue attribute value, case sensitive * @return name of first variable with given attribute name and value, or null */ static public String findNameOfVariableWithAttributeValue(NetcdfDataset ds, String attName, String attValue) { Variable v = findVariableWithAttributeValue(ds, attName, attValue); return (v == null) ? null : v.getShortName(); }
/** * Find first member variable in this struct with given attribute name and value * * @param struct in this structure * @param attName attribute name, case insensitive * @param attValue attribute value, case sensitive * @return name of first member variable with given attribute name and value, or null */ static public String findNameOfVariableWithAttributeValue(Structure struct, String attName, String attValue) { Variable v = findVariableWithAttributeValue(struct, attName, attValue); return (v == null) ? null : v.getShortName(); // LOOK short name? }
/** * Find first variable with given attribute name and value * * @param ds in this dataset * @param attName attribute name, case insensitive * @param attValue attribute value, case sensitive * @return name of first variable with given attribute name and value, or null */ static public String findNameOfVariableWithAttributeValue(NetcdfDataset ds, String attName, String attValue) { Variable v = findVariableWithAttributeValue(ds, attName, attValue); return (v == null) ? null : v.getShortName(); }
/** * Find first variable with given attribute name and value. * If not found, search one level into structures. * * @param ds in this dataset * @param attName attribute name, case insensitive * @param attValue attribute value, case sensitive * @return first variable with given attribute name and value, or null */ static public Variable findVariableWithAttributeValue(NetcdfDataset ds, String attName, String attValue) { for (Variable v : ds.getVariables()) { String haveValue = ds.findAttValueIgnoreCase(v, attName, null); if ((haveValue != null) && haveValue.equals(attValue)) return v; } // descend into structures for (Variable v : ds.getVariables()) { if (v instanceof Structure) { Variable vn = findVariableWithAttributeValue((Structure) v, attName, attValue); if (null != vn) return vn; } } return null; }
/** * Find first variable with given attribute name and value. * If not found, look one level into structures. * * @param ds in this dataset * @param attName attribute name, case insensitive * @param attValue attribute value, case sensitive * @return first variable with given attribute name and value, or null */ static public Variable findVariableWithAttributeValue(NetcdfDataset ds, String attName, String attValue) { for (Variable v : ds.getVariables()) { String haveValue = ds.findAttValueIgnoreCase(v, attName, null); if ((haveValue != null) && haveValue.equals(attValue)) return v; } // descend into structures for (Variable v : ds.getVariables()) { if (v instanceof Structure) { Variable vn = findVariableWithAttributeValue((Structure) v, attName, attValue); if (null != vn) return vn; } } return null; }
/** * Find first variable with given attribute name and value. * If not found, look one level into structures. * * @param ds in this dataset * @param attName attribute name, case insensitive * @param attValue attribute value, case sensitive * @return first variable with given attribute name and value, or null */ static public Variable findVariableWithAttributeValue(NetcdfDataset ds, String attName, String attValue) { for (Variable v : ds.getVariables()) { String haveValue = ds.findAttValueIgnoreCase(v, attName, null); if ((haveValue != null) && haveValue.equals(attValue)) return v; } // descend into structures for (Variable v : ds.getVariables()) { if (v instanceof Structure) { Variable vn = findVariableWithAttributeValue((Structure) v, attName, attValue); if (null != vn) return vn; } } return null; }
@Override protected boolean identifyEncodingTraj(NetcdfDataset ds, EncodingInfo info, Formatter errlog) { // find the obs structure info.childStruct = info.lat.getParentStructure(); Dimension obsDim = info.childStruct.getDimension(0); // find the traj structure Variable varatt = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); Structure traj = varatt.getParentStructure(); if (traj.getRank() == 0) { // could be scalar info.set(Encoding.single, null, obsDim); } Dimension trajDim = traj.getDimension(0); if (identifyRaggeds(ds, info, trajDim, obsDim, errlog)) return true; errlog.format("CFpointObsExt: %s only supports ragged array representation%n", CF.FeatureType.trajectory); return false; }
@Override protected boolean identifyEncodingTraj(NetcdfDataset ds, EncodingInfo info, Formatter errlog) { // find the obs structure info.childStruct = info.lat.getParentStructure(); Dimension obsDim = info.childStruct.getDimension(0); // find the traj structure Variable varatt = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); Structure traj = varatt.getParentStructure(); if (traj.getRank() == 0) { // could be scalar info.set(Encoding.single, null, obsDim); } Dimension trajDim = traj.getDimension(0); if (identifyRaggeds(ds, info, trajDim, obsDim, errlog)) return true; errlog.format("CFpointObsExt: %s only supports ragged array representation%n", CF.FeatureType.trajectory); return false; }
Variable stdId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TIMESERIES_ID); Structure stn = stdId.getParentStructure(); if (stn.getRank() == 0) { // could be scalar Variable profileId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); Structure profile = profileId.getParentStructure(); info.childDim = profile.getDimension(0);
Variable stdId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TIMESERIES_ID); Structure stn = stdId.getParentStructure(); if (stn.getRank() == 0) { // could be scalar Variable profileId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); Structure profile = profileId.getParentStructure(); info.childDim = profile.getDimension(0);
Variable trajId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); Structure traj = trajId.getParentStructure(); if (traj.getRank() == 0) { // could be scalar Variable profileId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); Structure profile = profileId.getParentStructure(); info.childDim = profile.getDimension(0);
Variable trajId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); Structure traj = trajId.getParentStructure(); if (traj.getRank() == 0) { // could be scalar Variable profileId = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.PROFILE_ID); Structure profile = profileId.getParentStructure(); info.childDim = profile.getDimension(0);