ecmwf / eccodes-python

Python interface to the ecCodes GRIB/BUFR decoder/encoder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem when retrieving an attribute from BUFR file and then reopen the BUFR file

ColinDuff opened this issue · comments

hi
i have a script that will retrieve an attribute from a BUFR file eg "TypicalDate" but i then want to reopen the BUFR file to retrieve data arrays from the BUFR messages.

Problem is I have to read in all of the BUFR file to retrieve the attribute - even though the first 1 i read is enough for my purposes. If I break from reading the file after the first read , when i reopen to read in the data array it only reads in a couple of messages before closing.

So is there a reason you need to read in the whole file

ie i would like to be able to do this , instead of a while True and break when bufr is None


bufr = ec.codes_bufr_new_from_file(fh)

ec.codes_set(bufr, 'unpack', 1)

attr = ec.codes_get(bufr, key)

ec.codes_release(bufr)

fh.close()

Dear Colin,
It is best to contact our Software Support at ECMWF regarding requests such as this.
So please may I ask you to email your request/issue and the relevant details to:

Software.Support@ecmwf.int

Many thanks