@Override public CoordinateAxis2D getLonAxis() { return (CoordinateAxis2D) cs.getLonAxis(); }
@Override public CoordinateAxis2D getLonAxis() { return (CoordinateAxis2D) cs.getLonAxis(); }
public double readLongitudeCoord(Variable fromVar, int[] index) throws IOException, InvalidRangeException { CoordinateAxis axis = cs.getLonAxis(); if (null == axis) throw new IllegalArgumentException("There is no longiude coordinate"); return readValue( axis, fromVar, index); }
public double readLongitudeCoord(Variable fromVar, int[] index) throws IOException, InvalidRangeException { CoordinateAxis axis = cs.getLonAxis(); if (null == axis) throw new IllegalArgumentException("There is no longiude coordinate"); return readValue( axis, fromVar, index); }
@Override public CoordinateAxis getXHorizAxis() { return cs.isLatLon() ? cs.getLonAxis() : cs.getXaxis(); }
@Override public CoordinateAxis getXHorizAxis() { return cs.isLatLon() ? cs.getLonAxis() : cs.getXaxis(); }
static private boolean isGrid(java.util.List<CoordinateSystem> csysList) { CoordinateSystem use = null; for (CoordinateSystem csys : csysList) { if (use == null) use = csys; else if (csys.getCoordinateAxes().size() > use.getCoordinateAxes().size()) use = csys; } if (use == null) return false; CoordinateAxis lat = use.getLatAxis(); CoordinateAxis lon = use.getLonAxis(); if ((lat != null) && (lat.getSize() <= 1)) return false; // COARDS singletons if ((lon != null) && (lon.getSize() <= 1)) return false; // hueristics - cant say i like this, multidim point features could easily violate return (use.getRankDomain() > 2) && (use.getRankDomain() <= use.getRankRange()); }
static private boolean isGrid(java.util.List<CoordinateSystem> csysList) { CoordinateSystem use = null; for (CoordinateSystem csys : csysList) { if (use == null) use = csys; else if (csys.getCoordinateAxes().size() > use.getCoordinateAxes().size()) use = csys; } if (use == null) return false; CoordinateAxis lat = use.getLatAxis(); CoordinateAxis lon = use.getLonAxis(); if ((lat != null) && (lat.getSize() <= 1)) return false; // COARDS singletons if ((lon != null) && (lon.getSize() <= 1)) return false; // hueristics - cant say i like this, multidim point features could easily violate return (use.getRankDomain() > 2) && (use.getRankDomain() <= use.getRankRange()); }
public static Document genCoordRefSysAsGML( ucar.nc2.dataset.CoordinateSystem coordSys ) { if ( coordSys == null ) throw new IllegalArgumentException( "CoordinateSystem must be non-null."); if ( ! coordSys.isGeoReferencing()) throw new IllegalArgumentException( "CoordinateSystem must be a georeferencing CS."); /*Element xyCrsElem; if ( coordSys.isGeoXY()) { xyCrsElem = genProjectedCRS( coordSys.getProjection()); } */ if ( !coordSys.isGeoXY()) { coordSys.getLatAxis(); coordSys.getLonAxis(); } Element rootElem = new Element( "CompoundCRS", gmlNS ); rootElem.addContent( "" ); rootElem.addNamespaceDeclaration( gmlNS ); rootElem.addNamespaceDeclaration( xlinkNS ); // rootElem.setAttribute( "version", this.getVersion() ); return new Document( rootElem ); }
private boolean isSwath(java.util.List<CoordinateSystem> csysList) { CoordinateSystem use = null; for (CoordinateSystem csys : csysList) { if (use == null) use = csys; else if (csys.getCoordinateAxes().size() > use.getCoordinateAxes().size()) use = csys; } if (use == null) return false; CoordinateAxis lat = use.getLatAxis(); CoordinateAxis lon = use.getLonAxis(); CoordinateAxis time = use.getTaxis(); if ((lat == null) || (lat.getRank() != 2)) return false; if ((lon == null) || (lon.getRank() != 2)) return false; if ((time == null)) return false; // must have time - otherwise it can be a grid // lat/lon must have the same dimensions if (!lat.getDimension(0).equals(lon.getDimension(0))) return false; if (!lat.getDimension(1).equals(lon.getDimension(1))) return false; Set<Dimension> dims = new HashSet<Dimension>(10); for (Dimension d : lat.getDimensions()) dims.add(d); for (Dimension d : lon.getDimensions()) dims.add(d); // diff with grid - time dimension(s) are a subset of lat/lon dimensions for (Dimension d : time.getDimensions()) { if (!dims.contains(d)) return false; } return true; }
private boolean isSwath(java.util.List<CoordinateSystem> csysList) { CoordinateSystem use = null; for (CoordinateSystem csys : csysList) { if (use == null) use = csys; else if (csys.getCoordinateAxes().size() > use.getCoordinateAxes().size()) use = csys; } if (use == null) return false; CoordinateAxis lat = use.getLatAxis(); CoordinateAxis lon = use.getLonAxis(); CoordinateAxis time = use.getTaxis(); if ((lat == null) || (lat.getRank() != 2)) return false; if ((lon == null) || (lon.getRank() != 2)) return false; if ((time == null)) return false; // must have time - otherwise it can be a grid // lat/lon must have the same dimensions if (!lat.getDimension(0).equals(lon.getDimension(0))) return false; if (!lat.getDimension(1).equals(lon.getDimension(1))) return false; Set<Dimension> dims = new HashSet<Dimension>(10); for (Dimension d : lat.getDimensions()) dims.add(d); for (Dimension d : lon.getDimensions()) dims.add(d); // diff with grid - time dimension(s) are a subset of lat/lon dimensions for (Dimension d : time.getDimensions()) { if (!dims.contains(d)) return false; } return true; }
public static Document genCoordRefSysAsGML( ucar.nc2.dataset.CoordinateSystem coordSys ) { if ( coordSys == null ) throw new IllegalArgumentException( "CoordinateSystem must be non-null."); if ( ! coordSys.isGeoReferencing()) throw new IllegalArgumentException( "CoordinateSystem must be a georeferencing CS."); Element xyCrsElem; if ( coordSys.isGeoXY()) { xyCrsElem = genProjectedCRS( coordSys.getProjection()); } else { coordSys.getLatAxis(); coordSys.getLonAxis(); } Element rootElem = new Element( "CompoundCRS", gmlNS ); rootElem.addContent( "" ); rootElem.addNamespaceDeclaration( gmlNS ); rootElem.addNamespaceDeclaration( xlinkNS ); // rootElem.setAttribute( "version", this.getVersion() ); return new Document( rootElem ); }
horizXaxis = lonAxis = cs.getLonAxis(); horizYaxis = latAxis = cs.getLatAxis(); isLatLon = true;
horizXaxis = lonAxis = cs.getLonAxis(); horizYaxis = latAxis = cs.getLatAxis(); isLatLon = true;
horizXaxis = lonAxis = cs.getLonAxis(); horizYaxis = latAxis = cs.getLatAxis(); isLatLon = true;
xaxis = cs.getLonAxis(); yaxis = cs.getLatAxis();
xaxis = cs.getLonAxis(); yaxis = cs.getLatAxis(); isLatLon = true;
public CoordinateTransform makeCoordinateTransform (NetcdfDataset ds, Variable v) { VerticalCT.Type type = VerticalCT.Type.WRFEta; VerticalCT ct = new VerticalCT(type.toString(), getTransformName(), type, this); ct.addParameter(new Parameter("height formula", "height(x,y,z) = (PH(x,y,z) + PHB(x,y,z)) / 9.81")); ct.addParameter(new Parameter(WRFEta.PerturbationGeopotentialVariable, "PH")); ct.addParameter(new Parameter(WRFEta.BaseGeopotentialVariable, "PHB")); ct.addParameter(new Parameter("pressure formula", "pressure(x,y,z) = P(x,y,z) + PB(x,y,z)")); ct.addParameter(new Parameter(WRFEta.PerturbationPressureVariable, "P")); ct.addParameter(new Parameter(WRFEta.BasePressureVariable, "PB")); if (cs.getXaxis() != null) ct.addParameter(new Parameter(WRFEta.IsStaggeredX, ""+isStaggered(cs.getXaxis()))); else ct.addParameter(new Parameter(WRFEta.IsStaggeredX, ""+isStaggered2(cs.getLonAxis(), 1))); if (cs.getYaxis() != null) ct.addParameter(new Parameter(WRFEta.IsStaggeredY, ""+isStaggered(cs.getYaxis()))); else ct.addParameter(new Parameter(WRFEta.IsStaggeredY, ""+isStaggered2(cs.getLonAxis(), 0))); ct.addParameter(new Parameter(WRFEta.IsStaggeredZ, ""+isStaggered(cs.getZaxis()))); ct.addParameter(new Parameter("eta", ""+cs.getZaxis().getFullName())); return ct; }
public CoordinateTransform makeCoordinateTransform (NetcdfDataset ds, Variable v) { VerticalCT.Type type = VerticalCT.Type.WRFEta; VerticalCT ct = new VerticalCT(type.toString(), getTransformName(), type, this); ct.addParameter(new Parameter("height formula", "height(x,y,z) = (PH(x,y,z) + PHB(x,y,z)) / 9.81")); ct.addParameter(new Parameter(WRFEta.PerturbationGeopotentialVariable, "PH")); ct.addParameter(new Parameter(WRFEta.BaseGeopotentialVariable, "PHB")); ct.addParameter(new Parameter("pressure formula", "pressure(x,y,z) = P(x,y,z) + PB(x,y,z)")); ct.addParameter(new Parameter(WRFEta.PerturbationPressureVariable, "P")); ct.addParameter(new Parameter(WRFEta.BasePressureVariable, "PB")); if (cs.getXaxis() != null) ct.addParameter(new Parameter(WRFEta.IsStaggeredX, ""+isStaggered(cs.getXaxis()))); else ct.addParameter(new Parameter(WRFEta.IsStaggeredX, ""+isStaggered2(cs.getLonAxis(), 1))); if (cs.getYaxis() != null) ct.addParameter(new Parameter(WRFEta.IsStaggeredY, ""+isStaggered(cs.getYaxis()))); else ct.addParameter(new Parameter(WRFEta.IsStaggeredY, ""+isStaggered2(cs.getLonAxis(), 0))); ct.addParameter(new Parameter(WRFEta.IsStaggeredZ, ""+isStaggered(cs.getZaxis()))); ct.addParameter(new Parameter("eta", ""+cs.getZaxis().getFullName())); return ct; }
public VerticalCT makeCoordinateTransform(NetcdfDataset ds, AttributeContainer v) { VerticalCT.Type type = VerticalCT.Type.WRFEta; VerticalCT ct = new VerticalCT(type.toString(), getTransformName(), type, this); ct.addParameter(new Parameter("height formula", "height(x,y,z) = (PH(x,y,z) + PHB(x,y,z)) / 9.81")); ct.addParameter(new Parameter(WRFEta.PerturbationGeopotentialVariable, "PH")); ct.addParameter(new Parameter(WRFEta.BaseGeopotentialVariable, "PHB")); ct.addParameter(new Parameter("pressure formula", "pressure(x,y,z) = P(x,y,z) + PB(x,y,z)")); ct.addParameter(new Parameter(WRFEta.PerturbationPressureVariable, "P")); ct.addParameter(new Parameter(WRFEta.BasePressureVariable, "PB")); if (cs.getXaxis() != null) ct.addParameter(new Parameter(WRFEta.IsStaggeredX, "" + isStaggered(cs.getXaxis()))); else ct.addParameter(new Parameter(WRFEta.IsStaggeredX, "" + isStaggered2(cs.getLonAxis(), 1))); if (cs.getYaxis() != null) ct.addParameter(new Parameter(WRFEta.IsStaggeredY, "" + isStaggered(cs.getYaxis()))); else ct.addParameter(new Parameter(WRFEta.IsStaggeredY, "" + isStaggered2(cs.getLonAxis(), 0))); ct.addParameter(new Parameter(WRFEta.IsStaggeredZ, "" + isStaggered(cs.getZaxis()))); ct.addParameter(new Parameter("eta", "" + cs.getZaxis().getFullName())); return ct; }