|
4 | 4 | import com.bc.fiduceo.NCTestUtils; |
5 | 5 | import com.bc.fiduceo.TestUtil; |
6 | 6 | import com.bc.fiduceo.core.Dimension; |
| 7 | +import com.bc.fiduceo.core.Interval; |
7 | 8 | import com.bc.fiduceo.core.NodeType; |
8 | 9 | import com.bc.fiduceo.geometry.*; |
9 | 10 | import com.bc.fiduceo.location.PixelLocator; |
|
15 | 16 | import org.junit.Before; |
16 | 17 | import org.junit.Test; |
17 | 18 | import org.junit.runner.RunWith; |
| 19 | +import ucar.ma2.ArrayInt; |
| 20 | +import ucar.ma2.DataType; |
18 | 21 | import ucar.ma2.InvalidRangeException; |
19 | 22 | import ucar.nc2.Variable; |
20 | 23 |
|
@@ -188,31 +191,60 @@ public void testGetVariables_CDF3TD() throws IOException, InvalidRangeException |
188 | 191 |
|
189 | 192 | Variable variable = variables.get(0); |
190 | 193 | assertEquals("X_Swath", variable.getShortName()); |
| 194 | + assertEquals(DataType.FLOAT, variable.getDataType()); |
191 | 195 | NCTestUtils.assertAttribute(variable, "_FillValue", "9.96921E36"); |
| 196 | + NCTestUtils.assertAttribute(variable, "units", "m"); |
| 197 | + NCTestUtils.assertAttribute(variable, "long_name", "Minimum distance of grid point to the sub satellite point track"); |
192 | 198 |
|
193 | 199 | variable = variables.get(3); |
194 | 200 | assertEquals("BT_H_ch02", variable.getShortName()); |
| 201 | + assertEquals(DataType.SHORT, variable.getDataType()); |
195 | 202 | NCTestUtils.assertAttribute(variable, "_FillValue", "-32768"); |
| 203 | + NCTestUtils.assertAttribute(variable, "units", "K"); |
| 204 | + NCTestUtils.assertAttribute(variable, "long_name", "Angle class averaged Brightness temperature in H-pol over current Earth fixed grid point, obtained by polarisation rotation from L1c data"); |
| 205 | + NCTestUtils.assertAttribute(variable, "add_offset", "200.0"); |
| 206 | + NCTestUtils.assertAttribute(variable, "scale_factor", "0.0061037018951994385"); |
196 | 207 |
|
197 | 208 | variable = variables.get(38); |
198 | 209 | assertEquals("BT_3_ch07", variable.getShortName()); |
| 210 | + assertEquals(DataType.SHORT, variable.getDataType()); |
199 | 211 | NCTestUtils.assertAttribute(variable, "_FillValue", "-32768"); |
| 212 | + NCTestUtils.assertAttribute(variable, "units", "K"); |
| 213 | + NCTestUtils.assertAttribute(variable, "long_name", "Angle class averaged Brightness temperature 3rd Stokes parameter over current Earth fixed grid point, obtained by polarisation rotation from L1c data"); |
| 214 | + NCTestUtils.assertAttribute(variable, "add_offset", "0.0"); |
| 215 | + NCTestUtils.assertAttribute(variable, "scale_factor", "0.0015259254737998596"); |
200 | 216 |
|
201 | 217 | variable = variables.get(175); |
202 | 218 | assertEquals("Pixel_BT_Standard_Deviation_4_ch09", variable.getShortName()); |
| 219 | + assertEquals(DataType.SHORT, variable.getDataType()); |
203 | 220 | NCTestUtils.assertAttribute(variable, "_FillValue", "-32768"); |
| 221 | + NCTestUtils.assertAttribute(variable, "units", "K"); |
| 222 | + NCTestUtils.assertAttribute(variable, "long_name", "Angle class BT standard deviation in the Brightness Temperature presented in the previous field, extracted in the direction of the pixel "); |
| 223 | + NCTestUtils.assertAttribute(variable, "add_offset", "25.0"); |
| 224 | + NCTestUtils.assertAttribute(variable, "scale_factor", "7.629627368999298E-4"); |
204 | 225 |
|
205 | 226 | variable = variables.get(219); |
206 | 227 | assertEquals("Footprint_Axis1_ch08", variable.getShortName()); |
| 228 | + assertEquals(DataType.SHORT, variable.getDataType()); |
207 | 229 | NCTestUtils.assertAttribute(variable, "_FillValue", "-32768"); |
| 230 | + NCTestUtils.assertAttribute(variable, "units", "km"); |
| 231 | + NCTestUtils.assertAttribute(variable, "long_name", "Angle class averaged Elliptical footprint major semi-axis value"); |
| 232 | + NCTestUtils.assertAttribute(variable, "add_offset", "50.0"); |
| 233 | + NCTestUtils.assertAttribute(variable, "scale_factor", "0.0015259254737998596"); |
208 | 234 |
|
209 | 235 | variable = variables.get(305); |
210 | 236 | assertEquals("Nb_SUN_Flags_ch04", variable.getShortName()); |
| 237 | + assertEquals(DataType.SHORT, variable.getDataType()); |
211 | 238 | NCTestUtils.assertAttribute(variable, "_FillValue", "-32768"); |
| 239 | + NCTestUtils.assertAttribute(variable, "units", "NA"); |
| 240 | + NCTestUtils.assertAttribute(variable, "long_name", "Number of views flagged as potentially contaminated by Sun used to compute Angle class averages"); |
212 | 241 |
|
213 | 242 | variable = variables.get(361); |
214 | 243 | assertEquals("UTC_Microseconds_ch15", variable.getShortName()); |
| 244 | + assertEquals(DataType.INT, variable.getDataType()); |
215 | 245 | NCTestUtils.assertAttribute(variable, "_FillValue", "-2147483647"); |
| 246 | + NCTestUtils.assertAttribute(variable, "units", "10-6s"); |
| 247 | + NCTestUtils.assertAttribute(variable, "long_name", "UTC Time at which the averaged BT was taken, in EE CFI transport time format. Microseconds"); |
216 | 248 | } finally { |
217 | 249 | reader.close(); |
218 | 250 | } |
@@ -256,6 +288,26 @@ public void testGetTimeLocator_CDF3TA() throws IOException { |
256 | 288 | } |
257 | 289 | } |
258 | 290 |
|
| 291 | + @Test |
| 292 | + public void testReadAcquisitionTime_CDF3TD() throws IOException, InvalidRangeException { |
| 293 | + final File file = getCDF3TDFile(); |
| 294 | + |
| 295 | + try { |
| 296 | + reader.open(file); |
| 297 | + final ArrayInt.D2 acquisitionTime = reader.readAcquisitionTime(166, 67, new Interval(5, 3)); |
| 298 | + assertEquals(15, acquisitionTime.getSize()); |
| 299 | + |
| 300 | + // run over a section that covers a swath border tb 2022-10-13 |
| 301 | + NCTestUtils.assertValueAt(-2147483647, 0, 1, acquisitionTime); |
| 302 | + NCTestUtils.assertValueAt(-2147483647, 1, 1, acquisitionTime); |
| 303 | + NCTestUtils.assertValueAt(1511142933, 2, 1, acquisitionTime); |
| 304 | + NCTestUtils.assertValueAt(1511142929, 3, 1, acquisitionTime); |
| 305 | + NCTestUtils.assertValueAt(1511142923, 4, 1, acquisitionTime); |
| 306 | + } finally { |
| 307 | + reader.close(); |
| 308 | + } |
| 309 | + } |
| 310 | + |
259 | 311 | private File getCDF3TAFile() throws IOException { |
260 | 312 | final String testFilePath = TestUtil.assembleFileSystemPath(new String[]{"miras-smos-CDF3TA", "re07", "2016", "162", "SM_RE07_MIR_CDF3TA_20160610T000000_20160610T235959_330_001_7.tgz"}, false); |
261 | 313 | return TestUtil.getTestDataFileAsserted(testFilePath); |
|
0 commit comments