Skip to content
Dan Kelley edited this page Dec 29, 2016 · 9 revisions

Parent: notes on issue solutions

Problem with RDI .pd0 file that was created with RDI software

STATUS. Possibly working -- requires reporter check on values, though.

SUMMARY. This page holds Dan's notes, as he works on these files for issue 1153 (https://github.com/dankelley/oce/issues/1153). The files are not public, and these notes may make no sense to anyone but Dan and Clark.

dataOffset differences

Below are cut/pasted from output with debug>3 or so.

A

  dataOffset= 28 88 154 692 962 1232 1248 1292 1308 1342 1350 
  sort(diff(dataOffset))= 8 16 16 34 44 60 66 270 270 538 

B

  dataOffset= 28 87 152 168 202 218 756 1026 1296 1566 1610 
  sort(diff(dataOffset))= 16 16 34 44 59 65 270 270 270 538 

Observation the first two are 1 element shorter for file B. I'm not sure why that would be, but perhaps things have changed in the format. The rest are more confusing. How can B have a data chunk that's 8 bytes long, when A has nothing that short? And what the heck is in such a chunk? I'll need to read some more to learn. Maybe the codes will help

codes

Codes are used in R/adp.rdi.R near line 92 to determine whether the file is of Sentinel V type. (Both files are.)

A

  codes[,1]= 7f 00 80 00 00 00 00 01 02 00 04 03 
  codes[,2]= 7f 00 00 01 02 03 70 70 70 32 70 70 

B

  codes[,1]= 7f 00 80 00 00 02 00 00 00 00 01 03 
  codes[,2]= 7f 00 00 70 32 70 01 03 02 04 70 70 

A clue

I've been instrumenting the code (Clark -- none of this is being pushed to GH) and have seen that in the B file, the code "knows" that the file type is sentinelV at one spot, but then forgets that and thinks it's a workhorse. So we have a clue, finally.

Possible solution

The problem may have been in the identification of RDI type in R/adp.rdi.R near line 296. Previously, we were using the value of FLDLength to infer instrumentSubtype. But in this case, the value of FLDLength in the A.pd0 file does not agree with that in the B.pd0 file, so this method failed. But if the instrument is already known to be SentinelV (as determined by examination of the codes matrix, near R/adp.rdi.R line 96) then there is no need to make a guess based on FLDLength. I therefore altered the code near line 296, to check the value of isSentinel before examining FLDLength. I also put a shout-font comment block near line 296, so that if we have problems in the future, this is a spot to look at. (I suggest to Clark that we do this from now on. There are probably 4 to 6 spots in the overall oce code that have proven troublesome, and most have comments near them about a worry that the method will work. Therefore, I propose we set up a scheme for uniformly-formatted comment blocks, so we can jump to suspected problem spots quickly, without having to remember them.)