float center_x = xstagData.get((int) xstag.getSize() - 1); Variable ystag = ds.findVariable("y_stag"); ArrayFloat.D1 ystagData = (ArrayFloat.D1) ystag.read(); float center_y = ystagData.get((int) ystag.getSize() - 1); System.out.println("CTR should be x,y= " + center_x / 2000 + ", " + center_y / 2000);
float center_x = xstagData.get((int) xstag.getSize() - 1); Variable ystag = ds.findVariable("y_stag"); ArrayFloat.D1 ystagData = (ArrayFloat.D1) ystag.read(); float center_y = ystagData.get((int) ystag.getSize() - 1); System.out.println("CTR should be x,y= " + center_x / 2000 + ", " + center_y / 2000);
float val = af.get(i); assertEquals(val, tFloat32[i], 1.0e-5);
private void calcCenterPoints(NetcdfDataset ds, Projection proj) throws IOException { double lat_check = findAttributeDouble(ds, "CTRLAT", Double.NaN); double lon_check = findAttributeDouble(ds, "CTRLON", Double.NaN); LatLonPointImpl lpt0 = new LatLonPointImpl(lat_check, lon_check); ProjectionPoint ppt0 = proj.latLonToProj(lpt0, new ProjectionPointImpl()); System.out.println("CTR lpt0= " + lpt0 + " ppt0=" + ppt0); Variable xstag = ds.findVariable("x_stag"); int nxpts = (int) xstag.getSize(); ArrayFloat.D1 xstagData = (ArrayFloat.D1) xstag.read(); float center_x = xstagData.get(nxpts - 1); double false_easting = center_x / 2000 - ppt0.getX() * 1000.0; System.out.println("false_easting= " + false_easting); Variable ystag = ds.findVariable("y_stag"); int nypts = (int) ystag.getSize(); ArrayFloat.D1 ystagData = (ArrayFloat.D1) ystag.read(); float center_y = ystagData.get(nypts - 1); double false_northing = center_y / 2000 - ppt0.getY() * 1000.0; System.out.println("false_northing= " + false_northing); double dx = findAttributeDouble(ds, "DX", Double.NaN); double dy = findAttributeDouble(ds, "DY", Double.NaN); double w = dx * (nxpts - 1); double h = dy * (nypts - 1); double startx = ppt0.getX() * 1000.0 - w / 2; double starty = ppt0.getY() * 1000.0 - h / 2; ds.setValues(xstag, nxpts, startx, dx); ds.setValues(ystag, nypts, starty, dy); }
private void calcCenterPoints(NetcdfDataset ds, Projection proj) throws IOException { double lat_check = findAttributeDouble(ds, "CTRLAT", Double.NaN); double lon_check = findAttributeDouble(ds, "CTRLON", Double.NaN); LatLonPointImpl lpt0 = new LatLonPointImpl(lat_check, lon_check); ProjectionPoint ppt0 = proj.latLonToProj(lpt0, new ProjectionPointImpl()); System.out.println("CTR lpt0= " + lpt0 + " ppt0=" + ppt0); Variable xstag = ds.findVariable("x_stag"); int nxpts = (int) xstag.getSize(); ArrayFloat.D1 xstagData = (ArrayFloat.D1) xstag.read(); float center_x = xstagData.get(nxpts - 1); double false_easting = center_x / 2000 - ppt0.getX() * 1000.0; System.out.println("false_easting= " + false_easting); Variable ystag = ds.findVariable("y_stag"); int nypts = (int) ystag.getSize(); ArrayFloat.D1 ystagData = (ArrayFloat.D1) ystag.read(); float center_y = ystagData.get(nypts - 1); double false_northing = center_y / 2000 - ppt0.getY() * 1000.0; System.out.println("false_northing= " + false_northing); double dx = findAttributeDouble(ds, "DX", Double.NaN); double dy = findAttributeDouble(ds, "DY", Double.NaN); double w = dx * (nxpts - 1); double h = dy * (nypts - 1); double startx = ppt0.getX() * 1000.0 - w / 2; double starty = ppt0.getY() * 1000.0 - h / 2; xstag.setValues(nxpts, startx, dx); ystag.setValues(nypts, starty, dy); }
private void calcCenterPoints(NetcdfDataset ds, Projection proj) throws IOException { double lat_check = findAttributeDouble(ds, "CTRLAT", Double.NaN); double lon_check = findAttributeDouble(ds, "CTRLON", Double.NaN); LatLonPointImpl lpt0 = new LatLonPointImpl(lat_check, lon_check); ProjectionPoint ppt0 = proj.latLonToProj(lpt0, new ProjectionPointImpl()); System.out.println("CTR lpt0= " + lpt0 + " ppt0=" + ppt0); Variable xstag = ds.findVariable("x_stag"); int nxpts = (int) xstag.getSize(); ArrayFloat.D1 xstagData = (ArrayFloat.D1) xstag.read(); float center_x = xstagData.get(nxpts - 1); double false_easting = center_x / 2000 - ppt0.getX() * 1000.0; System.out.println("false_easting= " + false_easting); Variable ystag = ds.findVariable("y_stag"); int nypts = (int) ystag.getSize(); ArrayFloat.D1 ystagData = (ArrayFloat.D1) ystag.read(); float center_y = ystagData.get(nypts - 1); double false_northing = center_y / 2000 - ppt0.getY() * 1000.0; System.out.println("false_northing= " + false_northing); double dx = findAttributeDouble(ds, "DX", Double.NaN); double dy = findAttributeDouble(ds, "DY", Double.NaN); double w = dx * (nxpts - 1); double h = dy * (nypts - 1); double startx = ppt0.getX() * 1000.0 - w / 2; double starty = ppt0.getY() * 1000.0 - h / 2; xstag.setValues(nxpts, startx, dx); ystag.setValues(nypts, starty, dy); }