Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit 02d69c9

Browse files
authored
Merge pull request #1333 from lesserwhirls/nids
Add support for NIDS product code 180
2 parents 6216c04 + 8786101 commit 02d69c9

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

cdm/src/main/java/ucar/nc2/iosp/nids/Nidsheader.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ int pcode_radial( ByteBuffer bos, int hoff, int hedsiz, boolean isZ, byte[] dat
17291729
addParameter(vName, lName, ncfile, dims1, att, DataType.DOUBLE, "milliseconds since 1970-01-01 00:00 UTC"
17301730
,hoff, hedsiz, isZ, 0);
17311731
//add RAW, BRIT variables for all radial variable
1732-
if(pcode == 182 || pcode == 99 ) {
1732+
if(pcode == 182 || pcode == 99 || pcode == 180) {
17331733
levels = getTDWRLevels(nlevel, threshold);
17341734
iscale = 10;
17351735
} else if (pcode == 186 || pcode == 94) {
@@ -3243,7 +3243,7 @@ Pinfo read_proddesc( ByteBuffer buf, int offset ){
32433243
p3 = (short)getInt(b2, 2);
32443244
off += 40;
32453245
if(pcode == 182 || pcode == 186 || pcode == 32
3246-
|| pcode == 94 || pcode == 99) {
3246+
|| pcode == 94 || pcode == 99 || pcode == 180) {
32473247
for(int i = 0; i< 16; i++) {
32483248
buf.get(b2, 0, 2);
32493249
threshold[i] = (short)bytesToInt(b2[0], b2[1], false);
@@ -3947,7 +3947,7 @@ static double code_reslookup( int code )
39473947
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.25, /* 150-159 */
39483948
0, 0.25, 0, 0.25, 0, 0.25, 0, 0, 0, 2, /* 160-169 */
39493949
0.25, 2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0, 0, /* 170-179 */
3950-
0, 150.0, 150.0, 0, 0, 0, 300.0, 0, 0, 0, /* 180-189 */
3950+
150.0, 150.0, 150.0, 0, 0, 0, 300.0, 0, 0, 0, /* 180-189 */
39513951
};
39523952

39533953

@@ -3989,7 +3989,7 @@ static int code_levelslookup( int code )
39893989
0, 0, 0, 0, 0, 0, 0, 0, 0, 256, /* 150-159 */
39903990
0, 256, 0, 256, 0, 256, 0, 0, 0, 16, /* 160-169 */
39913991
256, 16, 256, 256, 0, 0, 0, 16, 0, 0, /* 170-179 */
3992-
0, 16, 256, 0, 0, 0, 256, 0, 0, 0, /* 180-189 */
3992+
256, 16, 256, 0, 0, 0, 256, 0, 0, 0, /* 180-189 */
39933993
};
39943994

39953995

Binary file not shown.

cdm/src/test/java/ucar/nc2/iosp/nids/TestNids.java

+24
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
package ucar.nc2.iosp.nids;
3434

3535
import junit.framework.*;
36+
import org.junit.Assert;
3637
import ucar.ma2.*;
38+
import ucar.ma2.MAMath.MinMax;
3739
import ucar.nc2.*;
3840
import ucar.unidata.util.test.TestDir;
3941

@@ -413,6 +415,28 @@ public void testNidsReadDPA() throws IOException {
413415
ncfile.close();
414416
}
415417

418+
public void testRadialImageMessagePcode180() throws IOException {
419+
// Radial Image message, product code 180 (TDWR)
420+
double comparisonTolerance = 0.1;
421+
String basereflect180TdwrFile = TestDir.cdmLocalTestDataDir + "nids/Level3_TUL_TZ0_20200811_1804.nids";
422+
try (NetcdfFile ncf = NetcdfFile.open(basereflect180TdwrFile)) {
423+
Variable bref = ncf.findVariable("BaseReflectivity");
424+
Array data = bref.read();
425+
double max = MAMath.getMaximum(data);
426+
// max reflectivity value as shown by NWS web display at the time
427+
// not a *great* check, but not the worst either.
428+
Assert.assertTrue(Math.abs(max - 56.5) < comparisonTolerance);
429+
// test that range of the radial axis variable is good
430+
// expect 0 to 48 nautical miles (according to the ICD)
431+
// which is roughly 0 to 88650 meters
432+
Variable gate = ncf.findVariable("gate");
433+
Array gateValues = gate.read();
434+
MinMax minMax = MAMath.getMinMax(gateValues);
435+
Assert.assertTrue(Math.abs(minMax.min) < comparisonTolerance);
436+
Assert.assertTrue(Math.abs(minMax.max - 88650) < comparisonTolerance);
437+
}
438+
}
439+
416440
private void testReadData(Variable v) {
417441
Array a = null;
418442
assert(null != v);

0 commit comments

Comments
 (0)