pdbufr
pdbufr copied to clipboard
Improve filter speed
The performance of the bufr filter should be improved. It is currently 4-5 times slower than the BUFR filter in Metview Python (it is based on a C++ wrapper around ecCodes), which is already slower than the bufr_filter ecCodes command line tool. The following test case illustrates the problem:
File test.bufr contains 3927 synop messages and we want to extract the 2m temperature values form it. This is the test code in Metview Python:
import metview as mv
f=mv.read('test.bufr')
gpt = mv.obsfilter(data=f,
output="csv",
parameter='airTemperatureAt2M'
)
res= gpt.to_dataframe()
print(len(res))
and this is the code with pdbufr:
import pdbufr
f = 'test.bufr'
res = pdbufr.read_bufr(f, columns=('latitude', 'longitude', 'airTemperatureAt2M'))
print(len(res))
The execution time is as follows:
- Metview Python: 2.788s
- pdbufr: 11.861s