public CoverageCoordAxis getAxis(String axisName) { return dataset.findCoordAxis(axisName); }
public List<CoverageCoordAxis> getAxes() { List<CoverageCoordAxis> result = new ArrayList<>(); for (String axisName : getAxisNames()) { CoverageCoordAxis axis = dataset.findCoordAxis(axisName); if (axis == null) throw new IllegalStateException("Cant find " + axisName); result.add(axis); } return result; }
@Override protected void setDataset(CoordSysContainer dataset) { if (this.shape != null) return; // set in constructor List<CoverageCoordAxis> dependentAxes = new ArrayList<>(); int[] shape = new int[2]; int count = 0; for (String axisName : dependsOn) { CoverageCoordAxis axis = dataset.findCoordAxis(axisName); if (axis == null) { if (this.shape == null) // ok is hape has already been set throw new IllegalStateException("LatLonAxis2D cant find axis " + axisName); } else { shape[count] = axis.getNcoords(); dependentAxes.add(axis); } } this.shape = shape; }
@Override protected void setDataset(CoordSysContainer dataset) { if (shape != null) throw new RuntimeException("Cant change axis, once dataset is set"); shape = new int[2]; assert dependsOn.size() == 2; CoverageCoordAxis axis1 = dataset.findCoordAxis(dependsOn.get(0)); if (axis1 == null) throw new IllegalStateException("TimeAxis2DSwath cant find axis with name "+dependsOn.get(0)); CoverageCoordAxis axis2 = dataset.findCoordAxis(dependsOn.get(1)); if (axis2 == null) throw new IllegalStateException("TimeAxis2DSwath cant find axis with name "+dependsOn.get(1)); shape[0] = axis1.getNcoords(); shape[1] = axis2.getNcoords(); assert shape[0] * shape[1] == this.getNcoords(); }
@Override protected void setDataset(CoordSysContainer dataset) { if (shape != null) throw new RuntimeException("Cant change axis once set"); shape = new int[2]; String runtimeName = dependsOn.get(0); CoverageCoordAxis runtime = dataset.findCoordAxis(runtimeName); if (runtime == null) throw new IllegalStateException("FmrcTimeAxis2D cant find runtime axis with name "+runtimeName); assert runtime instanceof CoverageCoordAxis1D; assert runtime.getAxisType() == AxisType.RunTime; runCoord = (CoverageCoordAxis1D) runtime; shape[0] = runtime.getNcoords(); shape[1] = ncoords / shape[0]; }
public CoverageCoordAxis getAxis(AxisType type) { for (String axisName : getAxisNames()) { CoverageCoordAxis axis = dataset.findCoordAxis(axisName); if (axis == null) throw new IllegalStateException("Cant find axis with name "+axisName); else if (axis.getAxisType() == type) { return axis; } } return null; }
public CoverageCoordAxis getZAxis() { for (String axisName : getAxisNames()) { CoverageCoordAxis axis = dataset.findCoordAxis(axisName); if (axis == null) throw new IllegalStateException("Cant find axis with name "+axisName); if (axis.getAxisType() == AxisType.GeoZ || axis.getAxisType() == AxisType.Height || axis.getAxisType() == AxisType.Pressure) return axis; } return null; }
if (axis.getDependenceType() == CoverageCoordAxis.DependenceType.dependent) { for (String indAxisName : axis.dependsOn) { CoverageCoordAxis independentAxis = dataset.findCoordAxis(indAxisName); if (independentAxis == null) throw new RuntimeException("Dependent axis " + axis.getName() + " depends on " + indAxisName + " not in Dataset");