throw new WcsException("Multi axis coverages are not supported yet",
InvalidParameterValue, "RangeSubset");
} else if (field.getAxisSubset().size() == 0)
return;
AxisSubsetType axisSubset = (AxisSubsetType) field.getAxisSubset().get(0);
final String axisId = axisSubset.getIdentifier();
if (!axisId.equalsIgnoreCase("Bands"))
throw new WcsException("Unknown axis " + axisId + " in field " + fieldId,
InvalidParameterValue, "RangeSubset");
// prepare a support structure to quickly get the band index of a key
// (and remember we replaced spaces with underscores in the keys to
// avoid issues
// with the kvp parsing of indentifiers that include spaces)
List<CoverageDimensionInfo> dimensions = info.getDimensions();
Set<String> dimensionMap = new HashSet<String>();
for (int i = 0; i < dimensions.size(); i++) {
String keyName = dimensions.get(i).getName().replace(' ', '_');
dimensionMap.add(keyName);
}
// check keys
List keys = axisSubset.getKey();
int[] bands = new int[keys.size()];
for (int j = 0; j < bands.length; j++) {
final String key = (String) keys.get(j);
String parsedKey = null;
for (String dimensionName : dimensionMap) {
if (dimensionName.equalsIgnoreCase(key)) {
parsedKey = dimensionName;
break;
}
}
if (parsedKey == null)
throw new WcsException("Unknown field/axis/key combination " + fieldId + "/"
+ axisSubset.getIdentifier() + "/" + key, InvalidParameterValue,
"RangeSubset");
else
keys.set(j, parsedKey);
}
}