/** * Reads the attribute value for the given name, then trims the leading and trailing spaces. * If the value is null, empty or contains only spaces, then this method returns {@code null}. */ private String stringValue(final String name) { return trim(decoder.stringValue(name)); }
/** * Reads the attribute value for the given name, then trims the leading and trailing spaces. * If the value is null, empty or contains only spaces, then this method returns {@code null}. */ private String stringValue(final String name) { return trim(decoder.stringValue(name)); }
/** * Adds metadata about a sample dimension (or band) from the given variable. * This is the {@code <mrc:dimension>} element in XML. * * @param variable the netCDF variable. */ private void addSampleDimension(final Variable variable) { newSampleDimension(); final String name = trim(variable.getName()); if (name != null) { final DefaultNameFactory f = decoder.nameFactory; setBandIdentifier(f.createMemberName(null, name, f.createTypeName(null, variable.getDataTypeName()))); } final String id = trim(variable.getAttributeAsString(CF.STANDARD_NAME)); if (id != null && !id.equals(name)) { addBandName(variable.getAttributeAsString(ACDD.standard_name_vocabulary), id); } final String description = trim(variable.getDescription()); if (description != null && !description.equals(name) && !description.equals(id)) { addBandDescription(description); } setSampleUnits(variable.getUnit()); setTransferFunction(variable.getAttributeAsNumber(CDM.SCALE_FACTOR), variable.getAttributeAsNumber(CDM.ADD_OFFSET)); addContentType(forCodeName(CoverageContentType.class, stringValue(ACDD.coverage_content_type))); }
final String name = trim(variable.getName()); if (name != null) { if (nameFactory == null) { final String id = (v.length == 1) ? trim((String) v[0]) : null; if (id != null && !id.equals(name)) { v = variable.getAttributeValues(ACDD.standard_name_vocabulary, false); addBandName(v.length == 1 ? (String) v[0] : null, id); final String description = trim(variable.getDescription()); if (description != null && !description.equals(name) && !description.equals(id)) { addBandDescription(description);