protected void findCoordinateAxes(NetcdfDataset ds) {
for (VarProcess vp : varList) {
if (vp.isCoordinateVariable) continue;
Variable ncvar = vp.v;
if (!(ncvar instanceof VariableDS)) continue; // cant be a structure
String dimName = findAlias(ds, ncvar);
if (dimName.length() == 0) // none
continue;
Dimension dim = ds.findDimension(dimName);
if (null != dim) {
vp.isCoordinateAxis = true;
parseInfo.format(" Coordinate Axis added (alias) = %s for dimension %s\n", vp.v.getFullName(), dimName);
}
}
// coordinates is an alias for _CoordinateAxes
for (VarProcess vp : varList) {
if (vp.coordAxes == null) { // dont override if already set
String coordsString = ds.findAttValueIgnoreCase(vp.v, "coordinates", null);
if (coordsString != null) {
vp.coordinates = coordsString;
}
}
}
super.findCoordinateAxes(ds);
/////////////////////////
// now we start forcing
HashMap<AxisType, VarProcess> map = new HashMap<AxisType, VarProcess>();
// find existing axes, so we dont duplicate
for (VarProcess vp : varList) {
if (vp.isCoordinateAxis) {
AxisType atype = getAxisType(ds, (VariableEnhanced) vp.v);
if (atype != null)
map.put(atype, vp);
}
}
// look for time axes based on units
if (map.get(AxisType.Time) == null) {
for (VarProcess vp : varList) {
Variable ncvar = vp.v;
if (!(ncvar instanceof VariableDS)) continue; // cant be a structure
String unit = ncvar.getUnitsString();
if (SimpleUnit.isDateUnit(unit)) {
vp.isCoordinateAxis = true;
map.put(AxisType.Time, vp);
parseInfo.format(" Time Coordinate Axis added (unit) = %s from unit %s\n", vp.v.getFullName(), unit);
//break; // allow multiple time coords
}
}
}
// look for missing axes by using name hueristics
for (VarProcess vp : varList) {
if (vp.isCoordinateVariable) continue;
Variable ncvar = vp.v;
if (!(ncvar instanceof VariableDS)) continue; // cant be a structure
AxisType atype = getAxisType(ds, (VariableEnhanced) vp.v);
if (atype != null) {
if (map.get(atype) == null) {