This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit b85b941c25a587a60a5bd06c28d46991fb0105b6
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Wed Sep 21 15:32:10 2022 +0200

    Rename `GridGeometry.reduce(…)` as `selectDimensions(…)`.
    The previous name was confusing about what is reduced.
    Renamed also `CRS.reduce(…)` for consistency.
---
 .../apache/sis/gui/coverage/CoverageCanvas.java    |  2 +-
 .../apache/sis/coverage/grid/DimensionReducer.java |  2 +-
 .../apache/sis/coverage/grid/GridCoverage2D.java   |  4 +--
 .../apache/sis/coverage/grid/GridDerivation.java   | 12 ++++----
 .../org/apache/sis/coverage/grid/GridExtent.java   | 29 +++++++++++++----
 .../org/apache/sis/coverage/grid/GridGeometry.java | 25 ++++++++++++---
 .../apache/sis/coverage/grid/SliceGeometry.java    |  8 ++---
 .../internal/coverage/j2d/DeferredProperty.java    |  2 +-
 .../apache/sis/coverage/grid/GridExtentTest.java   |  8 ++---
 .../apache/sis/coverage/grid/GridGeometryTest.java | 16 +++++-----
 .../main/java/org/apache/sis/portrayal/Canvas.java |  2 +-
 .../main/java/org/apache/sis/referencing/CRS.java  | 26 ++++++++++++++--
 .../java/org/apache/sis/referencing/CRSTest.java   | 36 +++++++++++-----------
 .../report/CoordinateReferenceSystems.java         |  2 +-
 .../aggregate/ConcatenatedGridCoverage.java        |  2 +-
 15 files changed, 114 insertions(+), 62 deletions(-)

diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
index eab02b084d..448dba6e0d 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
@@ -680,7 +680,7 @@ public class CoverageCanvas extends MapCanvasAWT {
          */
         Envelope bounds = null;
         if (domain != null) {
-            domain = domain.reduce(xyDimensions);
+            domain = domain.selectDimensions(xyDimensions);
             if (domain.isDefined(GridGeometry.ENVELOPE)) {
                 bounds = domain.getEnvelope();
             }
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/DimensionReducer.java
 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/DimensionReducer.java
index 568cd1cc3d..a3059a10fe 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/DimensionReducer.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/DimensionReducer.java
@@ -66,7 +66,7 @@ final class DimensionReducer {
                     dimensions = 
AxisDirections.indicesOfLenientMapping(targetCS, sourceCS);
                     if (dimensions != null) {
                         Arrays.sort(dimensions);
-                        reducedCRS = CRS.reduce(targetCRS, dimensions);
+                        reducedCRS = CRS.selectDimensions(targetCRS, 
dimensions);
                     }
                 }
             }
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
index 28a9b41b91..9f29c7440e 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
@@ -456,12 +456,12 @@ public class GridCoverage2D extends GridCoverage {
      * @return the two-dimensional part of the grid geometry.
      *
      * @see #getGridGeometry()
-     * @see GridGeometry#reduce(int...)
+     * @see GridGeometry#selectDimensions(int[])
      */
     public GridGeometry getGridGeometry2D() {
         GridGeometry g = gridGeometry2D.get();
         if (g == null) {
-            g = gridGeometry.reduce(xDimension, yDimension);
+            g = gridGeometry.selectDimensions(xDimension, yDimension);
             if (!gridGeometry2D.compareAndSet(null, g)) {
                 GridGeometry other = gridGeometry2D.get();
                 if (other != null) return other;
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
index 6b82fbe6e7..d76d2e3c8f 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
@@ -75,14 +75,14 @@ import org.opengis.coverage.PointOutsideCoverageException;
  * <p>All methods in this class preserve the number of dimensions. For example 
the {@link #slice(DirectPosition)} method sets
  * the {@linkplain GridExtent#getSize(int) grid size} to 1 in all dimensions 
specified by the <cite>slice point</cite>,
  * but does not remove those dimensions from the grid geometry.
- * For dimensionality reduction, see {@link GridGeometry#reduce(int...)}.</p>
+ * For dimensionality reduction, see {@link 
GridGeometry#selectDimensions(int[])}.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Alexis Manin (Geomatys)
  * @version 1.3
  *
  * @see GridGeometry#derive()
- * @see GridGeometry#reduce(int...)
+ * @see GridGeometry#selectDimensions(int[])
  *
  * @since 1.0
  * @module
@@ -459,7 +459,7 @@ public class GridDerivation {
      *       if different than default values, should be set before to invoke 
this method.</li>
      *   <li>{@linkplain #slice(DirectPosition) Slicing} can be applied after 
this method.</li>
      *   <li>This method does not reduce the number of dimensions of the grid 
geometry.
-     *       For dimensionality reduction, see {@link 
GridGeometry#reduce(int...)}.</li>
+     *       For dimensionality reduction, see {@link 
GridGeometry#selectDimensions(int[])}.</li>
      * </ul>
      *
      * @param  areaOfInterest  the area of interest and desired resolution as 
a grid geometry.
@@ -565,7 +565,7 @@ public class GridDerivation {
      *       if different than default values, should be set before to invoke 
this method.</li>
      *   <li>{@linkplain #slice(DirectPosition) Slicing} can be applied after 
this method.</li>
      *   <li>This method does not reduce the number of dimensions of the grid 
geometry.
-     *       For dimensionality reduction, see {@link 
GridGeometry#reduce(int...)}.</li>
+     *       For dimensionality reduction, see {@link 
GridGeometry#selectDimensions(int[])}.</li>
      *   <li>If the given envelope is known to be expressed in the same CRS 
than the grid geometry,
      *       then the {@linkplain Envelope#getCoordinateReferenceSystem() CRS 
of the envelope}
      *       can be left unspecified ({@code null}). It may give a slight 
performance improvement
@@ -848,7 +848,7 @@ public class GridDerivation {
      *       if different than default values, should be set before to invoke 
this method.</li>
      *   <li>{@linkplain #slice(DirectPosition) Slicing} can be applied after 
this method.</li>
      *   <li>This method does not reduce the number of dimensions of the grid 
geometry.
-     *       For dimensionality reduction, see {@link 
GridGeometry#reduce(int...)}.</li>
+     *       For dimensionality reduction, see {@link 
GridGeometry#selectDimensions(int[])}.</li>
      * </ul>
      *
      * @param  areaOfInterest  the desired grid extent in unit of base grid 
cell (i.e. ignoring subsampling),
@@ -976,7 +976,7 @@ public class GridDerivation {
      *   <li>If a non-default rounding mode is desired, it should be 
{@linkplain #rounding(GridRoundingMode) specified}
      *       before to invoke this method.</li>
      *   <li>This method does not reduce the number of dimensions of the grid 
geometry.
-     *       For dimensionality reduction, see {@link 
GridGeometry#reduce(int...)}.</li>
+     *       For dimensionality reduction, see {@link 
GridGeometry#selectDimensions(int[])}.</li>
      *   <li>If the given point is known to be expressed in the same CRS than 
the grid geometry,
      *       then the {@linkplain 
DirectPosition#getCoordinateReferenceSystem() CRS of the point}
      *       can be left unspecified ({@code null}). It may give a slight 
performance improvement
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
index 1e6f66f825..7e75053252 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
@@ -634,7 +634,7 @@ public class GridExtent implements GridEnvelope, 
LenientComparable, Serializable
      *
      * @return the number of dimensions.
      *
-     * @see #reduceDimension(int[])
+     * @see #selectDimensions(int[])
      */
     @Override
     public final int getDimension() {
@@ -1242,6 +1242,8 @@ public class GridExtent implements GridEnvelope, 
LenientComparable, Serializable
      * @return a new grid extent with the specified dimension added.
      * @throws IllegalArgumentException if the low coordinate value is greater 
than the high coordinate value.
      *
+     * @see #selectDimensions(int...)
+     *
      * @since 1.1
      */
     public GridExtent insertDimension(final int offset, final 
DimensionNameType axisType, final long low, long high, final boolean 
isHighIncluded) {
@@ -1286,15 +1288,30 @@ public class GridExtent implements GridEnvelope, 
LenientComparable, Serializable
      * @throws IndexOutOfBoundsException if an index is out of bounds.
      *
      * @see #getSubspaceDimensions(int)
-     * @see GridGeometry#reduce(int...)
+     * @see GridGeometry#selectDimensions(int...)
      *
-     * @since 1.1
+     * @since 1.3
      */
-    public GridExtent reduceDimension(int... dimensions) {
+    public GridExtent selectDimensions(int... dimensions) {
         dimensions = verifyDimensions(dimensions, getDimension());
         return (dimensions != null) ? reorder(dimensions) : this;
     }
 
+    /**
+     * Returns a grid extent that encompass only some dimensions of this grid 
extent.
+     *
+     * @param  dimensions  the dimensions to select, in strictly increasing 
order.
+     * @return the sub-envelope, or {@code this} if the given array contains 
all dimensions of this grid extent.
+     *
+     * @since 1.1
+     *
+     * @deprecated Renamed {@link #selectDimensions(int...)} for clarity.
+     */
+    @Deprecated
+    public GridExtent reduceDimension(int... dimensions) {
+        return selectDimensions(dimensions);
+    }
+
     /**
      * Verifies the validity of a given {@code dimensions} argument.
      *
@@ -1477,7 +1494,7 @@ public class GridExtent implements GridEnvelope, 
LenientComparable, Serializable
      * grid borders.</div>
      *
      * This method does not reduce the number of dimensions of the grid extent.
-     * For dimensionality reduction, see {@link #reduceDimension(int[])}.
+     * For dimensionality reduction, see {@link #selectDimensions(int[])}.
      *
      * <h4>Number of arguments</h4>
      * The {@code periods} array length should be equal to the {@linkplain 
#getDimension() number of dimensions}.
@@ -1580,7 +1597,7 @@ public class GridExtent implements GridEnvelope, 
LenientComparable, Serializable
      * in the given point will be rounded to nearest integer.
      *
      * <p>This method does not reduce the number of dimensions of the grid 
extent.
-     * For dimensionality reduction, see {@link #reduceDimension(int[])}.</p>
+     * For dimensionality reduction, see {@link #selectDimensions(int[])}.</p>
      *
      * @param  slicePoint           where to take a slice. NaN values are 
handled as if their dimensions were absent.
      * @param  modifiedDimensions   mapping from {@code slicePoint} dimensions 
to this {@code GridExtent} dimensions,
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
index 936b9b0888..5bc761668d 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
@@ -751,7 +751,7 @@ public class GridGeometry implements LenientComparable, 
Serializable {
      *
      * @return the number of grid dimensions.
      *
-     * @see #reduce(int...)
+     * @see #selectDimensions(int[])
      * @see GridExtent#getDimension()
      */
     public final int getDimension() {
@@ -1370,7 +1370,7 @@ public class GridGeometry implements LenientComparable, 
Serializable {
      * Each {@code GridDerivation} instance can be used only once and should 
be used in a single thread.
      * {@code GridDerivation} preserves the number of dimensions. For example 
{@linkplain GridDerivation#slice slicing}
      * sets the {@linkplain GridExtent#getSize(int) grid size} to 1 in all 
dimensions specified by a <cite>slice point</cite>,
-     * but does not remove those dimensions from the grid geometry. For 
dimensionality reduction, see {@link #reduce(int...)}.
+     * but does not remove those dimensions from the grid geometry. For 
dimensionality reduction, see {@link #selectDimensions(int[])}.
      *
      * @return an object for deriving a grid geometry from {@code this}.
      */
@@ -1536,10 +1536,12 @@ public class GridGeometry implements LenientComparable, 
Serializable {
      * @throws IndexOutOfBoundsException if an index is out of bounds.
      *
      * @see GridExtent#getSubspaceDimensions(int)
-     * @see GridExtent#reduceDimension(int[])
-     * @see org.apache.sis.referencing.CRS#reduce(CoordinateReferenceSystem, 
int...)
+     * @see GridExtent#selectDimensions(int[])
+     * @see 
org.apache.sis.referencing.CRS#selectDimensions(CoordinateReferenceSystem, 
int[])
+     *
+     * @since 1.3
      */
-    public GridGeometry reduce(int... dimensions) {
+    public GridGeometry selectDimensions(int... dimensions) {
         dimensions = GridExtent.verifyDimensions(dimensions, getDimension());
         if (dimensions != null) try {
             return new SliceGeometry(this, null, dimensions, 
null).reduce(null, -1);
@@ -1549,6 +1551,19 @@ public class GridGeometry implements LenientComparable, 
Serializable {
         return this;
     }
 
+    /**
+     * Returns a grid geometry that encompass only some dimensions of this 
grid geometry.
+     *
+     * @param  dimensions  the grid (not CRS) dimensions to select, in 
strictly increasing order.
+     * @return the sub-grid geometry, or {@code this} if the given array 
contains all dimensions of this grid geometry.
+     *
+     * @deprecated Renamed {@link #selectDimensions(int...)} for clarity and 
consistency with {@link GridExtent}.
+     */
+    @Deprecated
+    public GridGeometry reduce(int... dimensions) {
+        return selectDimensions(dimensions);
+    }
+
     /**
      * Creates a one-, two- or three-dimensional coordinate reference system 
for cell indices in the grid.
      * This method returns a CRS which is derived from the "real world" CRS or 
a subset of it.
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/SliceGeometry.java
 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/SliceGeometry.java
index 45276f1598..bccddf4432 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/SliceGeometry.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/SliceGeometry.java
@@ -42,7 +42,7 @@ import org.apache.sis.util.resources.Errors;
 
 /**
  * Builds a grid geometry for a slice in a {@link GridCoverage}. This is the 
implementation of
- * {@link GridGeometry#reduce(int...)} and {@link 
ImageRenderer#getImageGeometry(int)} methods.
+ * {@link GridGeometry#selectDimensions(int[])} and {@link 
ImageRenderer#getImageGeometry(int)} methods.
  *
  * <p>This class implements {@link Function} for allowing {@code apply(…)} to 
be invoked from outside this package.
  * That function is invoked (indirectly) by {@link 
org.apache.sis.internal.coverage.j2d.TiledImage#getProperty(String)}.</p>
@@ -130,7 +130,7 @@ final class SliceGeometry implements 
Function<RenderedImage, GridGeometry> {
      * @param  dimCRS          desired number of CRS dimensions, or -1 for 
automatic.
      * @throws FactoryException if an error occurred while separating the 
"grid to CRS" transform.
      *
-     * @see GridGeometry#reduce(int...)
+     * @see GridGeometry#selectDimensions(int[])
      */
     final GridGeometry reduce(final GridExtent relativeExtent, final int 
dimCRS) throws FactoryException {
         GridExtent    extent      = geometry.extent;
@@ -177,7 +177,7 @@ final class SliceGeometry implements 
Function<RenderedImage, GridGeometry> {
             extent = sliceExtent;
         }
         if (extent != null) {
-            extent = extent.reduceDimension(gridDimensions);
+            extent = extent.selectDimensions(gridDimensions);
         }
         GeneralEnvelope subArea = null;
         if (useSubExtent && cornerToCRS != null) try {
@@ -195,7 +195,7 @@ final class SliceGeometry implements 
Function<RenderedImage, GridGeometry> {
         ImmutableEnvelope envelope = geometry.envelope;
         if (envelope != null) {
             if (subArea != null || envelope.getDimension() != n) {
-                final CoordinateReferenceSystem crs = 
CRS.reduce(envelope.getCoordinateReferenceSystem(), crsDimensions);
+                final CoordinateReferenceSystem crs = 
CRS.selectDimensions(envelope.getCoordinateReferenceSystem(), crsDimensions);
                 final double[] min = new double[n];
                 final double[] max = new double[n];
                 for (int i=0; i<n; i++) {
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/DeferredProperty.java
 
b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/DeferredProperty.java
index 498b0a9180..18743cdb45 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/DeferredProperty.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/DeferredProperty.java
@@ -121,7 +121,7 @@ public final class DeferredProperty {
         @Override
         public GridGeometry apply(final RenderedImage image) {
             final GridExtent extent = grid.getExtent();
-            return grid.reduce(dimX, dimY).translate(
+            return grid.selectDimensions(dimX, dimY).translate(
                     Math.subtractExact(image.getMinX(), extent.getLow(dimX)),
                     Math.subtractExact(image.getMinY(), extent.getLow(dimY)));
         }
diff --git 
a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
 
b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
index 71081a3b2e..d0e1869669 100644
--- 
a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
+++ 
b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
@@ -184,19 +184,19 @@ public final strictfp class GridExtentTest extends 
TestCase {
     }
 
     /**
-     * Tests {@link GridExtent#reduceDimension(int[])}.
+     * Tests {@link GridExtent#selectDimensions(int[])}.
      */
     @Test
-    public void testReduceDimension() {
+    public void testSelectDimensions() {
         final GridExtent extent = create3D();
-        GridExtent reduced = extent.reduceDimension(0, 1);
+        GridExtent reduced = extent.selectDimensions(0, 1);
         assertEquals("dimension", 2, reduced.getDimension());
         assertExtentEquals(reduced, 0, 100, 499);
         assertExtentEquals(reduced, 1, 200, 799);
         assertEquals(DimensionNameType.COLUMN, reduced.getAxisType(0).get());
         assertEquals(DimensionNameType.ROW,    reduced.getAxisType(1).get());
 
-        reduced = extent.reduceDimension(2);
+        reduced = extent.selectDimensions(2);
         assertEquals("dimension", 1, reduced.getDimension());
         assertExtentEquals(reduced, 0, 40, 49);
         assertEquals(DimensionNameType.TIME, reduced.getAxisType(0).get());
diff --git 
a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridGeometryTest.java
 
b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridGeometryTest.java
index fc47a135b5..86fcf19682 100644
--- 
a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridGeometryTest.java
+++ 
b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridGeometryTest.java
@@ -551,10 +551,10 @@ public final strictfp class GridGeometryTest extends 
TestCase {
     }
 
     /**
-     * Tests {@link GridGeometry#reduce(int...)}.
+     * Tests {@link GridGeometry#selectDimensions(int[])}.
      */
     @Test
-    public void testReduce() {
+    public void testSelectDimensions() {
         final GridGeometry grid = new GridGeometry(
                 new GridExtent(null, new long[] {336, 20, 4}, new long[] {401, 
419, 10}, true),
                 PixelInCell.CELL_CORNER, MathTransforms.linear(new Matrix4(
@@ -565,7 +565,7 @@ public final strictfp class GridGeometryTest extends 
TestCase {
         /*
          * Tests on the two first dimensions.
          */
-        GridGeometry reduced = grid.reduce(0, 1);
+        GridGeometry reduced = grid.selectDimensions(0, 1);
         assertNotSame(grid, reduced);
         assertExtentEquals(new long[] {336, 20}, new long[] {401, 419}, 
reduced.getExtent());
         assertSame("CRS", HardCodedCRS.WGS84, 
reduced.getCoordinateReferenceSystem());
@@ -577,7 +577,7 @@ public final strictfp class GridGeometryTest extends 
TestCase {
         /*
          * Tests on the last dimension.
          */
-        reduced = grid.reduce(2);
+        reduced = grid.selectDimensions(2);
         assertNotSame(grid, reduced);
         assertExtentEquals(new long[] {4}, new long[] {10}, 
reduced.getExtent());
         assertSame("CRS", HardCodedCRS.GRAVITY_RELATED_HEIGHT, 
reduced.getCoordinateReferenceSystem());
@@ -594,12 +594,12 @@ public final strictfp class GridGeometryTest extends 
TestCase {
     }
 
     /**
-     * Tests {@link GridGeometry#reduce(int...)} with a {@code gridToCRS} 
transform having a constant value
+     * Tests {@link GridGeometry#selectDimensions(int[])} with a {@code 
gridToCRS} transform having a constant value
      * in one dimension. This method tests indirectly {@link 
SliceGeometry#findTargetDimensions(MathTransform,
      * GridExtent, double[], int[], int)}.
      */
     @Test
-    public void testReduceScalelessDimension() {
+    public void testRemoveScalelessDimension() {
         final GridGeometry grid = new GridGeometry(
                 new GridExtent(null, new long[] {336, 20, 4}, new long[] {401, 
419, 10}, true),
                 PixelInCell.CELL_CORNER, MathTransforms.linear(new Matrix4(
@@ -608,7 +608,7 @@ public final strictfp class GridGeometryTest extends 
TestCase {
                         0,   0,   0,    3,   // All scale coefficients set to 
0.
                         0,   0,   0,    1)), HardCodedCRS.GEOID_3D);
 
-        GridGeometry reduced = grid.reduce(0, 1);
+        GridGeometry reduced = grid.selectDimensions(0, 1);
         MathTransform tr = reduced.getGridToCRS(PixelInCell.CELL_CORNER);
         /*
          * If the boolean argument given to the `GridGeometry(GridGeometry, 
int[], boolean)` constructor was false,
@@ -630,7 +630,7 @@ public final strictfp class GridGeometryTest extends 
TestCase {
          * Test again by keeping the dimension without scale instead of 
discarding it.
          * We have to skip `verifyGridToCRS(reduced)` because matrix is 
non-invertible.
          */
-        reduced = grid.reduce(2);
+        reduced = grid.selectDimensions(2);
         tr = reduced.getGridToCRS(PixelInCell.CELL_CORNER);
         assertMatrixEquals("gridToCRS", new Matrix2(0, 3, 0, 1), 
MathTransforms.getMatrix(tr), STRICT);
     }
diff --git 
a/core/sis-portrayal/src/main/java/org/apache/sis/portrayal/Canvas.java 
b/core/sis-portrayal/src/main/java/org/apache/sis/portrayal/Canvas.java
index 7e7c1f3a30..1075d4085b 100644
--- a/core/sis-portrayal/src/main/java/org/apache/sis/portrayal/Canvas.java
+++ b/core/sis-portrayal/src/main/java/org/apache/sis/portrayal/Canvas.java
@@ -1087,7 +1087,7 @@ public class Canvas extends Observable implements 
Localized {
             analyzer.addSourceDimensions(displayDimensions);
             final LinearTransform           newObjectiveToDisplay = 
MathTransforms.tangent(analyzer.separate().inverse(), newPOI);
             final int[]                     objectiveDimensions   = 
analyzer.getTargetDimensions();
-            final CoordinateReferenceSystem newObjectiveCRS       = 
CRS.reduce(crs, objectiveDimensions);
+            final CoordinateReferenceSystem newObjectiveCRS       = 
CRS.selectDimensions(crs, objectiveDimensions);
             final MathTransform             dimensionSelect       = 
MathTransforms.linear(
                     Matrices.createDimensionSelect(newPOI.getDimension(), 
objectiveDimensions));
             /*
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
index 6f11b645a3..fa1e593e74 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
@@ -952,9 +952,11 @@ public final class CRS extends Static {
      * @see #getComponentAt(CoordinateReferenceSystem, int, int)
      * @see #compound(CoordinateReferenceSystem...)
      *
-     * @since 1.0
+     * @since 1.3
      */
-    public static CoordinateReferenceSystem reduce(final 
CoordinateReferenceSystem crs, final int... dimensions) throws FactoryException 
{
+    public static CoordinateReferenceSystem selectDimensions(final 
CoordinateReferenceSystem crs,
+            final int... dimensions) throws FactoryException
+    {
         ArgumentChecks.ensureNonNull("dimensions", dimensions);
         if (crs == null) {
             return null;
@@ -978,6 +980,24 @@ public final class CRS extends Static {
         return compound(components.toArray(new 
CoordinateReferenceSystem[components.size()]));
     }
 
+    /**
+     * Gets or creates a coordinate reference system with a subset of the 
dimensions of the given CRS.
+     *
+     * @param  crs         the CRS to reduce the dimensionality.
+     * @param  dimensions  the dimensions to retain.
+     * @return a coordinate reference system for the given dimensions.
+     * @throws FactoryException if the geodetic factory failed to create a 
compound CRS.
+     *
+     * @since 1.0
+     *
+     * @deprecated Renamed {@link #selectDimensions(CoordinateReferenceSystem, 
int...)} for clarity and consistency with
+     *             {@link org.apache.sis.coverage.grid.GridExtent} and {@link 
org.apache.sis.coverage.grid.GridGeometry}.
+     */
+    @Deprecated
+    public static CoordinateReferenceSystem reduce(final 
CoordinateReferenceSystem crs, final int... dimensions) throws FactoryException 
{
+        return selectDimensions(crs, dimensions);
+    }
+
     /**
      * Adds the components of reduced CRS into the given list.
      * This method may invoke itself recursively for walking through compound 
CRS.
@@ -1354,7 +1374,7 @@ public final class CRS extends Static {
      *         or can not be decomposed for dimensions in the [{@code lower} … 
{@code upper}] range.
      * @throws IndexOutOfBoundsException if the given index are out of bounds.
      *
-     * @see #reduce(CoordinateReferenceSystem, int...)
+     * @see #selectDimensions(CoordinateReferenceSystem, int[])
      * @see org.apache.sis.geometry.GeneralEnvelope#subEnvelope(int, int)
      *
      * @since 0.5
diff --git 
a/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java 
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
index 80421469b2..37083eed3c 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
@@ -407,27 +407,27 @@ public final strictfp class CRSTest extends TestCase {
     }
 
     /**
-     * Tests {@link CRS#reduce(CoordinateReferenceSystem, int...)} in the 
simpler case where
-     * there is no three-dimensional geographic CRS to separate.
+     * Tests {@link CRS#selectDimensions(CoordinateReferenceSystem, int[])} in 
the simpler case
+     * where there is no three-dimensional geographic CRS to separate.
      *
      * @throws FactoryException if an error occurred while creating a compound 
CRS.
      *
      * @since 1.0
      */
     @Test
-    public void testReduce() throws FactoryException {
-        assertSame(HardCodedCRS.TIME,                     
CRS.reduce(HardCodedCRS.GEOID_4D, 3));
-        assertSame(HardCodedCRS.GRAVITY_RELATED_HEIGHT,   
CRS.reduce(HardCodedCRS.GEOID_4D, 2));
-        assertSame(HardCodedCRS.WGS84,                    
CRS.reduce(HardCodedCRS.GEOID_4D, 0, 1));
-        assertSame(HardCodedCRS.GEOID_4D,                 
CRS.reduce(HardCodedCRS.GEOID_4D, 0, 1, 2, 3));
-        assertSame(HardCodedCRS.NESTED,                   
CRS.reduce(HardCodedCRS.NESTED,   0, 1, 2, 3));
-        assertSame(HardCodedCRS.GEOID_3D,                 
CRS.reduce(HardCodedCRS.NESTED,   0, 1, 2));
-        assertEqualsIgnoreMetadata(HardCodedCRS.GEOID_3D, 
CRS.reduce(HardCodedCRS.GEOID_4D, 0, 1, 2));
+    public void testSelectDimensions() throws FactoryException {
+        assertSame(HardCodedCRS.TIME,                     
CRS.selectDimensions(HardCodedCRS.GEOID_4D, 3));
+        assertSame(HardCodedCRS.GRAVITY_RELATED_HEIGHT,   
CRS.selectDimensions(HardCodedCRS.GEOID_4D, 2));
+        assertSame(HardCodedCRS.WGS84,                    
CRS.selectDimensions(HardCodedCRS.GEOID_4D, 0, 1));
+        assertSame(HardCodedCRS.GEOID_4D,                 
CRS.selectDimensions(HardCodedCRS.GEOID_4D, 0, 1, 2, 3));
+        assertSame(HardCodedCRS.NESTED,                   
CRS.selectDimensions(HardCodedCRS.NESTED,   0, 1, 2, 3));
+        assertSame(HardCodedCRS.GEOID_3D,                 
CRS.selectDimensions(HardCodedCRS.NESTED,   0, 1, 2));
+        assertEqualsIgnoreMetadata(HardCodedCRS.GEOID_3D, 
CRS.selectDimensions(HardCodedCRS.GEOID_4D, 0, 1, 2));
     }
 
     /**
-     * Tests {@link CRS#reduce(CoordinateReferenceSystem, int...)} with a 
three-dimensional geographic CRS
-     * to be reduced to a two-dimensional CRS.
+     * Tests {@link CRS#selectDimensions(CoordinateReferenceSystem, int[])} 
with
+     * a three-dimensional geographic CRS to be reduced to a two-dimensional 
CRS.
      *
      * @throws FactoryException if an error occurred while creating a CRS.
      *
@@ -436,13 +436,13 @@ public final strictfp class CRSTest extends TestCase {
     @Test
     public void testReduceGeographic3D() throws FactoryException {
         final GeographicCRS crs = HardCodedCRS.WGS84_3D;
-        assertSame(CommonCRS.Vertical.ELLIPSOIDAL.crs(),   CRS.reduce(crs, 2));
-        assertSame(CommonCRS.WGS84.normalizedGeographic(), CRS.reduce(crs, 0, 
1));
+        assertSame(CommonCRS.Vertical.ELLIPSOIDAL.crs(),   
CRS.selectDimensions(crs, 2));
+        assertSame(CommonCRS.WGS84.normalizedGeographic(), 
CRS.selectDimensions(crs, 0, 1));
     }
 
     /**
-     * Tests {@link CRS#reduce(CoordinateReferenceSystem, int...)} with a 
three-dimensional projected CRS
-     * to be reduced to a two-dimensional CRS.
+     * Tests {@link CRS#selectDimensions(CoordinateReferenceSystem, int[])} 
with
+     * a three-dimensional projected CRS to be reduced to a two-dimensional 
CRS.
      *
      * @throws FactoryException if an error occurred while creating a CRS.
      *
@@ -451,8 +451,8 @@ public final strictfp class CRSTest extends TestCase {
     @Test
     public void testReduceProjected3D() throws FactoryException {
         final ProjectedCRS crs = HardCodedConversions.mercator3D();
-        assertSame(CommonCRS.Vertical.ELLIPSOIDAL.crs(), CRS.reduce(crs, 2));
-        assertEqualsIgnoreMetadata(HardCodedConversions.mercator(), 
CRS.reduce(crs, 0, 1));
+        assertSame(CommonCRS.Vertical.ELLIPSOIDAL.crs(), 
CRS.selectDimensions(crs, 2));
+        assertEqualsIgnoreMetadata(HardCodedConversions.mercator(), 
CRS.selectDimensions(crs, 0, 1));
     }
 
     /**
diff --git 
a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
 
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
index d24443bdcd..1d474f1fc7 100644
--- 
a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
+++ 
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
@@ -618,7 +618,7 @@ public final strictfp class CoordinateReferenceSystems 
extends AuthorityCodesRep
 
 
     /**
-     * A row with an natural ordering that use the first part of the name 
before to use the authority code.
+     * A row with a natural ordering that use the first part of the name 
before to use the authority code.
      * We use only the part of the name prior some keywords (e.g. {@code 
"zone"}).
      * For example if the following codes:
      *
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/ConcatenatedGridCoverage.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/ConcatenatedGridCoverage.java
index b3672cffa7..80fab101ea 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/ConcatenatedGridCoverage.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/ConcatenatedGridCoverage.java
@@ -20,6 +20,7 @@ import java.util.List;
 import java.util.ArrayList;
 import java.util.logging.Logger;
 import java.awt.image.RenderedImage;
+import org.opengis.referencing.operation.TransformException;
 import org.apache.sis.coverage.SampleDimension;
 import org.apache.sis.coverage.grid.GridExtent;
 import org.apache.sis.coverage.grid.GridGeometry;
@@ -36,7 +37,6 @@ import org.apache.sis.util.logging.Logging;
 
 // Branch-dependent imports
 import org.opengis.coverage.CannotEvaluateException;
-import org.opengis.referencing.operation.TransformException;
 
 
 /**

Reply via email to