Skip to content

Commit bc82806

Browse files
committed
fixed bug in time-series extraction
1 parent 9502967 commit bc82806

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
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

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)