Skip to content

Commit b043ce9

Browse files
committed
cleanup
1 parent c4856ee commit b043ce9

File tree

14 files changed

+79
-52
lines changed

14 files changed

+79
-52
lines changed

core/src/main/java/com/bc/fiduceo/archive/Archive.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class Archive {
4242
private final HashMap<String, String[]> pathMaps;
4343
private final String[] defaultPath;
4444

45-
private Path rootPath;
45+
private final Path rootPath;
4646

4747
public Archive(ArchiveConfig config) {
4848
rootPath = config.getRootPath();
@@ -117,7 +117,7 @@ public Path[] get(Date startDate, Date endDate, String processingVersion, String
117117
final Path productsDir = createValidProductPath(processingVersion, sensorType, year, month, day);
118118

119119
if (Files.exists(productsDir)) {
120-
log.info("The product directory: " + productsDir.toString());
120+
log.info("The product directory: " + productsDir);
121121
final Iterator<Path> iterator = Files.list(productsDir).iterator();
122122
while (iterator.hasNext()) {
123123
final Path next = iterator.next();
@@ -129,7 +129,7 @@ public Path[] get(Date startDate, Date endDate, String processingVersion, String
129129
pathArrayList.add(next);
130130
}
131131
} else {
132-
log.warning("The directory doest not exist: " + productsDir.toString());
132+
log.warning("The directory doest not exist: " + productsDir);
133133
}
134134
utcCalendar.add(Calendar.DAY_OF_MONTH, 1);
135135
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
class BcS2MultiLineString implements MultiLineString {
3131

32-
private List<S2Polyline> s2PolylineList;
32+
private final List<S2Polyline> s2PolylineList;
3333

3434

3535
BcS2MultiLineString(List<S2Polyline> s2Polylines) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @author muhammad.bc
3333
*/
3434
class BcS2MultiPolygon implements MultiPolygon {
35-
private List<Polygon> polygonList;
35+
private final List<Polygon> polygonList;
3636

3737
BcS2MultiPolygon(List<Polygon> polygonList) {
3838
this.polygonList = polygonList;
@@ -90,7 +90,7 @@ public Point[] getCoordinates() {
9090
pointList.addAll(polygonPointList);
9191

9292
}
93-
return pointList.toArray(new Point[pointList.size()]);
93+
return pointList.toArray(new Point[0]);
9494
}
9595

9696
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
class BcS2TimeAxis implements TimeAxis {
3333

3434
private final S2Polyline polyline;
35-
private LineString originalGeometry;
35+
private final LineString originalGeometry;
3636
private final double invLength;
3737
private final Date startTime;
3838
private final long timeInterval;

core/src/main/java/com/bc/fiduceo/reader/airs/AIRS_L1B_Reader.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,8 @@ public ArrayInt.D2 readAcquisitionTime(int x, int y, Interval interval) throws I
225225
final int targetFillValue = NetCDFUtils.getDefaultFillValue(int.class).intValue();
226226
final String variableName = "Time";
227227
final Array taiSeconds = readRaw(x, y, interval, variableName);
228-
final Array utcSecondsSince1970 = Array.factory(DataType.INT, taiSeconds.getShape());
229228
final Number fillValue = fillValueMap.get(variableName);
230-
for (int i = 0; i < taiSeconds.getSize(); i++) {
231-
double val = taiSeconds.getDouble(i);
232-
final int targetVal;
233-
if (fillValue.equals(val)) {
234-
targetVal = targetFillValue;
235-
} else {
236-
targetVal = (int) Math.round(TimeUtils.tai1993ToUtcInstantSeconds(val));
237-
}
238-
utcSecondsSince1970.setInt(i, targetVal);
239-
}
240-
return (ArrayInt.D2) utcSecondsSince1970;
229+
return TimeUtils.tai1993ToUtc(taiSeconds, fillValue, targetFillValue);
241230
}
242231

243232
@Override

core/src/main/java/com/bc/fiduceo/reader/caliop/CALIOP_L2_VFM_Reader.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,7 @@ public ArrayInt.D2 readAcquisitionTime(int x, int y, Interval interval) throws I
221221
final Number fillValue = getFillValue(variableName);
222222
final Array taiSeconds = readRaw(x, y, interval, variableName).reshapeNoCopy(new int[]{interval.getY(), interval.getX()});
223223
final int targetFillValue = NetCDFUtils.getDefaultFillValue(int.class).intValue();
224-
final Array utcSecondsSince1970 = Array.factory(DataType.INT, taiSeconds.getShape());
225-
for (int i = 0; i < taiSeconds.getSize(); i++) {
226-
double val = taiSeconds.getDouble(i);
227-
final int targetVal;
228-
if (fillValue.equals(val)) {
229-
targetVal = targetFillValue;
230-
} else {
231-
targetVal = (int) Math.round(TimeUtils.tai1993ToUtcInstantSeconds(val));
232-
}
233-
utcSecondsSince1970.setInt(i, targetVal);
234-
}
235-
return (ArrayInt.D2) utcSecondsSince1970;
224+
return TimeUtils.tai1993ToUtc(taiSeconds, fillValue, targetFillValue);
236225
}
237226

238227
@Override

core/src/main/java/com/bc/fiduceo/reader/caliop/CALIOP_SST_WP100_CLay_Reader.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,7 @@ public ArrayInt.D2 readAcquisitionTime(int x, int y, Interval interval) throws I
147147
final String variableName = "Profile_Time";
148148
final Number fillValue = getFillValue(variableName);
149149
final Array taiSeconds = readRaw(x, y, interval, variableName).reshapeNoCopy(new int[]{interval.getY(), interval.getX()});
150-
final Array utcSecondsSince1970 = Array.factory(DataType.INT, taiSeconds.getShape());
151-
for (int i = 0; i < taiSeconds.getSize(); i++) {
152-
double val = taiSeconds.getDouble(i);
153-
final int targetVal;
154-
if (fillValue.equals(val)) {
155-
targetVal = targetFillValue;
156-
} else {
157-
targetVal = (int) Math.round(TimeUtils.tai1993ToUtcInstantSeconds(val));
158-
}
159-
utcSecondsSince1970.setInt(i, targetVal);
160-
}
161-
return (ArrayInt.D2) utcSecondsSince1970;
150+
return TimeUtils.tai1993ToUtc(taiSeconds, fillValue, targetFillValue);
162151
}
163152

164153
@Override

core/src/main/java/com/bc/fiduceo/reader/fiduceo_fcdr/AVHRR_FCDR_Reader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class AVHRR_FCDR_Reader extends FCDR_Reader {
2525

2626
// these variables do not have dimensionality that can be handled by the core MMS engine. They need to be
2727
// transferred using a post-processing step tb 2019-01-08
28-
private static String[] VARIABLE_NAMES_TO_REMOVE = {"SRF_wavelengths",
28+
private static final String[] VARIABLE_NAMES_TO_REMOVE = {"SRF_wavelengths",
2929
"SRF_weights",
3030
"channel",
3131
"channel_correlation_matrix_common",

core/src/main/java/com/bc/fiduceo/reader/modis/BowTiePixelLocator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class BowTiePixelLocator implements PixelLocator {
5050
private int sceneWidth;
5151
private int sceneHeight;
5252
private int listSize;
53-
private int stripHeight;
53+
private final int stripHeight;
5454

5555

5656
BowTiePixelLocator(Array longitudes, Array latitudes, GeometryFactory geometryFactory, int stripHeight) throws IOException {

core/src/main/java/com/bc/fiduceo/util/TempFileUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public TempFileUtils() {
3939
this(System.getProperty("java.io.tmpdir"));
4040
}
4141

42-
public TempFileUtils(String testDir) {
43-
tempDir = new File(testDir);
42+
public TempFileUtils(String tempDir) {
43+
this.tempDir = new File(tempDir);
4444
validateTempDir();
4545
tempFileList = new ArrayList<>();
4646
keepAfterCleanup = false;

0 commit comments

Comments
 (0)