private void showCoords(CoordinateAxis axis, Formatter f) { try { if (axis instanceof CoordinateAxis1D && axis.isNumeric()) { CoordinateAxis1D axis1D = (CoordinateAxis1D) axis; if (!axis1D.isInterval()) { double[] e = axis1D.getCoordEdges(); for (double anE : e) { f.format("%f,", anE); } } else { double[] b1 = axis1D.getBound1(); double[] b2 = axis1D.getBound2(); for (int i = 0; i < b1.length; i++) { f.format("(%f,%f) = %f%n", b1[i], b2[i], b2[i] - b1[i]); } } } else { f.format("%s", NCdumpW.printVariableData(axis, null)); } } catch (IOException ioe) { f.format(ioe.getMessage()); } f.format(" %s%n", axis.getUnitsString()); }
private void showCoords(CoordinateAxis axis, Formatter f) { try { if (axis instanceof CoordinateAxis1D && axis.isNumeric()) { CoordinateAxis1D axis1D = (CoordinateAxis1D) axis; if (!axis1D.isInterval()) { double[] e = axis1D.getCoordEdges(); for (double anE : e) { f.format("%f,", anE); } } else { double[] b1 = axis1D.getBound1(); double[] b2 = axis1D.getBound2(); for (int i=0; i<b1.length; i++) { f.format("(%f,%f) = %f%n", b1[i], b2[i], b2[i] - b1[i]); } } } else { f.format("%s", NCdumpW.printVariableData(axis, null)); } } catch (IOException ioe) { f.format(ioe.getMessage()); } f.format(" %s%n", axis.getUnitsString()); }
private void showCoords(CoordinateAxis axis, Formatter f) { try { if (axis instanceof CoordinateAxis1D && axis.isNumeric()) { CoordinateAxis1D axis1D = (CoordinateAxis1D) axis; if (!axis1D.isInterval()) { double[] e = axis1D.getCoordEdges(); for (double anE : e) { f.format("%f,", anE); } } else { double[] b1 = axis1D.getBound1(); double[] b2 = axis1D.getBound2(); for (int i=0; i<b1.length; i++) { f.format("(%f,%f) = %f%n", b1[i], b2[i], b2[i] - b1[i]); } } } else { f.format("%s", NCdumpW.printVariableData(axis, null)); } } catch (IOException ioe) { f.format(ioe.getMessage()); } f.format(" %s%n", axis.getUnitsString()); }
private void showCoords(CoordinateAxis axis, Formatter f) { try { if (axis instanceof CoordinateAxis1D && axis.isNumeric()) { CoordinateAxis1D axis1D = (CoordinateAxis1D) axis; if (!axis1D.isInterval()) { double[] e = axis1D.getCoordEdges(); for (double anE : e) { f.format("%f,", anE); } } else { double[] b1 = axis1D.getBound1(); double[] b2 = axis1D.getBound2(); for (int i=0; i<b1.length; i++) { f.format("(%f,%f) = %f%n", b1[i], b2[i], b2[i] - b1[i]); } } } else { f.format("%s", NCdumpW.printVariableData(axis, null)); } } catch (IOException ioe) { f.format(ioe.getMessage()); } f.format(" %s%n", axis.getUnitsString()); }
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()); } }
VertCoord(CoordinateAxis1D axis) { // this.axis = axis; this.name = axis.getFullName(); this.units = axis.getUnitsString(); int n = (int) axis.getSize(); if (axis.isInterval()) { values1 = axis.getBound1(); values2 = axis.getBound2(); } else { values1 = new double[n]; for (int i = 0; i < axis.getSize(); i++) values1[i] = axis.getCoordValue(i); } }
VertCoord(CoordinateAxis1D axis) { this.axis = axis; this.name = axis.getFullName(); this.units = axis.getUnitsString(); int n = (int) axis.getSize(); if (axis.isInterval()) { values1 = axis.getBound1(); values2 = axis.getBound2(); } else { values1 = new double[n]; for (int i = 0; i < axis.getSize(); i++) values1[i] = axis.getCoordValue(i); } }
VertCoord(CoordinateAxis1D axis) { // this.axis = axis; this.name = axis.getFullName(); this.units = axis.getUnitsString(); int n = (int) axis.getSize(); if (axis.isInterval()) { values1 = axis.getBound1(); values2 = axis.getBound2(); } else { values1 = new double[n]; for (int i = 0; i < axis.getSize(); i++) values1[i] = axis.getCoordValue(i); } }
VertCoord(CoordinateAxis1D axis) { // this.axis = axis; this.name = axis.getFullName(); this.units = axis.getUnitsString(); int n = (int) axis.getSize(); if (axis.isInterval()) { values1 = axis.getBound1(); values2 = axis.getBound2(); } else { values1 = new double[n]; for (int i = 0; i < axis.getSize(); i++) values1[i] = axis.getCoordValue(i); } }
static void readAllVertLevels(Coverage cover, GridDatatype dt, CalendarDate rt_val, int rt_idx, CalendarDate time_val, int time_idx, double ens_val, int ens_idx, CoordinateAxis1D vertAxis) { if (vertAxis == null) readOneSlice(cover, dt, rt_val, rt_idx, time_val, time_idx, ens_val, ens_idx, 0, -1); else { for (int i = 0; i < vertAxis.getSize(); i++) { double levVal = vertAxis.isInterval() ? vertAxis.getCoordBoundsMidpoint(i) : vertAxis.getCoordValue(i); readOneSlice(cover, dt, rt_val, rt_idx, time_val, time_idx, ens_val, ens_idx, levVal, i); } } }
/** * Copy constructor * @param ncd ok to reparent * @param org copy from here */ CoordinateAxis1D(NetcdfDataset ncd, CoordinateAxis1D org) { super(ncd, org); this.orgName = org.orgName; this.cache = new Variable.Cache(); // decouple cache org.setCaching(true); // copy rest of state this.increment = org.getIncrement(); this.isAscending = org.isAscending; this.isInterval = org.isInterval(); this.isRegular = org.isRegular(); this.coords = org.getCoordValues(); this.edge = org.getCoordEdges(); this.names = org.names; if (isInterval) { this.bound1 = org.getBound1(); this.bound2 = org.getBound2(); } this.wasBoundsDone = org.wasBoundsDone; this.wasCalcRegular = org.wasCalcRegular; this.wasRead = org.wasRead; }
/** * Copy constructor * * @param ncd ok to reparent * @param org copy from here */ CoordinateAxis1D(NetcdfDataset ncd, CoordinateAxis1D org) { super(ncd, org); this.orgName = org.orgName; this.cache = new Variable.Cache(); // decouple cache org.setCaching(true); // copy rest of state this.increment = org.getIncrement(); this.isAscending = org.isAscending; this.isInterval = org.isInterval(); this.isRegular = org.isRegular(); if (isNumeric()) { this.coords = org.getCoordValues(); this.edge = org.getCoordEdges(); } this.names = org.names; if (isInterval) { this.bound1 = org.getBound1(); this.bound2 = org.getBound2(); } this.wasBoundsDone = org.wasBoundsDone; this.wasCalcRegular = org.wasCalcRegular; this.wasRead = org.wasRead; }
if (axis.isInterval()) { for (int i = 0; i < axis.getSize(); i++) { double[] bound = axis.getCoordBounds(i);
private void readVert(GridDatatype gdt, int rtIndex, int tIndex, Dimension zDim) throws IOException { if (zDim != null) { CoordinateAxis1D zcoord = gdc.getVerticalAxis(); boolean isLayer = zcoord.isInterval(); for (int z = 0; z < zDim.getLength(); z++) { if (isLayer) { dtCoords.setVertCoordIntv(zcoord.getCoordBounds(z)); } else { dtCoords.setVertCoord(zcoord.getCoordValue(z)); } readAndTestGrib(gdt, rtIndex, tIndex, z); } } else { readAndTestGrib(gdt, rtIndex, tIndex, -1); } }