[Bug/Improvement] CRDParser's COMMENTS

Dear all,

When I read the crd/npt file downloaded from ilrs using Orekit-11.0, it complains that “java.lang.IllegalStateException: stream has already been operated upon or closed”.

I’ve debugged carefully, and found that the reason is the COMMENTS(“00”) records.

Here is an example of crd/npt file.

H1 CRD  1 2021 01 19 23
H2 KTZL       1893 18 01  4
H3 lageos1     7603901 1155     8820 0 1
H4  1 2021 01 19 23 04 46 2021 01 19 23 15 03  0 0 0 0 1 0 2 0
C0 0  532.0 PDAS PCOD NCOL NCOT     
C1 0 NCOL ND-YAG 1064.0 10.0   100.  250.  30.    1
C2 0 PCOD PMT  532.0  6. 950.0  .2 PHOTON-DEP 950.0  .2 40. 50. CFD
C3 0 NCOT GPS_Trimble_Thunderbolt_E GPS_Trimble_Thunderbolt_E SR620 02379 .0
60 PDAS 0 3
00 New CFD in the STOP channel
00 No CFD in the START channel
00 New experimental detector (transistor) in the START channel**
40 82905.0 0 PDAS 100 100 -1.000 114600.  -50.  153.  -1.000  -1.000   -1.0 3 2 0
20 82905.0 1018.0 271.25  44. 0
50 PDAS  130.  -1.000  -1.000   -1.0 0
11 83098.3290105      .048305496438 PDAS 2  120      7   48.  -1.000  -1.000   -1.0  -1.0 0
11 83174.4241325      .047868166718 PDAS 2  120      2  214.  -1.000  -1.000   -1.0  -1.0 0
11 83405.2093544      .047156181526 PDAS 2  120      3   78.  -1.000  -1.000   -1.0  -1.0 0
11 83703.1902849      .047649035124 PDAS 2  120      2   29.  -1.000  -1.000   -1.0  -1.0 0
20 83860.0 1018.0 271.75  43. 0
40 83860.0 0 PDAS 100 100 -1.000 114650.  -50.  183.  -1.000  -1.000   -1.0 3 2 0
H8
H9

In this file, COMMENTS(“00”) are three lines, and come after COMPATIBILITY(“60”) record, and are followed by CALIB(“40”) record.

So I proposal: (1) COMMENTS can be followed by COMMENTS and any other records; (2) Any other records can be followed by COMMENTS record, “Comment lines can occur anywhere within a file.” wrote in Consolidated Laser Ranging Data Format v2.01.

Here is one of changes:
Stream.of(H1, H2, H3, H4, H5, H8, C0, C1, C2, C3, C4, C5, C6, C7, TEN, ELEVEN, TWELVE, METEO,METEO_SUPP, ANGLES, CALIB, CALIB_DETAILS, CALIB_SHOT, STAT, COMPATIBILITY, COMMENTS);

Hi @lirw1984

Welcome to the Orekit forum!

Good catch! You found a bug. Could you open an issue on our Gitlab issue tracker? (Issues · Orekit / Orekit · GitLab)

Also, if you are interested in contributing the fix, you can look at our contribution guide (Orekit – Contributing to Orekit). The file you put as example can be used to build a unit test for the fix.

Thank you and best regards,
Bryan

OK, I’d like to and I will try it. If I do something wrong, please help me to correct it.

Additional, I want to implement CALIB(“40”) parser recently.

Fixing is almost done, waiting for a major version to merge. See merge request and related issue.

Hi @lirw1984,

Really sorry for the delay in merging your work… :pensive:
This should be done soon but it’s hard to find time.

Maxime

Hi @MaximeJ ,

Never mind. It just so happened that I fixed a few more bugs later.
It’s just that someone mentioned this post, so I write the result here for completeness.

Hi @lirw1984

I started looking out your branch. It looks great!

Bryan

1 Like