需求:下载GFS数据,绘制不同高度层(500hPa~950hPa)风温湿度;
GFS数据下载地址:https://www.cnblogs.com/tiandi/p/11045602.html
下载下来样例数据格式如:gfs.t06z.pgrb2.0p25.f000.grb2
代码如下:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"begin
;---Open file and read datafilename = "/cygdrive/d/learn/tonghang/gfs.t06z.pgrb2.0p25.f000.grb2"a = addfile(filename,"r")lon = a->lon_0({100:125})lat = a->lat_0({15:40})lv=a->lv_ISBL0HGT= a->HGT_P0_L100_GLL0(:,{15:40},{100:125}) u = a->UGRD_P0_L100_GLL0(:,{15:40},{100:125})v = a->VGRD_P0_L100_GLL0(:,{15:40},{100:125})rh = a->RH_P0_L100_GLL0(:,{15:40},{100:125});---Start the graphics
do i = 0,11wks = gsn_open_wks("png","/cygdrive/d/learn/tonghang/975-500wind-height-rh/wind&height&rh"+lv(i)/100)gsn_define_colormap(wks,"MPL_Blues")
;---Set some resourcesres = Trueres@gsnDraw = Falseres@gsnFrame = Falseres@gsnMaximize = True ; maximize plot in frameres@cnFillOn = True ; turn on color fillres@gsnAddCyclic = Falseres@mpOutlineOn = Trueres@mpDataBaseVersion = "MediumRes"res@mpDataSetName = "Earth..4" res@mpOutlineSpecifiers = "China:states"res@mpOutlineBoundarySets = "AllBoundaries"res@mpFillOn =Falseres@mpMinLatF = 15 ; min latres@mpMaxLatF = 40 ; max latres@mpMinLonF = 100 ; min lonres@mpMaxLonF = 125 ; max lonres@mpGeophysicalLineThicknessF= 2.0 res@mpNationalLineThicknessF = 2.0res@gsnLeftString = lv(i)/100+"hPa Wind&Height&RH"res@gsnRightString = "2020/02/29/06(UTC)"res@gsnRightStringFontHeightF = .02res@gsnLeftStringFontHeightF = .02res@lbOrientation = "vertical"res@lbTitleOn = True ; turn on titleres@lbTitleString = "%"res@lbTitleFontHeightF = .015 ; make title smallerres@pmTickMarkDisplayMode = "Always"res@tmXBTickSpacingF = 40res@tiXAxisString = "NCEP GFS 0.25~S~o~N~*0.25~S~o~N~ VALID TIME: 2020/02/29/06 +000hrs" res@tiXAxisFontHeightF = .015res@cnLevelSelectionMode = "ExplicitLevels" ;绘制等值线res@cnLevels = (/80,90,100/)res@cnFillColors = (/0,40,80,110,128/)plot0 = gsn_csm_contour_map(wks,rh(i,:,:),res)res1=Trueres1@gsnDraw = False res1@gsnFrame = False res1@gsnAddCyclic = False res1@cnFillOn = Falseres1@cnLinesOn = Trueres1@cnLineThicknessF = 2.5res1@cnLineColor = "blue"res1@cnInfoLabelOn=Falseres1@gsnLeftString=""res1@gsnRightString=""plot1 = gsn_csm_contour(wks,HGT(i,:,:),res1)res2 = True ; plot mods desiredres2@gsnDraw = False res2@gsnFrame = False res2@gsnAddCyclic = False;res2@vcRefMagnitudeF = 10. ; make vectors larger;res2@vcRefLengthF = 0.050 ; ref vec lengthres2@vcGlyphStyle = "WindBarb" ; select wind barbs res2@vcMinDistanceF = 0.025 ; thin out windbarbsres2@vcRefMagnitudeF = 4.res2@vcRefLengthF = 0.020res2@vcWindBarbScaleFactorF = 2.5res2@vcWindBarbLineThicknessF =2.res2@gsnLeftString=""res2@gsnRightString=""res2@vcRefAnnoString2On = Falseres2@lbLabelBarOn = Falseres2@vcRefAnnoOn = Falseplot2=gsn_csm_vector(wks,u(i,:,:),v(i,:,:),res2)overlay(plot0,plot2)overlay(plot0,plot1)draw(plot0)frame(wks)end do
end
效果如下:(就放三张图吧)