||
BUFR是WMO规定的一种表格码驱动数据格式,是针对站点观测数据存储的,GRIB数据格式是针对格点数据的。BUFR格式过于灵活,而且有数据重复机制,如果没有约定的话很难自动解析出特定的信息。netCDF Java库可以读取BUFR格式,但读出来是Sequence数组ArraySequence,里面的数据可能“多层嵌套”,数据必须用StructureDataIterator来读取,读出来的数据(StructureMembers)可以在命令行看有哪些Member,然后再读取某个Member,用Member的dataArray获取数据数组。
>>> data.members
[CLOUD_INDEX, CLOUD_AMOUNT_IN_SEGMENT-2, CLOUD_PHASE, TEMPERATURE_AIR_TEMPERATURE, PRESSURE]
Unidata网站可以下载toolsUI软件来打开数据看里面的具体信息和一些常用的表格。
示例脚本:
fn = 'D:/Temp/bufr/MSG3-SEVI-MSGCLAP-0000-0000-20150101004500.000000000Z-20150101005935-1187380.bfr'
f = addfile(fn)
#print f
d = f['obs'][None]
iter1 = d.getStructureDataIterator()
if iter1.hasNext():
data = iter1.next()
iter1.finish()
mlon = data.findMember('LONGITUDE_(HIGH_ACCURACY)')
mlat = data.findMember('LATITUDE_(HIGH_ACCURACY)')
lon = (array(mlon.dataArray).astype('float') - 1.8E7) * 1.E-5
lat = (array(mlat.dataArray).astype('float') - 9.E6) * 1.E-5
struct1 = data.getArray('struct1')
iter1 = struct1.getStructureDataIterator()
if iter1.hasNext():
data = iter1.next()
iter1.finish()
mtemp = data.findMember('TEMPERATURE_AIR_TEMPERATURE')
temp = array(mtemp.dataArray).astype('float') * 0.1
temp = temp[:,0]
#Plot
axesm()
lworld = shaperead('D:/Temp/map/country1.shp')
geoshow(lworld, edgecolor='k', facecolor=(204,255,204))
layer = scatterm(lon, lat, temp, size=4, edge=False)
colorbar(layer)
xlim(-50, 0)
ylim(10, 40)
title('Bufr data example')
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-21 22:23
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社