python-bufr
Generic BUFR file reader in python
What does it do?
Depends on / requires
How does it work?
How does it work?
>>> TESTFILE = "./sample_data/iasi_20120206_190254_metopa_27506_eps_o_clp.l2_bufr"�>>> import bufr�>>> import numpy as np�>>> bfr = bufr.BUFRFile(TESTFILE)
How does it work...
>>> nxt = bfr.next()�>>> print [ s.name for s in nxt ]
'SATELLITE IDENTIFIER ',� 'IDENTIFICATION OF ORIGINATING/GENERATING CENTRE (SEE NOTE 10) ',� 'SATELLITE INSTRUMENTS ',� 'SATELLITE CLASSIFICATION ',� 'YEAR ',� 'MONTH ',�...�'HEIGHT OF STATION (SEE NOTE 1) ',�'VERTICAL SIGNIFICANCE (SATELLITE OBSERVATIONS) ',�'PRESSURE ',
...
>>> print nxt[32].name�'PRESSURE '
How does it work...
>>> bfr = bufr.BUFRFile(TESTFILE)�>>> lon = []�>>> lat = []�>>> pres = []�>>> for record in bfr:�>>> for entry in record:�>>> if entry.index == 32:�>>> pres.append(entry.data)�>>> if entry.name.find("LONGITUDE") == 0:�>>> lon.append(entry.data)�>>> if entry.name.find("LATITUDE") == 0:�>>> lat.append(entry.data)�>>> lons = np.concatenate(lon)�>>> lats = np.concatenate(lat)�>>> pres = np.concatenate(pres) / 100.0 # hPa�>>> pres = np.ma.masked_greater(pres, 1.0e+6)
Let's do something with the data
>>> import pyresample as pr
>>> from pyresample import kd_tree, geometry
>>> from pyresample import utils
>>> swath_def = geometry.SwathDefinition(lons=lons, lats=lats)
>>> area_def = utils.parse_area_file('./region_config.cfg', 'scan2')[0]
Let's do something with the data
>>> result = kd_tree.resample_nearest(swath_def, pres,
area_def,
radius_of_influence=12000,
epsilon=100,
fill_value=None)
>>> pr.plot.save_quicklook('/tmp/iasi_ctp_quick.png',
area_def, result, label='IASI - Cloud Top Pressure',
coast_res = 'h')
Let's do something with the data
Remapped IASI lvl2 Pressure
Status