- 积分
- 200
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-5-31
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2024-1-26 16:42:13
|
显示全部楼层
begin
cdf = addfile("E:/2023WORK/20230611/712-715.nc","r")
;***********************************************
;关于层次的设定
levels = cdf->level
ldims = dimsizes(levels)
lt=ldims(0)
lev=ispan(0,lt-1,1)
print(ldims(0))
print(levels(0)) ;第一层是200hPa
;***********************************************
;关于时间的设定
times = cdf->time
ndims = dimsizes(times)
nt=ndims(0)
taus = ispan(0,nt-1,1)
print(ndims(0))
print(times(0))
gap =1
ta = short2flt(cdf->t(:,:,{45},{121.5})) ;46,122是乌兰浩特市的经纬度
rh = short2flt(cdf->r(:,:,{45},{121.5}))
uu = short2flt(cdf->u(:,:,{45},{121.5}))
vv = short2flt(cdf->v(:,:,{45},{121.5}))
tt=ta-273.16
copy_VarMeta(ta, tt)
name="pou20230713-"
type="png"
type@wkWidth = 1700 ;可以通过设置改变图片分辨率
type@wkHeight = 1700
outpath="D:/cygwin/home/Administrator/"
wks = gsn_open_wks(type,outpath+name)
gsn_define_colormap(wks,"rh")
rhh=transpose(rh)
t =transpose(tt)
u =transpose(uu)
v =transpose(vv)
;***********************************************
rh_res = True
temp_res = True
uv_res = True
;***********************************************
; Here are the resources that rh_res, temp_res, and uv_res share.
;***********************************************
rh_res = True
rh_res@cnSmoothingOn = True
rh_res@cnSmoothingDistanceF = 0.005
rh_res@cnSmoothingTensionF = 0.01
rh_res@trYReverse = True ; Reverse the Y values.;第一层是200hPa,所以要用这个语句倒转Y轴
rh_res@trXReverse = True
rh_res@gsnDraw = False ; Don't draw individual plot 不画单独的图层
rh_res@gsnFrame = False ; Don't advance frame.
rh_res@vpXF = 0.1 ; x location X轴左边界的位置
;rh_res@vpYF = 0.90 ; y location Y轴上边界的位置
rh_res@vpWidthF = 0.83 ; width 图片的宽度
rh_res@vpHeightF = 0.40 ; height
rh_res@tmXBLabelFontHeightF = 0.015 ;设置xy轴字体大小
rh_res@tmYLLabelFontHeightF = 0.015
temp_res = rh_res ; copy shared resources to other lists
uv_res = rh_res
;***********************************************
; Relative humidity only resources
;***********************************************
rh_res@cnFillOn = True ; turns on color fill
rh_res@cnLinesOn = False
rh_res@gsnLeftString ="Relative humidity"
rh_res@gsnLeftStringFontHeightF =0.015
rh_res@gsnRightString ="%"
rh_res@gsnRightStringFontHeightF =0.015
rh_res@cnLevelSelectionMode = "ExplicitLevels" ;AutomaticLevels
rh_res@cnLevels=(/60,70,80,90,95,100/)
rh_res@cnLineLabelsOn = False ; no contour labels
rh_res@tiMainString = "Meteogram for Wujiaofeng" ; title
rh_res@tiMainFontHeightF = 0.02
rh_res@lbOrientation = "Vertical" ; Default is horizontal
rh_res@lbLabelFontHeightF = 0.014 ;-- increase label font size
rh_res@lbLabelFontThicknessF = 1. ;-- increase label font thickness
rh_res@lbRightMarginF=0.7
rh_res@pmLabelBarOrthogonalPosF = -0.02
rh_res@sfXArray = lev(0:lt-1:gap) ; Define X/Y axes values that
rh_res@sfYArray = taus(0:nt-1:gap)
rh_res@tmYLValues = lev(0:lt-1:gap)
rh_res@tmYLMode = "Explicit"
rh_res@tmYLLabels = (/"100", "150","200", "250","300", "400", "500", "600","700","800", \
"850","900","925","1000"/)
rh_res@tmXBValues = taus(0:nt-1:gap) ; location of explicit labels
rh_res@tmXBMode = "Explicit"
rh_res@tmXBLabels = (/"8:00", "11:00", "14:00", "17:00","20:00", "23:00","July13", "05:00", \
"8:00", "11:00", "14:00","17:00", "20:00", "23:00","July14", "05:00", \
"8:00", "11:00", "14:00","17:00", "20:00", "23:00","July15", "05:00", \
"8:00", "11:00", "14:00","17:00", "20:00", "23:00","July16", "05:00"/)
rh_res@tmXBLabelAngleF = 90. ; change label angle
;***********************************************
; Temperature only resources
;***********************************************
temp_res@sfXArray = lev(0:lt-1:gap) ; Define X/Y axes values that
temp_res@sfYArray = taus(0:nt-1:gap)
temp_res@cnLineLabelsOn = True ; no contour labels
temp_res@cnLineThicknessF= 3.0 ; line thickness
temp_res@cnLineColor = "Red" ; color of contour lines
;***********************************************
; wind barb only resources
;***********************************************
uv_res@vfXArray = lev(0:lt-1:gap) ; Define X/Y axes values that
uv_res@vfYArray = taus(0:nt-1:gap)
uv_res@vcRefAnnoOn = False ; turns off the ref vector
uv_res@vcRefLengthF = 0.040 ; set length of ref vector
uv_res@vcGlyphStyle = "WindBarb" ; turn on windbarbs
uv_res@vcMonoWindBarbColor = True ; to color the windbarbs with
; respect to speed use False
uv_res@vcMapDirection = False ; needed to disassociate the coordinate plane from the wind barbs
uv_res@vcWindBarbLineThicknessF=4
uv_res@vcRefLengthF=0.03
;********************************************************
; three of the above plots become one overlay plot
;********************************************************
rhfill = gsn_csm_contour(wks,rhh,rh_res)
templine = gsn_contour(wks,t,temp_res)
windlayer = gsn_vector(wks,u*2.5,v*2.5,uv_res)
overlay(rhfill,templine) ; result is templine over rhfill
overlay(rhfill,windlayer)
draw(rhfill) ; draw this overlay result
frame(wks)
end |
|