Skip to content

Commit a8c5e52

Browse files
Change maven project version to 1.5.9-SNAPSHOT
The "equals()" implementation of com.bc.fiduceo.geometry.Point and subclasses has been changed to override Object.equals(). This change allows this equals method to be used in JUnit's assertEquals as usual. SmapReader.extractGeoMinMax() has been changed to deal with the fact that the products are verically flipped and latitude values are flipped as well.
1 parent 87be721 commit a8c5e52

File tree

20 files changed

+72
-28
lines changed

20 files changed

+72
-28
lines changed

cems/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<parent>
2626
<artifactId>fiduceo-master</artifactId>
2727
<groupId>com.bc.fiduceo</groupId>
28-
<version>1.5.8</version>
28+
<version>1.5.9-SNAPSHOT</version>
2929
</parent>
3030

3131
<modelVersion>4.0.0</modelVersion>

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>fiduceo-master</artifactId>
77
<groupId>com.bc.fiduceo</groupId>
8-
<version>1.5.8</version>
8+
<version>1.5.9-SNAPSHOT</version>
99
</parent>
1010

1111
<modelVersion>4.0.0</modelVersion>

core/src/main/java/com/bc/fiduceo/geometry/Point.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ public interface Point extends Geometry {
3232

3333
void setLat(double lat);
3434

35-
boolean equals(Point other);
35+
boolean equals(Object other);
3636
}

core/src/main/java/com/bc/fiduceo/geometry/jts/JTSPoint.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ public void setLat(double lat) {
8080
}
8181

8282
@Override
83-
public boolean equals(Point other) {
83+
public boolean equals(Object o) {
84+
if (o == null || !(o instanceof JTSPoint)) {
85+
return false;
86+
}
87+
final JTSPoint other = (JTSPoint) o;
8488
return other == this || other.getLon() == getLon() && other.getLat() == getLat();
8589
}
8690
}

core/src/main/java/com/bc/fiduceo/geometry/s2/BcS2Point.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ public String toString() {
103103
}
104104

105105
@Override
106-
public boolean equals(Point other) {
106+
public boolean equals(Object o) {
107+
if (o == null || !(o instanceof BcS2Point)) {
108+
return false;
109+
}
110+
final BcS2Point other = (BcS2Point) o;
107111
return other == this || other.getLon() == getLon() && other.getLat() == getLat();
108112
}
109113

core/src/main/java/com/bc/fiduceo/reader/smap/SmapReader.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,21 +409,23 @@ private double[] extractGeoMinMax() throws IOException {
409409
lonMax = minMax.max;
410410
}
411411
}
412-
for (int i = 0; i < height; i++) { // top down
412+
// Find latitude maximum --> the product is mirrored vertically --> positive values are at the lower end.
413+
for (int i = height - 1; i >= 0; i--) { // bottom up
413414
latOrigin[dimIdxY] = i;
414415
final Array section = latArr.section(latOrigin, horizontalSection);
415416
final MAMath.MinMax minMax = MAMath.getMinMaxSkipMissingData(section, fillValue);
416-
if (minMax.min == Double.MAX_VALUE) {
417+
if (minMax.max == latMax) {
417418
continue;
418419
}
419420
latMax = minMax.max;
420421
break;
421422
}
422-
for (int i = height - 1; i >= 0; i--) { // bottom up
423+
// Find latitude minimum --> the product is mirrored vertically --> negative values are at the upper end.
424+
for (int i = 0; i < height; i++) { // top down
423425
latOrigin[dimIdxY] = i;
424426
final Array section = latArr.section(latOrigin, horizontalSection);
425427
final MAMath.MinMax minMax = MAMath.getMinMaxSkipMissingData(section, fillValue);
426-
if (minMax.min == Double.MAX_VALUE) {
428+
if (minMax.min == latMin) {
427429
continue;
428430
}
429431
latMin = minMax.min;

core/src/test/java/com/bc/fiduceo/db/DbMaintenanceToolIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void testInvalidCommandLine() throws ParseException {
6161
psE.flush();
6262

6363
assertEquals("", out.toString());
64-
assertEquals("db-maintenance-tool version 1.5.8" + ls +
64+
assertEquals("db-maintenance-tool version 1.5.9-SNAPSHOT" + ls +
6565
ls +
6666
"usage: db_maintenance <options>" + ls +
6767
"Valid options are:" + ls +

core/src/test/java/com/bc/fiduceo/db/DbMaintenanceToolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void testPrintUsageTo() {
5959

6060
tool.printUsageTo(stream);
6161

62-
assertEquals("db-maintenance-tool version 1.5.8" + ls +
62+
assertEquals("db-maintenance-tool version 1.5.9-SNAPSHOT" + ls +
6363
ls +
6464
"usage: db_maintenance <options>" + ls +
6565
"Valid options are:" + ls +

core/src/test/java/com/bc/fiduceo/qc/MmdQCToolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void testPrintUsageTo() {
1717

1818
MmdQCTool.printUsageTo(outputStream);
1919

20-
assertEquals("mmd-qc-tool version 1.5.8" + ls +
20+
assertEquals("mmd-qc-tool version 1.5.9-SNAPSHOT" + ls +
2121
ls +
2222
"usage: mmd-qc-tool <options>" + ls +
2323
"Valid options are:" + ls +

core/src/test/java/com/bc/fiduceo/reader/smap/SmapReader_IO_Test.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ public void testReadAcquisitionInfo() throws IOException {
6767
Point[] coordinates = boundingGeometry.getCoordinates();
6868
assertEquals(5, coordinates.length);
6969
assertEquals(-179.98402404785156, coordinates[0].getLon(), 1e-8);
70-
assertEquals(86.34670257568361, coordinates[0].getLat(), 1e-8);
70+
assertEquals(-86.61946868896484, coordinates[0].getLat(), 1e-8);
7171
assertEquals(179.99179077148438, coordinates[1].getLon(), 1e-8);
72-
assertEquals(86.34670257568361, coordinates[1].getLat(), 1e-8);
72+
assertEquals(-86.61946868896484, coordinates[1].getLat(), 1e-8);
7373
assertEquals(179.99179077148438, coordinates[2].getLon(), 1e-8);
74-
assertEquals(-86.5008316040039, coordinates[2].getLat(), 1e-8);
74+
assertEquals(86.40682220458984, coordinates[2].getLat(), 1e-8);
7575
assertEquals(-179.98402404785156, coordinates[3].getLon(), 1e-8);
76-
assertEquals(-86.5008316040039, coordinates[3].getLat(), 1e-8);
76+
assertEquals(86.40682220458984, coordinates[3].getLat(), 1e-8);
7777
assertEquals(-179.98402404785156, coordinates[4].getLon(), 1e-8);
78-
assertEquals(86.34670257568361, coordinates[4].getLat(), 1e-8);
78+
assertEquals(-86.61946868896484, coordinates[4].getLat(), 1e-8);
7979

8080
final Date sensingStart = info.getSensingStart();
8181
TestUtil.assertCorrectUTCDate(2018, 2, 4, 20, 23, 11, sensingStart);
@@ -91,8 +91,12 @@ public void testReadAcquisitionInfo() throws IOException {
9191
assertEquals(4, coordinates.length);
9292
assertEquals(-179.98402404785156, coordinates[0].getLon(), 1e-8);
9393
assertEquals(0.0, coordinates[0].getLat(), 1e-8);
94+
assertEquals(179.99179077148438, coordinates[1].getLon(), 1e-8);
95+
assertEquals(0.0, coordinates[1].getLat(), 1e-8);
96+
assertEquals(0.0, coordinates[2].getLon(), 1e-8);
97+
assertEquals(86.40682220458984, coordinates[2].getLat(), 1e-8);
9498
assertEquals(0.0, coordinates[3].getLon(), 1e-8);
95-
assertEquals(86.34670257568361, coordinates[3].getLat(), 1e-8);
99+
assertEquals(-86.61946868896484, coordinates[3].getLat(), 1e-8);
96100

97101
assertEquals(NodeType.UNDEFINED, info.getNodeType());
98102
} finally {

0 commit comments

Comments
 (0)