Set<String> unsupported = NetCDFUtilities.getUnsupportedDimensions(); Set<String> ignored = NetCDFUtilities.getIgnoredDimensions(); for (CoordinateAxis axis : dataset.getCoordinateAxes()) { final int axisDimensions = axis.getDimensions().size(); if (axisDimensions > 0 && axisDimensions < 3) {
public void showCoordAxes(java.util.Formatter sf) { sf.format("\nAxes\n"); for (CoordinateAxis axis : ds.getCoordinateAxes()) { sf.format(" %s %s\n", axis.getAxisType(), axis.getNameAndDimensions()); } }
protected void setTimeUnits() throws Exception { List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ncd.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ncd.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ncd.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); calDateUnits = CalendarDateUnit.of(null, units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); calDateUnits = CalendarDateUnit.of(null, units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); calDateUnits = CalendarDateUnit.of(null, units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); calDateUnits = CalendarDateUnit.of(null, units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); calDateUnits = CalendarDateUnit.of(null, units); return; } } parseInfo.append("*** Time Units not Found\n"); }
protected void setTimeUnits() throws Exception { List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Time) { String units = axis.getUnitsString(); dateUnits = new DateUnit(units); calDateUnits = CalendarDateUnit.of(null, units); return; } } parseInfo.append("*** Time Units not Found\n"); }
/** * 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()); }
static public PointObsDataset factory(NetcdfDataset ds) throws IOException { Variable latVar = null, timeVar = null; // identify key variables List axes = ds.getCoordinateAxes(); for (int i = 0; i < axes.size(); i++) { CoordinateAxis axis = (CoordinateAxis) axes.get(i); if (axis.getAxisType() == AxisType.Lat) latVar = axis; if (axis.getAxisType() == AxisType.Time) timeVar = axis; } // lat, lon are always in the outer; gotta use name to fetch wrapping variable Structure outerSequence = getWrappingParent(ds, latVar); // depth may be in inner or outer boolean isProfile = getWrappingParent(ds, timeVar) == outerSequence; if (isProfile) return new DapperPointDataset( ds); else return new DapperStationDataset( ds); }
/** * Look for Axis by Type and test against a predicate * @param ds look in this dataset's "Best" coordinate system. * @param atype look for this type of CoordinateAxis. * @param p match this predicate; may be null * @return the found CoordinateAxis, or null if none */ static public CoordinateAxis findCoordByType(NetcdfDataset ds, AxisType atype, Predicate p) { // try the "best" coordinate system CoordinateSystem use = findBestCoordinateSystem(ds); if (use == null) return null; CoordinateAxis result = findCoordByType(use.getCoordinateAxes(), atype, p); if (result != null) return result; // try all the axes return findCoordByType(ds.getCoordinateAxes(), atype, p); }
/** * search for Axis by Type and test against a predicate * @param ds search in this dataset's "Best" coordinate system. * @param atype search for this type of CoordinateAxis. * @param p match this predicate; may be null * @return the found CoordinateAxis, or null if none */ static public CoordinateAxis findCoordByType(NetcdfDataset ds, AxisType atype, Predicate p) { // try the "best" coordinate system CoordinateSystem use = findBestCoordinateSystem(ds); if (use == null) return null; CoordinateAxis result = findCoordByType(use.getCoordinateAxes(), atype, p); if (result != null) return result; // try all the axes return findCoordByType(ds.getCoordinateAxes(), atype, p); }
static public String getGeoCoordinateUnits(NetcdfDataset ds, AttributeContainer ctv) { String units = ctv.findAttValueIgnoreCase(CDM.UNITS, null); if (units == null) { List<CoordinateAxis> axes = ds.getCoordinateAxes(); for (CoordinateAxis axis : axes) { if (axis.getAxisType() == AxisType.GeoX) { // kludge - what if there's multiple ones? Variable v = axis.getOriginalVariable(); // LOOK why original variable ? units = (v == null) ? axis.getUnitsString() : v.getUnitsString(); break; } } } return units; }
static public double getFalseEastingScaleFactor(NetcdfDataset ds, Variable ctv) { String units = ds.findAttValueIgnoreCase(ctv, CDM.UNITS, null); if (units == null) { List<CoordinateAxis> axes = ds.getCoordinateAxes(); for (CoordinateAxis axis : axes) { if (axis.getAxisType() == AxisType.GeoX) { // kludge - what if there's multiple ones? Variable v = axis.getOriginalVariable(); // LOOK why original variable ? units = v.getUnitsString(); break; } } } if (units != null) { try { SimpleUnit unit = SimpleUnit.factoryWithExceptions(units); return unit.convertTo(1.0, SimpleUnit.kmUnit); } catch (Exception e) { log.error(units + " not convertible to km"); } } return 1.0; }