Skip to content

Commit

Permalink
cdm-radial: sigmet
Browse files Browse the repository at this point in the history
Fix for reading data from ray for only the number of bins available
  • Loading branch information
michaeldiener authored and haileyajohnson committed Feb 5, 2024
1 parent 1d671cb commit b70e345
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cdm/radial/src/main/java/ucar/nc2/iosp/sigmet/Ray.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void readData(RandomAccessFile raf, Range gateRange, IndexIterator ii) th
break;
}
raf.seek(cur_len);
for (int i = 0; i < dataRead1; i++) {
for (int i = 0; i < dataRead1 && nb < bins; i++) {
dd[posInRay_absolute] = raf.readByte();
posInRay_absolute++;
if (posInRay_absolute % bytesPerBin == 0)
Expand All @@ -288,14 +288,15 @@ public void readData(RandomAccessFile raf, Range gateRange, IndexIterator ii) th
} else if (a00 > 0 & a00 != 1) {
int num_zero = a00 * 2;
int dataRead1 = num_zero;
for (int k = 0; k < dataRead1; k++) {
for (int k = 0; k < dataRead1 && nb < bins; k++) {
dd[posInRay_absolute] = 0;
posInRay_absolute++;
if (posInRay_absolute % bytesPerBin == 0)
nb++;
}
if (cur_len % SigmetVolumeScan.REC_SIZE == 0) {
break;

if (cur_len % SigmetVolumeScan.REC_SIZE == 0) {
break;
}
}
}

Expand Down

0 comments on commit b70e345

Please sign in to comment.