Skip to content

error reading some GOME-2 L1B files #108

@tdanckaert

Description

@tdanckaert

It seems that CODA (using coda 2.25.1 and EPS-20210313.codadef) has trouble reading certain v13 GOME-2 L1B files containing both earthshine and moon MDR's. Example file:

https://filedrop.eumetsat.int/message/FM2rDLqTaoqeyI2h1EFVcN

The file should contain 1014 MDR's, but I get an error at MDR 1 whenever I try to access the elements sequentially, and the problem occurs when I use the C interface as well as when I use the Python interface. Strangely, it does work when I try again after the first error. The following short Python example (run it with python testcoda.py GOME_xxx_1B_M01_20130728141208Z_20130728155332Z_R_O_20250130022935Z_0400.nat hopefully makes it clear:

import sys
import coda

gome2_file = sys.argv[1]

prod = coda.open(gome2_file)
cur = coda.Cursor(prod)

cur.goto('MDR')
num_mdr = cur.num_elements()
print(f'Have {num_mdr} MDRs.')

for i in range(num_mdr):
    try:
        cur.goto_array_element_by_index(i)
        print('Now at MDR', i)
        cur.goto_parent()
    except Exception as e:
        print('ERROR at MDR', i)
        print(e)
        break
max_mdr = i

print('Try again, now it works...')
cur.goto_parent()
cur.goto('MDR')
for i in range(1+ max_mdr):
    try:
        cur.goto_array_element_by_index(i)
        print('Now at MDR', i)
        cur.goto_parent()
    except Exception as e:
        print('ERROR at MDR', i)
        print(e)
        break

I get the following output:

Have 1014 MDRs.
Now at MDR 0
ERROR at MDR 1
coda_cursor_goto_array_element_by_index(): trying to read beyond the end of the file at /MDR[648]@RECORD_HEADER/INSTRUMENT_GROUP for union field expression at /MDR[648] while initializing product variable mdr_bit_size for size expression at /MDR[0]
Now at MDR 0
Now at MDR 1

-> the second attempt does not raise an exception

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions