利用比濕和溫度計算相對濕度的函數是qair2rh(qair, temp, press=1013.25),三個參數分別是比濕、溫度和氣壓,氣壓有一個缺省值1013.25,因此計算地面相對濕度的時候也可以不給氣壓參數。下面的例子打開CFS模式的地面結果,並從比濕和溫度數組計算出相對濕度數組並繪圖。
腳本程序:
#Open and read data fn = 'U:/data/climate/CFS/20150712/flxf2015081500.01.2015071200.grb2' f = addfile(fn) temp = f['Temperature_surface'][0,::-1,:] sh = f['Specific_humidity_height_above_ground'][0,0,::-1,:] #Calculate relative humidity temp = temp - 273.15 rh = qair2rh(sh, temp) #Plot axesm() mlayer = shaperead('D:/Temp/map/country1.shp') geoshow(mlayer, edgecolor=(0,0,255)) #layer = imshowm(rh, 20) layer = contourfm(rh) title('Relative humidity') colorbar(layer, aspect=12)