@Test @Ignore("Does this dataset exist on a public server?") public void testFMRCSubset() throws Exception { try (GridDataset dataset = GridDataset.open("dods://localhost:8080/thredds/dodsC/data/cip/fmrcCase1/CIPFMRCCase1_best.ncd")) { GeoGrid grid = dataset.findGridByName("Latitude__90_to_+90"); assert null != grid; GridCoordSystem gcs = grid.getCoordinateSystem(); assert null != gcs; Range timeRange = new Range(2, 2); int bestZIndex = 5; GeoGrid subset = grid.subset(timeRange, new Range(bestZIndex, bestZIndex), null, null); Array yxData = subset.readYXData(0, 0); logger.debug(NCdumpW.toString(yxData, "xyData", null)); } }
private void doRead3XY( GridDataset ds, String varName) throws IOException { GeoGrid gg = ds.findGridByName( varName); CoordinateAxis1D zAxis = gg.getCoordinateSystem().getVerticalAxis(); int[] w = getWeights( gg); for (int z=0; z<zAxis.getSize(); z++) { Array aa = gg.readYXData(0, z); int[] shape = aa.getShape(); Index ima = aa.getIndex(); for (int i=0; i<shape[0]; i++) { for (int j=0; j<shape[1]; j++) { double got = aa.getDouble( ima.set(i,j)); double want = ((double) (z*100 + i*w[1] + j*w[2])); assert (got == want) : "got "+got+ " want "+want; } } } System.out.println("*** ok reading doRead3XY for "+varName); }
private void doRead3XY( GridDataset ds, String varName) throws IOException { GeoGrid gg = ds.findGridByName( varName); CoordinateAxis1D zAxis = gg.getCoordinateSystem().getVerticalAxis(); int[] w = getWeights( gg); for (int z=0; z<zAxis.getSize(); z++) { Array aa = gg.readYXData(0, z); int[] shape = aa.getShape(); Index ima = aa.getIndex(); for (int i=0; i<shape[0]; i++) { for (int j=0; j<shape[1]; j++) { double got = aa.getDouble( ima.set(i,j)); double want = ((double) (z*100 + i*w[1] + j*w[2])); assert (got == want) : "got "+got+ " want "+want; } } } System.out.println("*** ok reading doRead3XY for "+varName); }
private void doRead3XY( GridDataset ds, String varName) throws IOException { GeoGrid gg = ds.findGridByName( varName); CoordinateAxis1D zAxis = gg.getCoordinateSystem().getVerticalAxis(); int[] w = getWeights( gg); for (int z=0; z<zAxis.getSize(); z++) { Array aa = gg.readYXData(0, z); int[] shape = aa.getShape(); Index ima = aa.getIndex(); for (int i=0; i<shape[0]; i++) { for (int j=0; j<shape[1]; j++) { double got = aa.getDouble( ima.set(i,j)); double want = ((double) (z*100 + i*w[1] + j*w[2])); assert (got == want) : "got "+got+ " want "+want; } } } System.out.println("*** ok reading doRead3XY for "+varName); }