/** * Create a new GridVertCoord for a layer * * @param record layer record * @param levelName name of this level * @param lookup lookup table * @param level1 level 1 * @param level2 level 2 */ GridVertCoord( GridRecord record, String levelName, GridTableLookup lookup, double[] level1, double[] level2) { this.typicalRecord = record; this.levelName = levelName; this.lookup = lookup; // dontUseVertical = !lookup.isVerticalCoordinate(record); positive = lookup.isPositiveUp(record) ? "up" : "down"; units = lookup.getLevelUnit(record); usesBounds = lookup.isLayer(this.typicalRecord); levels = new ArrayList<LevelCoord>(level1.length); for (int i = 0; i < level1.length; i++) { levels.add(new LevelCoord(level1[i], (level2 == null) ? 0.0 : level2[i])); } Collections.sort(levels); if (positive.equals("down")) { Collections.reverse(levels); } dontUseVertical = (levels.size() == 1); }
/** * Create a new GridVertCoord with the appropriate params * * @param records list of GridRecords that make up this coord * @param levelName the name of the level * @param lookup the lookup table * @param hcs Horizontal coordinate */ GridVertCoord( List<GridRecord> records, String levelName, GridTableLookup lookup, GridHorizCoordSys hcs) { this.typicalRecord = records.get(0); this.levelName = levelName; this.lookup = lookup; dontUseVertical = !lookup.isVerticalCoordinate(typicalRecord); positive = lookup.isPositiveUp(typicalRecord) ? "up" : "down"; units = lookup.getLevelUnit(typicalRecord); usesBounds = lookup.isLayer(this.typicalRecord); addLevels(records); if (typicalRecord.getLevelType1() == 109 && lookup instanceof Grib1GridTableLookup) checkForPressureLevels(records, hcs); if (GridServiceProvider.debugVert) { System.out.println( "GribVertCoord: " + getVariableName() + "(" + typicalRecord.getLevelType1() + ") useVertical= " + (!dontUseVertical) + " positive=" + positive + " units=" + units); } }