/** * @param binding * @param coordinateAxis */ public NumericCoordinateVariable(Class<T> binding, CoordinateAxis coordinateAxis) { super(binding, coordinateAxis); // If the axis is not numeric, we can't process any further. if (!coordinateAxis.isNumeric()) { throw new IllegalArgumentException( "Unable to process non numeric coordinate variable: " + coordinateAxis.toString()); } // scale and offset Attribute scaleFactor = coordinateAxis.findAttribute("scale_factor"); if (scaleFactor != null) { this.scaleFactor = scaleFactor.getNumericValue().doubleValue(); } Attribute offsetFactor = coordinateAxis.findAttribute("offset"); if (offsetFactor != null) { this.offsetFactor = offsetFactor.getNumericValue().doubleValue(); } // converter from double to binding this.converter = CONVERTER_FACTORY.createConverter(Double.class, this.binding, null); init(); }
Attribute scaleFactor = coordinateAxis.findAttribute("scale_factor"); Attribute offsetFactor = coordinateAxis.findAttribute("offset"); if (scaleFactor != null || offsetFactor != null) { return Double.class;
origin = unitsParts[1].trim(); } else { final Attribute attribute = coordinateAxis.findAttribute("time_origin"); if (attribute != null) { origin = attribute.getStringValue();
origin = unitsParts[1].trim(); } else { final Attribute attribute = timeAxis.findAttribute("time_origin"); if (attribute != null) { origin = attribute.getStringValue();
public boolean match(CoordinateAxis axis) { Attribute stdName = axis.findAttribute(CF.STANDARD_NAME); return ((stdName == null) || !CF.STATION_ALTITUDE.equals(stdName.getStringValue())); } });
@Override public boolean match(CoordinateAxis axis) { Attribute stdName = axis.findAttribute(CF.STANDARD_NAME); if (stdName == null) return true; String val = stdName.getStringValue(); return !CF.SURFACE_ALTITUDE.equals(val) && !CF.STATION_ALTITUDE.equals(val); } }
public boolean match(CoordinateAxis axis) { Attribute stdName = axis.findAttribute(CF.STANDARD_NAME); return ((stdName == null) || !CF.STATION_ALTITUDE.equals(stdName.getStringValue())); } });
public boolean match(CoordinateAxis axis) { Attribute stdName = axis.findAttribute(CF.STANDARD_NAME); return ((stdName == null) || !CF.STATION_ALTITUDE.equals(stdName.getStringValue())); } });
@Override public boolean match(CoordinateAxis axis) { Attribute stdName = axis.findAttribute(CF.STANDARD_NAME); if (stdName == null) return true; String val = stdName.getStringValue(); return !CF.SURFACE_ALTITUDE.equals(val) && !CF.STATION_ALTITUDE.equals(val); } }
public boolean isIndependentCoordinate() { if (isCoordinateVariable()) return true; return null != findAttribute(_Coordinate.AliasForDimension); }
/** * @param binding * @param coordinateAxis */ public NumericCoordinateVariable(Class<T> binding, CoordinateAxis coordinateAxis) { super(binding, coordinateAxis); // If the axis is not numeric, we can't process any further. if (!coordinateAxis.isNumeric()) { throw new IllegalArgumentException( "Unable to process non numeric coordinate variable: " + coordinateAxis.toString()); } // scale and offset Attribute scaleFactor = coordinateAxis.findAttribute("scale_factor"); if (scaleFactor != null) { this.scaleFactor = scaleFactor.getNumericValue().doubleValue(); } Attribute offsetFactor = coordinateAxis.findAttribute("offset"); if (offsetFactor != null) { this.offsetFactor = offsetFactor.getNumericValue().doubleValue(); } // converter from double to binding this.converter = CONVERTER_FACTORY.createConverter(Double.class, this.binding, null); init(); }
Attribute scaleFactor = coordinateAxis.findAttribute("scale_factor"); Attribute offsetFactor = coordinateAxis.findAttribute("offset"); if (scaleFactor != null || offsetFactor != null) { return Double.class;
static public CoordinateAxis findCoordByType(List<CoordinateAxis> axes, AxisType atype, Predicate p) { // first look for matching AxisType and "CF axis" attribute for (CoordinateAxis axis : axes) { if (axis.getAxisType() == atype) { Attribute att = axis.findAttribute(CF.AXIS); if (att != null && att.getStringValue().equals(atype.getCFAxisName()) && (p == null || p.match(axis))) return axis; } } // now match on just the AxisType for (CoordinateAxis axis : axes) { if (axis.getAxisType() == atype && (p == null || p.match(axis))) return axis; } return null; }
static public CoordinateAxis findCoordByType(List<CoordinateAxis> axes, AxisType atype, Predicate p) { // first search for matching AxisType and "CF axis" attribute for (CoordinateAxis axis : axes) { if (axis.getAxisType() == atype) { Attribute att = axis.findAttribute(CF.AXIS); if (att != null && att.getStringValue().equals(atype.getCFAxisName()) && (p == null || p.match(axis))) return axis; } } // now match on just the AxisType for (CoordinateAxis axis : axes) { if (axis.getAxisType() == atype && (p == null || p.match(axis))) return axis; } return null; }
origin = unitsParts[1].trim(); } else { final Attribute attribute = coordinateAxis.findAttribute("time_origin"); if (attribute != null) { origin = attribute.getStringValue();
/** * Create a GeoGridCoordSys from an existing Coordinate System. * This will choose which axes are the XHoriz, YHoriz, Vertical, Time, RunTIme, Ensemble. * If theres a Projection, it will set its map area * * @param builder create from this */ public DtCoverageCS(DtCoverageCSBuilder builder) { super(); this.builder = builder; // make name based on coordinate this.name = CoordinateSystem.makeName(builder.allAxes); // WRF NMM Attribute att = getXHorizAxis().findAttribute(_Coordinate.Stagger); if (att != null) setHorizStaggerType(att.getStringValue()); if (builder.orgProj != null) { proj = builder.orgProj.constructCopy(); } }
origin = unitsParts[1].trim(); } else { final Attribute attribute = timeAxis.findAttribute("time_origin"); if (attribute != null) { origin = attribute.getStringValue();
public ucar.nc2.time.Calendar getCalendarFromAttribute() { Attribute cal = findAttribute(CF.CALENDAR); String s = (cal == null) ? null : cal.getStringValue(); if (s == null) { // default for CF and COARDS Attribute convention = (ncd == null) ? null : ncd.getRootGroup().findAttribute(CDM.CONVENTIONS); if (convention != null) { String hasName = convention.getStringValue(); int version = CF1Convention.getVersion(hasName); if (version >= 0) { return Calendar.gregorian; //if (version < 7 ) return Calendar.gregorian; //if (version >= 7 ) return Calendar.proleptic_gregorian; // } if (COARDSConvention.isMine(hasName)) return Calendar.gregorian; } } return ucar.nc2.time.Calendar.get(s); }
protected ucar.nc2.time.Calendar getCalendarFromAttribute() { Attribute cal = findAttribute(CF.CALENDAR); String s = (cal == null) ? null : cal.getStringValue(); if (s == null) { // default for CF and COARDS Attribute convention = (ncd == null) ? null : ncd.getRootGroup().findAttribute(CDM.CONVENTIONS); if (convention != null) { String hasName = convention.getStringValue(); int version = CF1Convention.getVersion(hasName); if (version >= 0) { return Calendar.gregorian; //if (version < 7 ) return Calendar.gregorian; //if (version >= 7 ) return Calendar.proleptic_gregorian; // } if (COARDSConvention.isMine(hasName)) return Calendar.gregorian; } } return ucar.nc2.time.Calendar.get(s); }
/** * Look for Axis by Type. * @param ds look in this dataset's "Best" coordinate system. * @param atype look for this type of CoordinateAxis. takes the first one it finds. * @return the found CoordinateAxis, or null if none */ static public CoordinateAxis findCoordByType(NetcdfDataset ds, AxisType atype) { CoordinateSystem use = findBestCoordinateSystem(ds); if (use != null) { // first look for matching AxisType and "CF axis" attribute for (CoordinateAxis axis : use.getCoordinateAxes()) { if (axis.getAxisType() == atype) { Attribute att = axis.findAttribute(CF.AXIS); if (att != null && att.getStringValue().equals(atype.getCFAxisName())) return axis; } } // now match on just the AxisType for (CoordinateAxis axis : use.getCoordinateAxes()) { if (axis.getAxisType() == atype) return axis; } } // try all the axes for (CoordinateAxis axis : ds.getCoordinateAxes()) { if (axis.getAxisType() == atype) return axis; } return null; }