private CoordinateAxis makeXCoordAxis(NetcdfDataset ds, int nx, String xname) { CoordinateAxis v = new CoordinateAxis1D(ds, null, xname, DataType.DOUBLE, xname, "km", "x on projection"); ds.setValues(v, nx, startx, dx); parseInfo.format("Created X Coordinate Axis = "); v.getNameAndDimensions(parseInfo, true, false); parseInfo.format("\n"); if (debugProj) parseInfo.format(" makeXCoordAxis ending x %f nx= %d dx= %f\n",startx + nx * dx, nx, dx); return v; }
private CoordinateAxis makeYCoordAxis( NetcdfDataset ds, int ny, String yname) { CoordinateAxis v = new CoordinateAxis1D( ds, null, yname, DataType.DOUBLE, yname, "km", "y on projection"); ds.setValues( v, ny, starty, dy); parseInfo.format("Created Y Coordinate Axis = "); v.getNameAndDimensions(parseInfo, true, false); parseInfo.format("\n"); if (debugProj) parseInfo.format(" makeYCoordAxis ending y %f ny= %d dy= %f\n",starty + ny * dy, ny, dy); return v; }
private CoordinateAxis makeXCoordAxis(NetcdfDataset ds, int nx, String xname) { CoordinateAxis v = new CoordinateAxis1D(ds, null, xname, DataType.DOUBLE, xname, "km", "x on projection"); v.setValues( nx, startx, dx); parseInfo.format("Created X Coordinate Axis = "); v.getNameAndDimensions(parseInfo, true, false); parseInfo.format("%n"); if (debugProj) parseInfo.format(" makeXCoordAxis ending x %f nx= %d dx= %f%n",startx + nx * dx, nx, dx); return v; }
private CoordinateAxis makeYCoordAxis(NetcdfDataset ds, int ny, String yname) { double dy = findAttributeDouble(ds, "dyKm"); CoordinateAxis v = new CoordinateAxis1D(ds, null, yname, DataType.DOUBLE, yname, "km", "y on projection"); v.setValues(ny, starty, dy); parseInfo.format("Created Y Coordinate Axis = "); v.getNameAndDimensions(parseInfo, true, false); parseInfo.format("%n"); return v; }
private CoordinateAxis makeYCoordAxis(NetcdfDataset ds, int ny, String yname) { double dy = findAttributeDouble(ds, "dyKm"); CoordinateAxis v = new CoordinateAxis1D(ds, null, yname, DataType.DOUBLE, yname, "km", "y on projection"); ds.setValues(v, ny, starty, dy); parseInfo.format("Created Y Coordinate Axis = "); v.getNameAndDimensions(parseInfo, true, false); parseInfo.format("\n"); return v; }
private CoordinateAxis makeCoordAxis(NetcdfDataset ds, String name, String dimName, int n, String startName, String incrName, String unitName) { double start = .001 * findAttributeDouble(ds, startName); // km double incr = .001 * findAttributeDouble(ds, incrName); // km CoordinateAxis v = new CoordinateAxis1D(ds, null, name, DataType.DOUBLE, dimName, unitName, "synthesized coordinate from " + startName + " " + incrName + " global attributes"); v.setValues(n, start, incr); return v; }
private CoordinateAxis makeCoordLLAxis(NetcdfDataset ds, String name, String dimName, int n, String startName, String incrName, String unitName) { // Makes coordinate axes for Lat/Lon double start = findAttributeDouble(ds, startName); // degrees double incr = findAttributeDouble(ds, incrName); // degrees CoordinateAxis v = new CoordinateAxis1D(ds, null, name, DataType.DOUBLE, dimName, unitName, "synthesized coordinate from " + startName + " " + incrName + " global attributes"); v.setValues(n, start, incr); return v; }
private CoordinateAxis makeLonCoordAxis(NetcdfDataset ds, Group g, int n, String dimName) { double incr = 360.0 / n; CoordinateAxis v = new CoordinateAxis1D(ds, g, "lon", DataType.FLOAT, dimName, CDM.LON_UNITS, "longitude"); v.setValues(n, -180.0, incr); v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lon.toString())); return v; }
private CoordinateAxis makeLonCoordAxis(NetcdfDataset ds, Group g, int n, String dimName) { double incr = 360.0 / n; CoordinateAxis v = new CoordinateAxis1D(ds, g, "lon", DataType.FLOAT, dimName, CDM.LON_UNITS, "longitude"); v.setValues(n, -180.0, incr); v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lon.toString())); return v; }
/** * */ private CoordinateAxis makeLatCoordAxis(NetcdfDataset ds, Group g, int n, String dimName) { final double incr = 180.0 / n; final CoordinateAxis v = new CoordinateAxis1D(ds, g, "lat", DataType.FLOAT, dimName, CDM.LAT_UNITS, "latitude"); v.setValues(n, -90.0 + 0.5 * incr, incr); v.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Lat.toString())); return v; }
private CoordinateAxis makeCoordAxis(NetcdfDataset ds, Group g, String name, int n, double start, double end, boolean isX) { CoordinateAxis v = new CoordinateAxis1D(ds, g, name, DataType.DOUBLE, name, "km", isX ? "x coordinate" : "y coordinate"); double incr = (end - start) / n; v.setValues(n, start * .001, incr * .001); // km v.addAttribute(new Attribute(_Coordinate.AxisType, isX ? AxisType.GeoX.toString() : AxisType.GeoY.toString())); return v; }
private CoordinateAxis makeLatLonCoordAxis(NetcdfDataset ds, Group g, int n, double start, double end, boolean isLon) { String name = isLon ? AxisType.Lon.toString() : AxisType.Lat.toString(); String dimName = isLon ? DIMX_NAME : DIMY_NAME; CoordinateAxis v = new CoordinateAxis1D(ds, g, name, DataType.DOUBLE, dimName, isLon ? "degrees_east" : "degrees_north", null); double incr = (end - start) / n; v.setValues(n, start, incr); v.addAttribute(new Attribute(_Coordinate.AxisType, name)); return v; }
CoordinateAxis makeXCoordAxis( NetcdfDataset ds, String xname) { CoordinateAxis v = new CoordinateAxis1D( ds, null, xname, DataType.DOUBLE, xname, (0 == grid_code) ? CDM.LON_UNITS : "km", "synthesized X coord"); v.addAttribute( new Attribute( _Coordinate.AxisType, (0 == grid_code) ? AxisType.Lon.toString() : AxisType.GeoX.toString())); ds.setValues( v, nx, startx, dx); ds.addCoordinateAxis( v); return v; }
CoordinateAxis makeYCoordAxis( NetcdfDataset ds, String yname) { CoordinateAxis v = new CoordinateAxis1D( ds, null, yname, DataType.DOUBLE, yname, ((0 == grid_code) ? CDM.LAT_UNITS : "km"), "synthesized Y coord"); v.addAttribute( new Attribute( _Coordinate.AxisType, (0 == grid_code) ? AxisType.Lat.toString() : AxisType.GeoY.toString())); ds.setValues( v, ny, starty, dy); ds.addCoordinateAxis( v); return v; }
CoordinateAxis makeYCoordAxis( NetcdfDataset ds, String yname) { CoordinateAxis v = new CoordinateAxis1D( ds, null, yname, DataType.DOUBLE, yname, ((0 == grid_code) ? CDM.LAT_UNITS : "km"), "synthesized Y coord"); v.addAttribute( new Attribute( _Coordinate.AxisType, (0 == grid_code) ? AxisType.Lat.toString() : AxisType.GeoY.toString())); v.setValues(ny, starty, dy); ds.addCoordinateAxis( v); return v; }
private CoordinateAxis makeFakeCoordAxis(NetcdfDataset ds, String axisName, Dimension dim) { if (dim == null) return null; CoordinateAxis v = new CoordinateAxis1D(ds, null, axisName, DataType.SHORT, dim.getShortName(), "", "synthesized coordinate: only an index"); v.addAttribute(new Attribute(_Coordinate.AxisType, "GeoZ")); if (!axisName.equals(dim.getShortName())) v.addAttribute(new Attribute(_Coordinate.AliasForDimension, dim.getShortName())); ds.setValues(v, dim.getLength(), 0, 1); return v; }
private CoordinateAxis makeFakeCoordAxis(NetcdfDataset ds, String axisName, Dimension dim) { if (dim == null) return null; CoordinateAxis v = new CoordinateAxis1D(ds, null, axisName, DataType.SHORT, dim.getShortName(), "", "synthesized coordinate: only an index"); v.addAttribute(new Attribute(_Coordinate.AxisType, "GeoZ")); if (!axisName.equals(dim.getShortName())) v.addAttribute(new Attribute(_Coordinate.AliasForDimension, dim.getShortName())); v.setValues(dim.getLength(), 0, 1); return v; }
@Override public CoordinateAxis copyNoCache() { CoordinateAxis1D axis = new CoordinateAxis1D(ncd, getParentGroup(), getShortName(), getDataType(), getDimensionsString(), getUnitsString(), getDescription()); // other state axis.axisType = this.axisType; axis.boundaryRef = this.boundaryRef; axis.isContiguous = this.isContiguous; axis.positive = this.positive; axis.cache = new Variable.Cache(); // decouple cache return axis; }
@Override public CoordinateAxis copyNoCache() { CoordinateAxis1D axis = new CoordinateAxis1D(ncd, getParentGroup(), getShortName(), getDataType(), getDimensionsString(), getUnitsString(), getDescription()); // other state axis.axisType = this.axisType; axis.boundaryRef = this.boundaryRef; axis.isContiguous = this.isContiguous; axis.positive = this.positive; axis.cache = new Variable.Cache(); // decouple cache return axis; }
private CoordinateAxis makeLatCoordAxis(NetcdfDataset ds, String axisName, Dimension dim) { if (dim == null) return null; double dy = findAttributeDouble(ds, "DY"); int ny = dim.getLength(); double starty = centerY - dy * (ny - 1) / 2; CoordinateAxis v = new CoordinateAxis1D(ds, null, axisName, DataType.DOUBLE, dim.getShortName(), "degrees_north", "synthesized latitude coordinate"); ds.setValues(v, ny, starty, dy); v.addAttribute(new Attribute(_Coordinate.AxisType, "Lat")); if (!axisName.equals(dim.getShortName())) v.addAttribute(new Attribute(_Coordinate.AliasForDimension, dim.getShortName())); return v; }