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

Add support for NIDS product code 180 #1333

Merged
merged 1 commit into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cdm/src/main/java/ucar/nc2/iosp/nids/Nidsheader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,7 @@ int pcode_radial( ByteBuffer bos, int hoff, int hedsiz, boolean isZ, byte[] dat
addParameter(vName, lName, ncfile, dims1, att, DataType.DOUBLE, "milliseconds since 1970-01-01 00:00 UTC"
,hoff, hedsiz, isZ, 0);
//add RAW, BRIT variables for all radial variable
if(pcode == 182 || pcode == 99 ) {
if(pcode == 182 || pcode == 99 || pcode == 180) {
levels = getTDWRLevels(nlevel, threshold);
iscale = 10;
} else if (pcode == 186 || pcode == 94) {
Expand Down Expand Up @@ -3243,7 +3243,7 @@ Pinfo read_proddesc( ByteBuffer buf, int offset ){
p3 = (short)getInt(b2, 2);
off += 40;
if(pcode == 182 || pcode == 186 || pcode == 32
|| pcode == 94 || pcode == 99) {
|| pcode == 94 || pcode == 99 || pcode == 180) {
for(int i = 0; i< 16; i++) {
buf.get(b2, 0, 2);
threshold[i] = (short)bytesToInt(b2[0], b2[1], false);
Expand Down Expand Up @@ -3947,7 +3947,7 @@ static double code_reslookup( int code )
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.25, /* 150-159 */
0, 0.25, 0, 0.25, 0, 0.25, 0, 0, 0, 2, /* 160-169 */
0.25, 2, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0, 0, /* 170-179 */
0, 150.0, 150.0, 0, 0, 0, 300.0, 0, 0, 0, /* 180-189 */
150.0, 150.0, 150.0, 0, 0, 0, 300.0, 0, 0, 0, /* 180-189 */
};


Expand Down Expand Up @@ -3989,7 +3989,7 @@ static int code_levelslookup( int code )
0, 0, 0, 0, 0, 0, 0, 0, 0, 256, /* 150-159 */
0, 256, 0, 256, 0, 256, 0, 0, 0, 16, /* 160-169 */
256, 16, 256, 256, 0, 0, 0, 16, 0, 0, /* 170-179 */
0, 16, 256, 0, 0, 0, 256, 0, 0, 0, /* 180-189 */
256, 16, 256, 0, 0, 0, 256, 0, 0, 0, /* 180-189 */
};


Expand Down
Binary file not shown.
24 changes: 24 additions & 0 deletions cdm/src/test/java/ucar/nc2/iosp/nids/TestNids.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
package ucar.nc2.iosp.nids;

import junit.framework.*;
import org.junit.Assert;
import ucar.ma2.*;
import ucar.ma2.MAMath.MinMax;
import ucar.nc2.*;
import ucar.unidata.util.test.TestDir;

Expand Down Expand Up @@ -413,6 +415,28 @@ public void testNidsReadDPA() throws IOException {
ncfile.close();
}

public void testRadialImageMessagePcode180() throws IOException {
// Radial Image message, product code 180 (TDWR)
double comparisonTolerance = 0.1;
String basereflect180TdwrFile = TestDir.cdmLocalTestDataDir + "nids/Level3_TUL_TZ0_20200811_1804.nids";
try (NetcdfFile ncf = NetcdfFile.open(basereflect180TdwrFile)) {
Variable bref = ncf.findVariable("BaseReflectivity");
Array data = bref.read();
double max = MAMath.getMaximum(data);
// max reflectivity value as shown by NWS web display at the time
// not a *great* check, but not the worst either.
Assert.assertTrue(Math.abs(max - 56.5) < comparisonTolerance);
// test that range of the radial axis variable is good
// expect 0 to 48 nautical miles (according to the ICD)
// which is roughly 0 to 88650 meters
Variable gate = ncf.findVariable("gate");
Array gateValues = gate.read();
MinMax minMax = MAMath.getMinMax(gateValues);
Assert.assertTrue(Math.abs(minMax.min) < comparisonTolerance);
Assert.assertTrue(Math.abs(minMax.max - 88650) < comparisonTolerance);
}
}

private void testReadData(Variable v) {
Array a = null;
assert(null != v);
Expand Down