MeteoInfoLab脚本示例:CloudSAT Swath HDF数据

读取CloudSAT HDF Swath数据,绘图分上下两部分,上面是时间和高度维的Radar Reflectivity Factor二维图,下面是卫星轨迹图。

示例程序:

# Add file
f = addfile('D:/Temp/hdf/2010128055614_21420_CS_2B-GEOPROF_GRANULE_P_R04_E03.hdf')

# Read data
vname = 'Radar_Reflectivity'
v_data = f[vname]
data = v_data[:,:]
v_height = f['Height']
height = v_height[0,:]
time = f['Profile_time'][:]
lon = f['Longitude'][:]
lat = f['Latitude'][:]

# Read attributes
long_name = v_data.attrvalue('long_name')[0]
scale_factor = v_data.attrvalue('factor')[0]
valid_min = v_data.attrvalue('valid_range')[0]
valid_max = v_data.attrvalue('valid_range')[1]
units = v_data.attrvalue('units')[0]
units_h = v_height.attrvalue('units')[0]

# Apply scale factor
valid_max = valid_max / scale_factor
valid_min = valid_min / scale_factor
data = data / scale_factor
data[data>valid_max] = nan
data[data<valid_min] = nan
data = transpose(data)
data = data[::-1,:]

# Make a split window plot
subplot(2, 1, 1)

# Contour the data
levs = arange(-38, 50, 2)
layer = imshow(time, height[::-1], data, levs)
colorbar(layer)
title('Radar Reflectivity Factor')
xlabel('Seconds since the start of the granule. (seconds)')
ylabel('Height (m)')

# The 2nd plot is the trajectory
subplot(2, 1, 2)
axesm()
lworld = shaperead('D:/Temp/map/country1.shp')
geoshow(lworld, edgecolor='k')
plotm(lon, lat, '-b', linewidth=4)
#scatterm(lon, lat, lon, size=4, edge=False, facecolor='b')
scatterm(lon[0], lat[0], size=6, facecolor='r')
xlim(-180, 180)
ylim(-90, 90)
title('Trajectory of Flight Path (starting point in red)')

posted on 2015-10-14 23:16  yaqiang  阅读(926)  评论(1编辑  收藏  举报

导航