/** * Get the coordinate edges for the ith coordinate. * Can use this for isContiguous() true or false. * * @param i coordinate index * @return double[2] edges for ith coordinate */ public double[] getCoordEdges(int i) { if (!wasBoundsDone) makeBounds(); if (!isContiguous()) makeBoundsFromEdges(); double[] e = new double[2]; if (isContiguous()) { e[0] = getCoordEdge(i); e[1] = getCoordEdge(i + 1); } else { e[0] = bound1[i]; e[1] = bound2[i]; } return e; }
/** * Get the coordinate bounds for the ith coordinate. * Can use this for isContiguous() true or false. * * @param i coordinate index * @return double[2] edges for ith coordinate */ public double[] getCoordBounds(int i) { if (!wasBoundsDone) makeBounds(); double[] e = new double[2]; if (isContiguous()) { e[0] = getCoordEdge(i); e[1] = getCoordEdge(i + 1); } else { e[0] = bound1[i]; e[1] = bound2[i]; } return e; }
/** * Get the coordinate bounds for the ith coordinate. * Can use this for isContiguous() true or false. * * @param i coordinate index * @return double[2] edges for ith coordinate */ public double[] getCoordBounds(int i) { if (!wasBoundsDone) makeBounds(); double[] e = new double[2]; if (isContiguous()) { e[0] = getCoordEdge(i); e[1] = getCoordEdge(i + 1); } else { e[0] = bound1[i]; e[1] = bound2[i]; } return e; }
/** * Given a coordinate position, find what grid element contains it, or is closest to it. * * @param coordVal position in this coordinate system * @return index of grid point containing it, or best estimate of closest grid interval. */ public int findCoordElementBounded(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElementBounded() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, true); if (isContiguous()) return findCoordElementIrregular(coordVal, true); else return findCoordElementNonContiguous(coordVal, true); }
/** * Given a coordinate position, find what grid element contains it, or is closest to it. * * @param coordVal position in this coordinate system * @return index of grid point containing it, or best estimate of closest grid interval. */ public int findCoordElementBounded(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElementBounded() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, true); if (isContiguous()) return findCoordElementIrregular(coordVal, true); else return findCoordElementNonContiguous(coordVal, true); }
/** * Given a coordinate position, find what grid element contains it. * This means that * <pre> * edge[i] <= pos < edge[i+1] (if values are ascending) * edge[i] > pos >= edge[i+1] (if values are descending) * </pre> * * @param coordVal position in this coordinate system * @return index of grid point containing it, or -1 if outside grid area */ public int findCoordElement(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElement() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, false); if (isContiguous()) return findCoordElementIrregular(coordVal, false); else return findCoordElementNonContiguous(coordVal, false); }
/** * Given a coordinate position, find what grid element contains it. * This means that * <pre> * edge[i] <= pos < edge[i+1] (if values are ascending) * edge[i] > pos >= edge[i+1] (if values are descending) * </pre> * * @param coordVal position in this coordinate system * @return index of grid point containing it, or -1 if outside grid area */ public int findCoordElement(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElement() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, false); if (isContiguous()) return findCoordElementIrregular(coordVal, false); else return findCoordElementNonContiguous(coordVal, false); }
/** * Given a coordinate value, find what grid element contains it. * This means that * <pre> * edge[i] <= value < edge[i+1] (if values are ascending) * edge[i] > value >= edge[i+1] (if values are descending) * </pre> * * @param coordVal position in this coordinate system * @return index of grid point containing it, or -1 if outside grid area */ public int findCoordElement(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElement() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, false); if (isContiguous()) return findCoordElementIrregular(coordVal, false); else return findCoordElementNonContiguous(coordVal, false); }
/** * Given a coordinate position, find what grid element contains it, or is closest to it. * * @param coordVal position in this coordinate system * @return index of grid point containing it, or best estimate of closest grid interval. */ public int findCoordElementBounded(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElementBounded() on non-numeric"); // the scalar or len-1 case: if (this.getSize() == 1) return 0; if (isRegular()) return findCoordElementRegular(coordVal, true); if (isContiguous()) return findCoordElementIrregular(coordVal, true); else return findCoordElementNonContiguous(coordVal, true); }
static void showVertCoords(String datasetName, String defName) throws IOException { System.out.println("--------------------------------------"); System.out.println(defName); FmrcDefinition fmrDef = new FmrcDefinition(); fmrDef.readDefinitionXML(defName); /* List vtList = fmrDef.vertTimeCoords; for (int i = 0; i < vtList.size(); i++) { VertTimeCoord vtc = (VertTimeCoord) vtList.get(i); System.out.println(" "+vtc.getName()); } */ System.out.println(datasetName); ForecastModelRunInventory fmrInv = ForecastModelRunInventory.open(null, datasetName, ForecastModelRunInventory.OPEN_FORCE_NEW, true); List<ForecastModelRunInventory.VertCoord> vcList = fmrInv.getVertCoords(); for (ForecastModelRunInventory.VertCoord vc : vcList) { CoordinateAxis1D axis = vc.axis; if (axis == null) System.out.println(" No Axis " + vc.getName()); else { if (axis.isInterval()) { System.out.println(" Layer " + vc.getName() + " contig= " + axis.isContiguous()); // see if theres any TimeCoord that use this findGridsForVertCoord(fmrDef, vc); } } boolean got = fmrDef.findVertCoordByName(vc.getName()) != null; if (!got) System.out.println(" ***NOT " + vc.getName()); } }
if (showState) System.out.print(" " + vc.getName() + " contig= " + axis.isContiguous());
if (axis1D.isContiguous()) { double[] edge = axis1D.getCoordEdges(); System.out.printf("%s bounded=%s", varName, bounded);