static public CoordinateAxis findCoordByType(List<CoordinateAxis> axes, AxisType atype, Predicate p) { // first look for matching AxisType and "CF axis" attribute for (CoordinateAxis axis : axes) { if (axis.getAxisType() == atype) { Attribute att = axis.findAttribute(CF.AXIS); if (att != null && att.getStringValue().equals(atype.getCFAxisName()) && (p == null || p.match(axis))) return axis; } } // now match on just the AxisType for (CoordinateAxis axis : axes) { if (axis.getAxisType() == atype && (p == null || p.match(axis))) return axis; } return null; }
/** * Look for Axis by Type and test against a predicate * @param ds look in this dataset's "Best" coordinate system. * @param atype look for this type of CoordinateAxis. * @param p match this predicate * @return the found CoordinateAxis, or null if none */ static public CoordinateAxis findCoordByType(NetcdfDataset ds, AxisType atype, Predicate p) { CoordinateSystem use = findBestCoordinateSystem(ds); if (use == null) return null; // try the "best" cs for (CoordinateAxis axis : use.getCoordinateAxes()) { if (axis.getAxisType() == atype) if (p.match(axis)) return axis; } // try all the axes for (CoordinateAxis axis : ds.getCoordinateAxes()) { if (axis.getAxisType() == atype) if (p.match(axis)) return axis; } return null; }
static public CoordinateAxis findCoordByType(List<CoordinateAxis> axes, AxisType atype, Predicate p) { // first search for matching AxisType and "CF axis" attribute for (CoordinateAxis axis : axes) { if (axis.getAxisType() == atype) { Attribute att = axis.findAttribute(CF.AXIS); if (att != null && att.getStringValue().equals(atype.getCFAxisName()) && (p == null || p.match(axis))) return axis; } } // now match on just the AxisType for (CoordinateAxis axis : axes) { if (axis.getAxisType() == atype && (p == null || p.match(axis))) return axis; } return null; }