- 积分
- 55946
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 MeteoInfo 于 2020-9-21 16:21 编辑
BUFR是WMO规定的一种表格码驱动数据格式,是针对站点观测数据存储的,GRIB数据格式是针对格点数据的。BUFR格式过于灵活,而且有数据重复机制,如果没有约定的话很难自动解析出特定的信息。netCDF Java库可以读取BUFR格式,但读出来是Sequence数组ArraySequence,里面的数据可能“多层嵌套”。addfile函数打开数据时要加上keepopen=True参数,数据读完后用关闭文件。obs变量的get_members方法可以获取变量所有的Members,member_array函数可以获取某个Member的数值,如果Member是Squence,还需要进一步获取其内部member的数据。
>>> v.get_members()
[SATELLITE_IDENTIFIER, IDENTIFICATION_OF_ORIGINATING_GENERATING_CENTRE, SATELLITE_CLASSIFICATION, SEGMENT_SIZE_AT_NADIR_IN_X-DIRECTION, SEGMENT_SIZE_AT_NADIR_IN_Y-DIRECTION, YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, ROW_NUMBER, COLUMN_NUMBER, LATITUDE_(HIGH_ACCURACY), LONGITUDE_(HIGH_ACCURACY), CLOUD_AMOUNT_IN_SEGMENT, AMOUNT_OF_LOW_CLOUDS, NUMBER_OF_OBSERVATIONS, struct1, AMOUNT_OF_MIDDLE_CLOUDS, NUMBER_OF_OBSERVATIONS-2, struct2, AMOUNT_OF_HIGH_CLOUDS, NUMBER_OF_OBSERVATIONS-3, struct3, DATA_PRESENT_INDICATOR, IDENTIFICATION_OF_ORIGINATING_GENERATING_CENTRE-2, GENERATING_APPLICATION, OBSERVATION_QUALITY]
Unidata网站可以下载toolsUI软件来打开数据看里面的具体信息和一些常用的表格。
示例脚本:
- fn = 'D:/Temp/bufr/MSG3-SEVI-MSGCLAP-0000-0000-20150101004500.000000000Z-20150101005935-1187380.bfr'
- f = addfile(fn, keepopen=True)
- v = f['obs']
- lon = v.member_array('LONGITUDE_(HIGH_ACCURACY)')
- lat = v.member_array('LATITUDE_(HIGH_ACCURACY)')
- lon = (lon - 1.8E7) * 1.E-5
- lat = (lat - 9.E6) * 1.E-5
- struct1 = v.member_array('struct1')
- temp = struct1.member_array('TEMPERATURE_AIR_TEMPERATURE')
- temp = temp * 0.1
- temp = temp[:,0]
- f.close()
- #Plot
- axesm()
- geoshow('country')
- layer = scatterm(lon, lat, temp, 20, size=4, edge=False, zorder=0)
- colorbar(layer)
- title('Bufr data example')
MeteoInfo 2.1.2版本以后增加了中国气象局的Bufr表格,可以读取中国气象局的Bufr文件。下面是一个例子:
- fn = r'D:\Temp\bufr\bufr_data\Z_SURF_I_57377_20200225000000_O_AWS_FTM.BIN'
- f = addfile(fn, keepopen=True)
- obs = f['obs']
- lon = obs.member_array('Longitude_high_accuracy')
- lat = obs.member_array('Latitude_high_accuracy')
- lon = (lon - 1.8E7) * 1.E-5
- lat = (lat - 9.E6) * 1.E-5
- alt = obs.member_array('Height_of_station_ground_above_mean_sea_level')
- alt = (alt - 4000) * 1.E-1
- st_name = obs.member_array('Station_or_site_name')
- st_id = obs.member_array('WMO_station_number')
- year = obs.member_array('Year')
- month = obs.member_array('Month')
- day = obs.member_array('Day')
- hour = obs.member_array('Hour')
- seq1 = obs.member_array('seq1')
- pres = seq1.member_array('Pressure') * 1e1
- seq2 = obs.member_array('seq2')
- temp = seq2.member_array('Temperature-air_temperature') * 1e-1
- print('Pressure: {}; Temperature: {}'.format(pres, temp))
- f.close()
|
|