You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2021/09/14 09:04:38 UTC
[sis] 04/04: Renamed "subsamplings" as "subsampling" because
considered uncountable.
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 53f9af5c303590d15e6ca306ee80291db11316c1
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Sep 14 11:02:58 2021 +0200
Renamed "subsamplings" as "subsampling" because considered uncountable.
---
.../apache/sis/gui/dataset/ResourceExplorer.java | 2 +-
.../org/apache/sis/coverage/grid/GridExtent.java | 2 +-
ide-project/NetBeans/nbproject/project.xml | 1 -
.../apache/sis/internal/netcdf/RasterResource.java | 6 +++---
.../sis/internal/storage/AbstractGridResource.java | 16 ++++++++--------
.../org/apache/sis/internal/storage/io/Region.java | 18 +++++++++---------
.../sis/test/storage/CoverageReadConsistency.java | 22 +++++++++++-----------
7 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceExplorer.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceExplorer.java
index a1115a9..c295171 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceExplorer.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceExplorer.java
@@ -478,7 +478,7 @@ public class ResourceExplorer extends WindowManager {
/*
* Want the full coverage in all bands (sample dimensions). This is different than
* the ImageRequest created by `updateDataTab(…)` which requested only an overview
- * (i.e. potentially with subsamplings) and only the first band.
+ * (i.e. potentially with subsampling) and only the first band.
*
* TODO: check if we can still share the coverage in some situations.
*/
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 3b52501..2e967b1 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
@@ -1296,7 +1296,7 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
* If the array is shorter, missing values default to 1 (i.e. samplings in unspecified dimensions are unchanged).
* If the array is longer, extraneous values are ignored.
*
- * @param periods the subsamplings. Length shall be equal to the number of dimension and all values shall be greater than zero.
+ * @param periods the subsampling. Length shall be equal to the number of dimension and all values shall be greater than zero.
* @return the subsampled extent, or {@code this} is subsampling results in the same extent.
* @throws IllegalArgumentException if a period is not greater than zero.
*
diff --git a/ide-project/NetBeans/nbproject/project.xml b/ide-project/NetBeans/nbproject/project.xml
index b8fc957..4b802c3 100644
--- a/ide-project/NetBeans/nbproject/project.xml
+++ b/ide-project/NetBeans/nbproject/project.xml
@@ -130,7 +130,6 @@
<word>splitted</word>
<word>subsampled</word>
<word>subsampling</word>
- <word>subsamplings</word>
<word>timezone</word>
<word>transitioning</word>
<word>unary</word>
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
index 0c528d7..fec33e1 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
@@ -641,12 +641,12 @@ public final class RasterResource extends AbstractGridResource implements Resour
.rounding(GridRoundingMode.ENCLOSING)
.subgrid(domain);
GridExtent areaOfInterest = targetGeometry.getIntersection(); // Pixel indices of data to read.
- int[] subsamplings = targetGeometry.getSubsampling(); // Slice to read or subsampling to apply.
+ int[] subsampling = targetGeometry.getSubsampling(); // Slice to read or subsampling to apply.
int numBuffers = bands.length; // By default, one variable per band.
domain = targetGeometry.build(); // Adjust user-specified domain to data geometry.
if (bandDimension >= 0) {
areaOfInterest = rangeIndices.insertBandDimension(areaOfInterest, bandDimension);
- subsamplings = rangeIndices.insertSubsampling (subsamplings, bandDimension);
+ subsampling = rangeIndices.insertSubsampling (subsampling, bandDimension);
if (bandDimension == 0) {
bandOffsets = new int[numBuffers]; // Will be set to non-zero values later.
}
@@ -675,7 +675,7 @@ public final class RasterResource extends AbstractGridResource implements Resour
}
if (i < numBuffers) try {
// Optional.orElseThrow() below should never fail since Variable.read(…) wraps primitive array.
- sampleValues[indexInRaster] = variable.read(areaOfInterest, subsamplings).buffer().get();
+ sampleValues[indexInRaster] = variable.read(areaOfInterest, subsampling).buffer().get();
} catch (ArithmeticException e) {
throw variable.canNotComputePosition(e);
}
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java
index 6d78bec..4bbf543 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/AbstractGridResource.java
@@ -301,8 +301,8 @@ public abstract class AbstractGridResource extends AbstractResource implements G
*
* {@preformat java
* areaOfInterest = rangeIndices.insertBandDimension(areaOfInterest, bandDimension);
- * subsamplings = rangeIndices.insertSubsampling (subsamplings, bandDimension);
- * data = myReadMethod(areaOfInterest, subsamplings);
+ * subsampling = rangeIndices.insertSubsampling (subsampling, bandDimension);
+ * data = myReadMethod(areaOfInterest, subsampling);
* for (int i=0; i<numBands; i++) {
* int bandIndexInTheDataWeJustRead = rangeIndices.getSubsampledIndex(i);
* }
@@ -339,7 +339,7 @@ public abstract class AbstractGridResource extends AbstractResource implements G
* {@link java.awt.image.PixelInterleavedSampleModel} fashion (except if {@code bandDimension} is
* after all existing {@code areaOfInterest} dimensions, in which case data become organized in a
* {@link java.awt.image.BandedSampleModel} fashion). This method converts the specified domain
- * (decomposed in {@code areaOfInterest} and {@code subsamplings} parameters) into a larger domain
+ * (decomposed in {@code areaOfInterest} and {@code subsampling} parameters) into a larger domain
* encompassing band dimension as if it was an ordinary space or time dimension. It makes possible
* to use this domain with {@link org.apache.sis.internal.storage.io.HyperRectangleReader} for example.
*
@@ -366,20 +366,20 @@ public abstract class AbstractGridResource extends AbstractResource implements G
* <li>{@link #getPixelStride()}</li>
* </ul>
*
- * @param subsamplings the subsampling to which to add a new dimension for bands.
+ * @param subsampling the subsampling to which to add a new dimension for bands.
* @param bandDimension index of the band dimension.
* @return a new subsampling array with the same values than the given array plus one dimension for bands.
*/
- public int[] insertSubsampling(int[] subsamplings, final int bandDimension) {
+ public int[] insertSubsampling(int[] subsampling, final int bandDimension) {
final int[] delta = new int[packed.length - 1];
for (int i=0; i<delta.length; i++) {
delta[i] = getSourceIndex(i+1) - getSourceIndex(i);
}
final int[] divisors = MathFunctions.commonDivisors(delta);
interval = (divisors.length != 0) ? divisors[divisors.length - 1] : 1;
- subsamplings = ArraysExt.insert(subsamplings, bandDimension, 1);
- subsamplings[bandDimension] = interval;
- return subsamplings;
+ subsampling = ArraysExt.insert(subsampling, bandDimension, 1);
+ subsampling[bandDimension] = interval;
+ return subsampling;
}
/**
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Region.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Region.java
index 123a02b..05230d5 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Region.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/Region.java
@@ -69,7 +69,7 @@ public final class Region {
* <li><i>etc.</i></li>
* </ol>
*
- * Values are determined by the {@code subsamplings} argument given at construction time.
+ * Values are determined by the {@code subsampling} argument given at construction time.
* The length of this array is the hyper-rectangle dimension plus one.
*/
private final long[] skips;
@@ -94,18 +94,18 @@ public final class Region {
* <li>{@code size[i] > 0} for all <var>i</var></li>
* <li>{@code regionLower[i] >= 0} for all <var>i</var></li>
* <li>{@code regionLower[i] < regionUpper[i] <= size[i]} for all <var>i</var></li>
- * <li>{@code subsamplings[i] > 0} for all <var>i</var></li>
+ * <li>{@code subsampling[i] > 0} for all <var>i</var></li>
* <li>The total length of data to read does not exceed {@link Integer#MAX_VALUE}.</li>
* </ul>
*
- * @param size the number of elements along each dimension.
- * @param regionLower index of the first value to read or write along each dimension.
- * @param regionUpper index after the last value to read or write along each dimension.
- * @param subsamplings subsampling along each dimension. Shall be greater than zero.
+ * @param size the number of elements along each dimension.
+ * @param regionLower index of the first value to read or write along each dimension.
+ * @param regionUpper index after the last value to read or write along each dimension.
+ * @param subsampling subsampling along each dimension. Shall be greater than zero.
* @throws ArithmeticException if the size of the region to read exceeds {@link Integer#MAX_VALUE},
* or the total hyper-cube size exceeds {@link Long#MAX_VALUE}.
*/
- public Region(final long[] size, final long[] regionLower, final long[] regionUpper, final int[] subsamplings) {
+ public Region(final long[] size, final long[] regionLower, final long[] regionUpper, final int[] subsampling) {
final int dimension = size.length;
targetSize = new int[dimension];
skips = new long[dimension + 1];
@@ -113,8 +113,8 @@ public final class Region {
long stride = 1;
long skip = 0;
for (int i=0; i<dimension;) {
- final int step = subsamplings[i];
- final long lower = regionLower[i];
+ final int step = subsampling[i];
+ final long lower = regionLower[i];
final long count = ceilDiv(regionUpper[i] - lower, step);
final long upper = lower + ((count-1) * step + 1);
final long span = size[i];
diff --git a/storage/sis-storage/src/test/java/org/apache/sis/test/storage/CoverageReadConsistency.java b/storage/sis-storage/src/test/java/org/apache/sis/test/storage/CoverageReadConsistency.java
index 1fdc59a..6c2fe68 100644
--- a/storage/sis-storage/src/test/java/org/apache/sis/test/storage/CoverageReadConsistency.java
+++ b/storage/sis-storage/src/test/java/org/apache/sis/test/storage/CoverageReadConsistency.java
@@ -89,9 +89,9 @@ public strictfp class CoverageReadConsistency extends TestCase {
private boolean allowOffsets;
/**
- * Whether to use random subsamplings.
+ * Whether to use random subsampling.
*/
- private boolean allowSubsamplings;
+ private boolean allowSubsampling;
/**
* Whether to use random selection of bands.
@@ -192,7 +192,7 @@ public strictfp class CoverageReadConsistency extends TestCase {
@Test
@DependsOnMethod("testSubRegionAtOrigin")
public void testSubsamplingAtOrigin() throws DataStoreException {
- allowSubsamplings = true;
+ allowSubsampling = true;
readAndCompareRandomRegions("Subsampling at (0,0)");
}
@@ -206,7 +206,7 @@ public strictfp class CoverageReadConsistency extends TestCase {
@DependsOnMethod({"testSubsamplingAtOrigin", "testSubRegionsAnywhere"})
public void testSubsamplingAnywhere() throws DataStoreException {
allowOffsets = true;
- allowSubsamplings = true;
+ allowSubsampling = true;
readAndCompareRandomRegions("Subsampling");
}
@@ -246,7 +246,7 @@ public strictfp class CoverageReadConsistency extends TestCase {
public void testAllAnywhere() throws DataStoreException {
allowOffsets = true;
allowBandSubset = true;
- allowSubsamplings = true;
+ allowSubsampling = true;
readAndCompareRandomRegions("All (ms)");
}
@@ -280,7 +280,7 @@ public strictfp class CoverageReadConsistency extends TestCase {
}
high[d] = low[d] + rs;
subsampling[d] = 1;
- if (allowSubsamplings) {
+ if (allowSubsampling) {
subsampling[d] += random.nextInt(StrictMath.max(rs / 16, 1));
}
}
@@ -356,7 +356,7 @@ public strictfp class CoverageReadConsistency extends TestCase {
* If subsampling was enabled, the factors selected by the reader may be different than
* the subsampling factors that we specified. The following block updates those values.
*/
- if (allowSubsamplings && full != null) {
+ if (allowSubsampling && full != null) {
final GridDerivation change = full.getGridGeometry().derive().subgrid(subset.getGridGeometry());
System.arraycopy(change.getSubsampling(), 0, subsampling, 0, dimension);
System.arraycopy(change.getSubsamplingOffsets(), 0, subOffsets, 0, dimension);
@@ -370,7 +370,7 @@ public strictfp class CoverageReadConsistency extends TestCase {
final long[] sliceMax = actualReadExtent.getHigh().getCoordinateValues();
nextSlice: for (;;) {
System.arraycopy(sliceMin, BIDIMENSIONAL, sliceMax, BIDIMENSIONAL, dimension - BIDIMENSIONAL);
- final PixelIterator itr = iterator(full, sliceMin, sliceMax, subsampling, subOffsets, allowSubsamplings);
+ final PixelIterator itr = iterator(full, sliceMin, sliceMax, subsampling, subOffsets, allowSubsampling);
final PixelIterator itc = iterator(subset, sliceMin, sliceMax, subsampling, subOffsets, false);
if (itr != null) {
assertEquals(itr.getDomain().getSize(), itc.getDomain().getSize());
@@ -467,7 +467,7 @@ nextSlice: for (;;) {
* @return pixel iterator over requested area, or {@code null} if unavailable.
*/
private static PixelIterator iterator(final GridCoverage coverage, long[] sliceMin, long[] sliceMax,
- final int[] subsampling, final int[] subOffsets, final boolean allowSubsamplings)
+ final int[] subsampling, final int[] subOffsets, final boolean allowSubsampling)
{
if (coverage == null) {
return null;
@@ -483,7 +483,7 @@ nextSlice: for (;;) {
* If the given coordinates were in a subsampled space while the coverage is at full resolution,
* convert the coordinates to full resolution.
*/
- if (allowSubsamplings) {
+ if (allowSubsampling) {
sliceMin = sliceMin.clone();
sliceMax = sliceMax.clone();
for (int i=0; i<sliceMin.length; i++) {
@@ -500,7 +500,7 @@ nextSlice: for (;;) {
* we shift the whole `sliceAOI` (which is equivalent to subtracting `subX|Y` in full resolution coordinates)
* and set the offset to the complement.
*/
- if (allowSubsamplings) {
+ if (allowSubsampling) {
final int subX = subsampling[0];
final int subY = subsampling[1];
if (subX > image.getTileWidth() || subY > image.getTileHeight()) {