@Override public List<CoordinateAxis> getCoordinateAxes() { return cs.getCoordinateAxes(); } }
List<CoordinateAxis> axesSorted = new ArrayList<>(coordinateSystem.getCoordinateAxes()); Collections.sort(axesSorted, AXIS_COMPARATOR); for (CoordinateAxis axis : axesSorted) {
String elevationAttribute = ""; String otherAttributes = ""; for (CoordinateAxis axis : cs.getCoordinateAxes()) {
@Override public List<CoordinateAxis> getCoordinateAxes() { return cs.getCoordinateAxes(); } }
/** * Creates a new {@code NetcdfCRS} object wrapping the given netCDF coordinate system. * The {@link CoordinateSystem#getCoordinateAxes()} is invoked at construction time and * every elements are assumed instances of {@link CoordinateAxis1D}. * * @param netcdfCS the netCDF coordinate system to wrap. * @throws ClassCastException if at least one axis is not an instance of the * {@link CoordinateAxis1D} subclass. */ protected NetcdfCRS(final CoordinateSystem netcdfCS) throws ClassCastException { this(netcdfCS, netcdfCS.getCoordinateAxes()); }
@Override public List<CoordinateAxis> getCoordinateAxes() { return cs.getCoordinateAxes(); } }
public int compare(CoordinateSystem o1, CoordinateSystem o2) { return o2.getCoordinateAxes().size() - o1.getCoordinateAxes().size(); } });
public int compare(CoordinateSystem o1, CoordinateSystem o2) { return o2.getCoordinateAxes().size() - o1.getCoordinateAxes().size() ; } });
public int compare(CoordinateSystem o1, CoordinateSystem o2) { return o2.getCoordinateAxes().size() - o1.getCoordinateAxes().size() ; } });
public int compare(CoordinateSystem o1, CoordinateSystem o2) { return o2.getCoordinateAxes().size() - o1.getCoordinateAxes().size(); } });
/** * Find the CoordinateSystem with the most number of CoordinateAxes * @param ds search in this dataset * @return CoordinateSystem or null if none */ static private CoordinateSystem findBestCoordinateSystem(NetcdfDataset ds) { // find coordinate system with highest rank (largest number of axes) CoordinateSystem use = null; for (CoordinateSystem cs : ds.getCoordinateSystems()) { if (use == null) use = cs; else if (cs.getCoordinateAxes().size() > use.getCoordinateAxes().size()) use = cs; } return use; }
public void setCoordMap(java.util.List<CoordinateSystem> csysList) { CoordinateSystem use = null; for (CoordinateSystem csys : csysList) { if (use == null) use = csys; else if (csys.getCoordinateAxes().size() > use.getCoordinateAxes().size()) use = csys; } coordMap = (use == null) ? "" : "f:D(" + use.getRankDomain() + ")->R(" + use.getRankRange() + ")"; }
public void setCoordMap(java.util.List<CoordinateSystem> csysList) { CoordinateSystem use = null; for (CoordinateSystem csys : csysList) { if (use == null) use = csys; else if (csys.getCoordinateAxes().size() > use.getCoordinateAxes().size()) use = csys; } coordMap = (use == null) ? "" : "f:D(" + use.getRankDomain() + ")->R(" + use.getRankRange() + ")"; }
/** Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; result = 37*result + getName().hashCode(); result = 37*result + getCoordinateAxes().hashCode(); result = 37*result + getCoordinateTransforms().hashCode(); hashCode = result; } return hashCode; } private volatile int hashCode = 0;
/** Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; result = 37*result + getName().hashCode(); result = 37*result + getCoordinateAxes().hashCode(); result = 37*result + getCoordinateTransforms().hashCode(); hashCode = result; } return hashCode; } private volatile int hashCode = 0;
/** Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; result = 37*result + getName().hashCode(); result = 37*result + getCoordinateAxes().hashCode(); result = 37*result + getCoordinateTransforms().hashCode(); hashCode = result; } return hashCode; } private volatile int hashCode = 0;
private boolean compareCoordinateSystem(CoordinateSystem cs1, CoordinateSystem cs2, ObjFilter filter) { if (showCompare) f.format("compare CoordinateSystem '%s' to '%s' %n", cs1.getName(), cs2.getName()); List matchAxes = new ArrayList(); boolean ok = checkAll(cs1.getName(), cs1.getCoordinateAxes(), cs2.getCoordinateAxes(), matchAxes); for (int i = 0; i < matchAxes.size(); i += 2) { CoordinateAxis orgCs = (CoordinateAxis) matchAxes.get(i); CoordinateAxis copyCs = (CoordinateAxis) matchAxes.get(i + 1); ok &= compareCoordinateAxis(orgCs, copyCs, filter); } List matchTransforms = new ArrayList(); ok &= checkAll(cs1.getName(), cs1.getCoordinateTransforms(), cs2.getCoordinateTransforms(), matchTransforms); return ok; }
private boolean compareCoordinateSystem(CoordinateSystem cs1, CoordinateSystem cs2, ObjFilter filter) { if (showCompare) f.format("compare CoordinateSystem '%s' to '%s' %n", cs1.getName(), cs2.getName()); List matchAxes = new ArrayList(); boolean ok = checkAll(cs1.getName(), cs1.getCoordinateAxes(), cs2.getCoordinateAxes(), matchAxes); for (int i = 0; i < matchAxes.size(); i += 2) { CoordinateAxis orgCs = (CoordinateAxis) matchAxes.get(i); CoordinateAxis copyCs = (CoordinateAxis) matchAxes.get(i + 1); ok &= compareCoordinateAxis(orgCs, copyCs, filter); } List matchTransforms = new ArrayList(); ok &= checkAll(cs1.getName(), cs1.getCoordinateTransforms(), cs2.getCoordinateTransforms(), matchTransforms); return ok; }
/** * Look for Axis by Type, assign to TableConfig if found. * Looks for Lat, Lon, Time, Height. * @param nt assign coordinates to this table. * @param ds look in this dataset's "Best" coordinate system. If no CoordSystem, try list of coordinate axes */ static public void findCoords(TableConfig nt, NetcdfDataset ds) { CoordinateSystem use = findBestCoordinateSystem(ds); if (use == null) findCoords(nt, ds.getCoordinateAxes()); else findCoords(nt, use.getCoordinateAxes()); }
private CoordinateSystem findReplacementCs(CoordinateSystem protoCs, String timeDim, NetcdfDataset result) { CoordinateSystem replace = result.findCoordinateSystem(protoCs.getName()); if (replace != null) return replace; List<CoordinateAxis> axes = new ArrayList<>(); for (CoordinateAxis axis : protoCs.getCoordinateAxes()) { CoordinateAxis ra = result.findCoordinateAxis(axis.getFullNameEscaped()); axes.add(ra); } // coord transforms are immutable and can be shared CoordinateSystem cs = new CoordinateSystem(result, axes, protoCs.getCoordinateTransforms()); result.addCoordinateSystem(cs); return cs; }