/** * Create a new GeoGrid that is a logical subset of this GeoGrid. * * @param t_range subset the time dimension, or null if you want all of it * @param z_range subset the vertical dimension, or null if you want all of it * @param y_range subset the y dimension, or null if you want all of it * @param x_range subset the x dimension, or null if you want all of it * @return subsetted GeoGrid * @throws InvalidRangeException if any of the ranges are invalid */ public GeoGrid subset(Range t_range, Range z_range, Range y_range, Range x_range) throws InvalidRangeException { return (GeoGrid) makeSubset( null, null, t_range, z_range, y_range, x_range); }
/** * Create a new GeoGrid that is a logical subset of this GeoGrid. * * @param t_range subset the time dimension, or null if you want all of it * @param z_range subset the vertical dimension, or null if you want all of it * @param y_range subset the y dimension, or null if you want all of it * @param x_range subset the x dimension, or null if you want all of it * @return subsetted GeoGrid * @throws InvalidRangeException if any of the ranges are invalid */ public GeoGrid subset(Range t_range, Range z_range, Range y_range, Range x_range) throws InvalidRangeException { return (GeoGrid) makeSubset( null, null, t_range, z_range, y_range, x_range); }
/** * Create a new GeoGrid that is a logical subset of this GeoGrid. * * @param t_range subset the time dimension, or null if you want all of it * @param z_range subset the vertical dimension, or null if you want all of it * @param y_range subset the y dimension, or null if you want all of it * @param x_range subset the x dimension, or null if you want all of it * @return subsetted GeoGrid * @throws InvalidRangeException if any of the ranges are invalid */ public GeoGrid subset(Range t_range, Range z_range, Range y_range, Range x_range) throws InvalidRangeException { return (GeoGrid) makeSubset( null, null, t_range, z_range, y_range, x_range); }
@Test public void testGridDomain() throws Exception { System.err.printf("%nOpen %s grid='%s'%n", filename, gridName); Grib.setDebugFlags(new DebugFlagsImpl("Grib/indexOnly")); try (GridDataset dataset = GridDataset.open(filename)) { GeoGrid grid = dataset.findGridByName(gridName); GridCoordSystem gcs = grid.getCoordinateSystem(); System.err.printf("%s%n", gcs); testDomain("original grid", grid.getDimensions(), gcs.getCoordinateAxes()); GridDatatype gridSubset = grid.makeSubset(null, null, new Range(0, 0), null, null, null); GridCoordSystem gcsSubset = gridSubset.getCoordinateSystem(); System.err.printf("%s%n", gcsSubset); testDomain("subset grid", gridSubset.getDimensions(), gcsSubset.getCoordinateAxes()); } finally { Grib.setDebugFlags(new DebugFlagsImpl("")); } }