This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git
The following commit(s) were added to refs/heads/master by this push:
new 6df989782 [SEDONA-620] Simplify Java if statements (#1504)
6df989782 is described below
commit 6df989782b377932a0bfab279dc0951fab3b77a6
Author: John Bampton <[email protected]>
AuthorDate: Tue Jul 2 04:31:14 2024 +1000
[SEDONA-620] Simplify Java if statements (#1504)
---
.../java/org/apache/sedona/common/raster/RasterBandAccessors.java | 6 ++----
.../java/org/apache/sedona/common/raster/RasterBandEditors.java | 8 ++++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git
a/common/src/main/java/org/apache/sedona/common/raster/RasterBandAccessors.java
b/common/src/main/java/org/apache/sedona/common/raster/RasterBandAccessors.java
index c94d68344..4ed8e592e 100644
---
a/common/src/main/java/org/apache/sedona/common/raster/RasterBandAccessors.java
+++
b/common/src/main/java/org/apache/sedona/common/raster/RasterBandAccessors.java
@@ -392,12 +392,10 @@ public class RasterBandAccessors {
DescriptiveStatistics stats = null;
- if (pixelData == null) {
- stats = new DescriptiveStatistics(pixels);
- } else {
+ if (pixelData != null) {
pixels = pixelData.stream().mapToDouble(d -> d).toArray();
- stats = new DescriptiveStatistics(pixels);
}
+ stats = new DescriptiveStatistics(pixels);
StandardDeviation sd = new StandardDeviation(false);
diff --git
a/common/src/main/java/org/apache/sedona/common/raster/RasterBandEditors.java
b/common/src/main/java/org/apache/sedona/common/raster/RasterBandEditors.java
index 1fa633d5c..852a81db4 100644
---
a/common/src/main/java/org/apache/sedona/common/raster/RasterBandEditors.java
+++
b/common/src/main/java/org/apache/sedona/common/raster/RasterBandEditors.java
@@ -413,12 +413,12 @@ public class RasterBandEditors {
RasterUtils.isDataTypeIntegral(
RasterUtils.getDataTypeCode(RasterBandAccessors.getBandType(raster, band)));
+ double noDataValue;
if (isDataTypeIntegral) {
- double noDataValue = Integer.MIN_VALUE;
- return clip(raster, band, geometry, noDataValue, true);
+ noDataValue = Integer.MIN_VALUE;
} else {
- double noDataValue = Double.MIN_VALUE;
- return clip(raster, band, geometry, noDataValue, true);
+ noDataValue = Double.MIN_VALUE;
}
+ return clip(raster, band, geometry, noDataValue, true);
}
}