Skip to content

Commit 0555f70

Browse files
committed
Merge branch 'master' into TB_smos_gridded_daily
2 parents 1a8c996 + bc82806 commit 0555f70

File tree

6 files changed

+28
-19
lines changed

6 files changed

+28
-19
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* updated SLSTR reader to allow switching geo-coding source between tie-point/pixel
1010
* added database timeout to configuration
1111
* Updated ERA5 post-processing - simplify configuration
12+
* Fixed bug in ERA5 post-processing - time series iteration was incorrect
1213

1314
### Updates from version 1.5.4 to 1.5.5
1415
* updated to use SNAP version 8.0.9 / S3TBX version 8.0.6

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ public File createDir(String directoryName) throws IOException {
7070
}
7171

7272
public void delete(File tempFile) {
73-
deleteFileIfExists(tempFile);
73+
final boolean deleted = deleteFileIfExists(tempFile);
7474

75-
tempFileList.remove(tempFile);
75+
if (deleted) {
76+
tempFileList.remove(tempFile);
77+
}
7678
}
7779

7880
public void cleanup() {
@@ -85,17 +87,21 @@ public void cleanup() {
8587
}
8688
}
8789

88-
private void deleteFileIfExists(File tempFile) {
90+
private boolean deleteFileIfExists(File tempFile) {
91+
boolean success = true;
8992
if (tempFile.isFile()) {
9093
if (!tempFile.delete()) {
9194
FiduceoLogger.getLogger().warning("Unable to delete file: " + tempFile.getAbsolutePath());
95+
success = false;
9296
}
9397
}
9498
if (tempFile.isDirectory()) {
9599
if (!FileUtils.deleteTree(tempFile)) {
96100
FiduceoLogger.getLogger().warning("Unable to delete directory: " + tempFile.getAbsolutePath());
101+
success = false;
97102
}
98103
}
104+
return success;
99105
}
100106

101107
public void keepAfterCleanup(boolean keep) {

matchup-tool/src/main/java/com/bc/fiduceo/matchup/strategy/InsituPolarOrbitingMatchupStrategy.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ public MatchupCollection createMatchupCollection(ToolContext context) throws SQL
178178
applyConditionsAndScreenings(matchupSet, conditionEngine, conditionEngineContext, screeningEngine, primaryReader, secondaryReaders);
179179
}
180180

181+
readerCache.close();
182+
181183
return combineBean.matchupCollection;
182184
}
183185

post-processing-tool/src/main/java/com/bc/fiduceo/post/plugin/era5/MatchupFields.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ void compute(Configuration config, NetcdfFile reader, NetcdfFileWriter writer) t
110110
for (int m = 0; m < numMatches; m++) {
111111
nwpOffset[0] = m;
112112

113-
final Array lonLayer = lonArray.section(nwpOffset, nwpShape);
114-
final Array latLayer = latArray.section(nwpOffset, nwpShape);
113+
final Array lonLayer = lonArray.section(nwpOffset, nwpShape).copy();
114+
final Array latLayer = latArray.section(nwpOffset, nwpShape).copy();
115115

116116
final InterpolationContext interpolationContext = Era5PostProcessing.getInterpolationContext(lonLayer, latLayer);
117117
final Rectangle layerRegion = interpolationContext.getEra5Region();

post-processing-tool/src/main/java/com/bc/fiduceo/post/plugin/era5/SatelliteFields.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ void compute(Configuration config, NetcdfFile reader, NetcdfFileWriter writer) t
221221
nwpShape[0] = 1;
222222

223223
// get a subset of one matchup layer and convert to 2D dataset
224-
final Array lonLayer = lonArray.sectionNoReduce(nwpOffset, nwpShape, nwpStride).reduce(0);
225-
final Array latLayer = latArray.sectionNoReduce(nwpOffset, nwpShape, nwpStride).reduce(0);
224+
final Array lonLayer = lonArray.sectionNoReduce(nwpOffset, nwpShape, nwpStride).reduce(0).copy();
225+
final Array latLayer = latArray.sectionNoReduce(nwpOffset, nwpShape, nwpStride).reduce(0).copy();
226226

227227
final int[] shape = lonLayer.getShape();
228228
final int width = shape[1];

post-processing-tool/src/test/java/com/bc/fiduceo/post/PostProcessingToolIntegrationTest_Era5.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,27 +131,27 @@ public void testAddEra5Variables_mmd15() throws IOException, InvalidRangeExcepti
131131

132132
variable = NCTestUtils.getVariable("nwp_mu_u10", mmd);
133133
NCTestUtils.assertAttribute(variable, "units", "m s**-1");
134-
NCTestUtils.assert2DValueFloat(4, 3, 1.5901726484298706f, variable);
135-
NCTestUtils.assert2DValueFloat(5, 3, 1.4782710075378418f, variable);
136-
NCTestUtils.assert2DValueFloat(6, 3, 1.315316915512085f, variable);
134+
NCTestUtils.assert2DValueFloat(4, 3, 1.5980221033096313f, variable);
135+
NCTestUtils.assert2DValueFloat(5, 3, 1.4887735843658447f, variable);
136+
NCTestUtils.assert2DValueFloat(6, 3, 1.3267265558242798f, variable);
137137

138138
variable = NCTestUtils.getVariable("nwp_mu_sst", mmd);
139139
NCTestUtils.assertAttribute(variable, "long_name", "Sea surface temperature");
140-
NCTestUtils.assert2DValueFloat(7, 4, 275.3016662597656f, variable);
141-
NCTestUtils.assert2DValueFloat(8, 4, 275.30181884765625f, variable);
142-
NCTestUtils.assert2DValueFloat(9, 4, 275.30181884765625f, variable);
140+
NCTestUtils.assert2DValueFloat(7, 4, 284.4002990722656f, variable);
141+
NCTestUtils.assert2DValueFloat(8, 4, 284.400390625f, variable);
142+
NCTestUtils.assert2DValueFloat(9, 4, 284.4002380371094f, variable);
143143

144144
variable = NCTestUtils.getVariable("nwp_mu_mslhf", mmd);
145145
assertNull(variable.findAttribute("standard_name"));
146-
NCTestUtils.assert2DValueFloat(10, 5, -28.066068649291992f, variable);
147-
NCTestUtils.assert2DValueFloat(11, 5, -25.100168228149414f, variable);
148-
NCTestUtils.assert2DValueFloat(12, 5, -23.159440994262695f, variable);
146+
NCTestUtils.assert2DValueFloat(10, 5, -83.63811492919922f, variable);
147+
NCTestUtils.assert2DValueFloat(11, 5, -85.87189483642578f, variable);
148+
NCTestUtils.assert2DValueFloat(12, 5, -87.71128845214844f, variable);
149149

150150
variable = NCTestUtils.getVariable("nwp_mu_msshf", mmd);
151151
NCTestUtils.assertAttribute(variable, "_FillValue", "9.969209968386869E36");
152-
NCTestUtils.assert2DValueFloat(13, 6, 12.113265037536621f, variable);
153-
NCTestUtils.assert2DValueFloat(14, 6, 13.183022499084473f, variable);
154-
NCTestUtils.assert2DValueFloat(15, 6, 13.555000305175781f, variable);
152+
NCTestUtils.assert2DValueFloat(13, 6, -8.905862808227539f, variable);
153+
NCTestUtils.assert2DValueFloat(14, 6, -9.198946952819824f, variable);
154+
NCTestUtils.assert2DValueFloat(15, 6, -10.215385437011719f, variable);
155155
}
156156
}
157157

0 commit comments

Comments
 (0)