pytroll / trollbufr

PyTroll BUFR reader
http://trollbufr.readthedocs.io/
GNU Lesser General Public License v3.0
11 stars 7 forks source link

Support for bufr edition 2? #30

Open jfigui opened 3 years ago

jfigui commented 3 years ago

Dear pytroll members,

I wanted to test your trollbufr code with some radar QPE composites from MeteoFrance but I encountered the following issue: (pyrad) [figuerasiventuraj@sotrtm31-sidev ~]$ trollbufr3 -d -vv /utemp/mdso/figuerasiventuraj/QPE_composite/2020/10/02/202010022355 [DEBUG: bufr_main:351] Namespace(array=False, bulletin=None, desc=False, in_file=['/utemp/mdso/figuerasiventuraj/QPE_composite/2020/10/02/202010022355'], json_dump=False, json_encode=False, out_file=None, reader=True, sparse=False, tables_path='/usr/local/sopra/etc/bufrtables/', tables_type='eccodes', verbose=2) FILE 202010022355 [INFO: load_file:54] FILE /utemp/mdso/figuerasiventuraj/QPE_composite/2020/10/02/202010022355 [DEBUG: load_file:77] SEARCH AHL : 0 - 0 b'BUFR' : 0 matches > 0 [DEBUG: load_file:97] LOADED 7668358 B, 0 - 7668358 BUFR #0 (7668358 B) HEADER None [INFO: bufr:309] SECT 0..5 DECODE [DEBUG: bufr:316] SECT_0 offs:8 len:8 = {'size': 7668358, 'edition': 2} ERROR BufrDecodeError: BUFR edition 2 not supported [ERROR: bufr_main:148] BufrDecodeError: BUFR edition 2 not supported Traceback (most recent call last): File "/home/mdso/figuerasiventuraj/anaconda3/envs/pyrad/lib/python3.7/site-packages/trollbufr/bufr_main.py", line 69, in read_bufr_data bufr.decode_meta(blob, load_tables=False) File "/home/mdso/figuerasiventuraj/anaconda3/envs/pyrad/lib/python3.7/site-packages/trollbufr/bufr.py", line 318, in decode_meta raise BufrDecodeError("BUFR edition %d not supported" % self.edition) trollbufr.coder.errors.BufrDecodeError: BufrDecodeError: BUFR edition 2 not supported

Do you have a fix for that? I am just interested in reading the data in those files with Python, I do not strictly need to read the metadata. Any help would be very much welcome.

Kind regards,

Jordi

alexmaul commented 3 years ago

Hello Jordi, trollbufr only supports BUFR 3+4 (yet), since they are in circulation on the GTS. There is no simple fix to support BUFR 2. I'll have to read up the manuals before I can say if/when there's such support. Alex

jfigui commented 3 years ago

Hi Alex,

Thanks for your fast reply. I hope you can find the time and the will to do it. It would be a very nice addition to trollbufr because many radar files circulating in Europe are still written in BUFR 2. If I can be of some help let me know but I warn you that I have no idea how bufr works :)

alexmaul commented 3 years ago

Hi Jordi, some other project took all my time :( Now, I've got some BUFR2 radar data I can test with. The differences between BUFR2 and BUFR3 should be in the metadata section "1", so decoding the data sections should be ok.

jfigui commented 3 years ago

Hi Alex,

Thanks a lot for taking the time to have a look at it. In such case, could it be possible at least for now to modify the code so that it throws a warning instead of an exception and continues to decode the data? That would be a quick fix and we can see what to do with the metadata later on.

jfigui commented 3 years ago

Hi @alexmaul ,

Can you let me know whether you are working on it and how long do you think it will take to find a solution?

No pressure but it would be good to know whether I would be able to use the package in a reasonable time or I have to work on another solution in the meanwhile.

If you need my help just let me know.

alexmaul commented 3 weeks ago

I'm back on it ... but havn't found documentation for the change between Ed.2 and Ed.3.