Skip to content

Commit 8b5855c

Browse files
authored
Merge pull request #1409 from michaeldiener/maint-5.x_sigmetfix
cdm-radial: fix for sigmet volume scan
2 parents e2dccad + 6a14dc6 commit 8b5855c

File tree

5 files changed

+67
-2
lines changed

5 files changed

+67
-2
lines changed

cdm/radial/src/main/java/ucar/nc2/iosp/sigmet/SigmetIOServiceProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ public ArrayList<Variable> init(RandomAccessFile raf, ucar.nc2.NetcdfFile ncfile
350350
var_name = var_name_original;
351351
int bytesPerBin = 1;
352352
List<List<Ray>> allRays = volScan.getGroup(data_name[dty]);
353-
if (allRays.size() > 0 && allRays.get(0).size() > 0)
353+
if (allRays != null && allRays.size() > 0 && allRays.get(0) != null && allRays.get(0).size() > 0
354+
&& allRays.get(0).get(0) != null)
354355
bytesPerBin = allRays.get(0).get(0).getBytesPerBin();
355356

356357
DataType dType = calcDataType(dty, bytesPerBin);

cdm/radial/src/main/java/ucar/nc2/iosp/sigmet/SigmetVolumeScan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public class SigmetVolumeScan {
224224
cur_len = len;
225225

226226
if (nsweep == number_sweeps & rays_count == beg) {
227-
return;
227+
break;
228228
}
229229

230230
if (beg_rec) {
378 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Creative Commons Attribution 4.0 International (CC BY 4.0)
2+
https://creativecommons.org/licenses/by/4.0/deed
3+
4+
IDEAM - Colombian Radar Network was accessed on 2025/01/30 from https://registry.opendata.aws/ideam-radares .
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package ucar.nc2.iosp.sigmet;
2+
3+
import org.apache.commons.io.filefilter.WildcardFileFilter;
4+
import org.junit.Test;
5+
import org.junit.runner.RunWith;
6+
import org.junit.runners.Parameterized;
7+
import org.slf4j.Logger;
8+
import org.slf4j.LoggerFactory;
9+
import ucar.nc2.NetcdfFile;
10+
import ucar.nc2.NetcdfFiles;
11+
import ucar.unidata.util.test.TestDir;
12+
13+
import java.io.IOException;
14+
import java.lang.invoke.MethodHandles;
15+
import java.util.ArrayList;
16+
import java.util.Collection;
17+
18+
@RunWith(Parameterized.class)
19+
public class TestIdeamCo {
20+
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
21+
22+
String filename;
23+
24+
@Parameterized.Parameters(name = "{0}")
25+
public static Collection<Object[]> getTestParameters() throws IOException {
26+
final Collection<Object[]> filenames = new ArrayList<>();
27+
28+
try {
29+
TestDir.actOnAll(TestDir.localTestDataDir + "sigmet/", new WildcardFileFilter("BAR250130122328.RAWK8Y1"),
30+
new TestDir.Act() {
31+
public int doAct(String filename) throws IOException {
32+
filenames.add(new Object[] {filename});
33+
return 1;
34+
}
35+
}, true);
36+
} catch (IOException e) {
37+
// JUnit *always* executes a test class's @Parameters method, even if it won't subsequently run the class's tests
38+
// due to an @Category exclusion. Therefore, we must not let it throw an exception, or else we'll get a build
39+
// failure. Instead, we return a collection containing a nonsense value (to wit, the exception message).
40+
//
41+
// Naturally, if we execute a test using that nonsense value, it'll fail. That's fine; we need to deal with the
42+
// root cause. However, it is more likely that the exception occurred because "!isCdmUnitTestDirAvailable", and
43+
// as a result, all NeedsCdmUnitTest tests will be excluded.
44+
filenames.add(new Object[] {e.getMessage()});
45+
}
46+
47+
return filenames;
48+
}
49+
50+
public TestIdeamCo(String filename) {
51+
this.filename = filename;
52+
}
53+
54+
@Test
55+
public void testOpen() throws IOException {
56+
try (NetcdfFile nc = NetcdfFiles.open(filename)) {
57+
58+
}
59+
}
60+
}

0 commit comments

Comments
 (0)