fields = (LinkedHashMap<String, HDF4ProductFieldType>) fieldsMap.get(coverageName);
String elementName = band.getName();
if (!fields.containsKey(elementName)) {
Product product = HDF4ProductFieldType.getProduct(elementName);
Unit unit = Unit.ONE;
if (product != null) {
unit = product.getUoM();
} else {
String uOm = band.getUoM();
if(uOm == null)
unit = Unit.ONE.alternate(uOm);
else
try {
unit = Unit.valueOf(uOm);
} catch (IllegalArgumentException iae) {
try {
unit = Unit.ONE.alternate(uOm);
} catch (IllegalArgumentException iae2) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Unable to parse the provided unit " + uOm, iae2);
}
} catch (UnsupportedOperationException uoe) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE,
"Unable to parse the provided unit "
+ uOm, uoe);
}
}
}
}
final Name nameImpl = new NameImpl(coverageName.getLocalPart(), elementName);
final InternationalString description = new SimpleInternationalString(product!=null?product.getDescription():elementName);
// setting bands names.
final GridSampleDimension gridBand = Utilities.buildBands(band, elementName, unit);
final HDF4ProductFieldType fd = new HDF4ProductFieldType(nameImpl, description, gridBand);
fields.put(elementName, fd);