- 积分
- 111
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2024-5-16
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
请问一下我下面的这个程序,画风场和温湿度的叠加图,最后想在图上标记一个点,但是怎么都不显示,程序运行没有问题的,大小和颜色修改试过了,猜测可能是叠加的问题给盖住了?但是要怎么修改呢,求助大佬
;**********************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;**********************************************************
begin
;filename = "fnl_20241218_12_00.grib2"
filename = "gdas1.fnl0p25.2024121800.f00.grib2"
f = addfile(filename , "r")
u = f->UGRD_P0_L100_GLL0({85000}, :, :) ;提取850hPa风场
u = u * 2.5
v = f->VGRD_P0_L100_GLL0({85000}, :, :) ;提取850hPa风场
v =v * 2.5
; 提取温度数据(例如 850 hPa 的温度)
temp = f->TMP_P0_L100_GLL0({85000}, :, :) ; 850 hPa 的温度,单位为 K
; 进行单位转换(从开尔文转换为摄氏度)
temp = temp - 273.15 ; 转换为摄氏度
; 提取相对湿度
rh = f->RH_P0_L100_GLL0({85000}, :, :) ; 850 hPa 的相对湿度,单位%
fname = str_get_cols(filename, 14, 23)
wks = gsn_open_wks("png", fname)
cmap = (/ (/255, 255, 255/), \
(/0, 0,0/), \
(/255, 255, 255/), \
(/230, 255, 225/), \
(/ 200, 255, 190/), \
(/ 180, 250, 170/), \
(/ 150, 245, 140/), \
(/ 140, 245, 150/), \
(/0, 255, 0/)/) /255.0
;(/155, 87, 203/) /) /255.0
gsn_define_colormap(wks,cmap)
res = True
res@gsnMaximize = True;控制图片在中间
res@gsnDraw = False
res@gsnFrame = False
res@gsnLeftString = ""
res@gsnRightString = ""
res@tiMainString = "" ; 图表标题
;>---------------------------------------<
; 设置地图资源
;>---------------------------------------<
mpres = res
mpres@mpFillOn = False
mpres@mpMinLatF = 31.
mpres@mpMaxLatF = 40.
mpres@mpMinLonF = 105.
mpres@mpMaxLonF = 112.
mpres@mpDataBaseVersion = "MediumRes"
mpres@mpDataSetName = "Earth..4"
mpres@mpOutlineSpecifiers = (/"China:states"/)
mpres@pmTickMarkDisplayMode = "Always"
mpres@tmXBMajorLengthF = 0.005
;>---------------------------------------<
;>---------------------------------------<
; 设置温度等值线资源
;>---------------------------------------<
cnres = res
cnres@cnSmoothingOn = True ;
cnres@cnSmoothingDistanceF = 0.001
cnres@cnLevelSelectionMode = "ManualLevels"
cnres@cnMinLevelValF = -30 ; 设置等值线最小值
cnres@cnMaxLevelValF = 40 ; 设置等值线最大值
cnres@cnLevelSpacingF = 5 ; 设置等值线间隔
cnres@cnLineColor = "red" ;设置等值线颜色
cnres@cnInfoLabelOn = False
cnres@cnLineLabelsOn = True
cnres@cnLineLabelFontHeightF = 0.01
cnres@cnLineThicknessF = 2.0
cnres@cnLineLabelInterval = 1
;>---------------------------------------<
;>---------------------------------------<
; 设置风标
;>---------------------------------------<
vcres = res
vcres@gsnAddCyclic = False
vcres@vcGlyphStyle = "WindBarb"
vcres@vcRefLengthF = 0.02
vcres@vcRefAnnoOn = False
vcres@vcWindBarbLineThicknessF = 1.5
vcres@vcWindBarbColor = "black"
vcres@vcMinMagnitudeF = 0.01
vcres@vcWindBarbTickLengthF = 0.35
;>---------------------------------------<
; 设置湿度色块填充资源
;>---------------------------------------<
fillres = res
fillres@cnFillOn = True
fillres@lbBoxEndCapStyle = "TriangleBothEnds" ;色标形状为三角
fillres@lbOrientation = "Vertical" ; 设置色卡方向为垂直(默认为垂直)
fillres@pmLabelBarHeightF = 0.3 ;色标高度
fillres@pmLabelBarWidthF = 0.08 ;色标宽度
fillres@pmLabelBarOrthogonalPosF = 0.05 ;色标卡距离画布的距离
fillres@pmLabelBarParallelPosF = 0.3
fillres@lbLabelFontHeightF = 0.010 ;色标卡字体大小
fillres@cnInfoLabelOn = False ; 去掉图底端的标签信息
;***色标值定义按最小值最大值和间隔来定义***
fillres@cnLevelSelectionMode = "ManualLevels"
fillres@cnLevelSpacingF = 10
fillres@cnMinLevelValF = 50
fillres@cnMaxLevelValF = 100
mapplot = gsn_csm_map(wks, mpres)
cnplot = gsn_csm_contour(wks, temp, cnres)
vcplot = gsn_csm_vector(wks, u, v, vcres)
fillplot = gsn_csm_contour(wks, rh, fillres)
overlay(mapplot, fillplot)
overlay(mapplot, cnplot)
overlay(mapplot, vcplot)
; 在地图上添加标记点
marker_lat =34 ; 标记点的纬度
marker_lon = 108 ; 标记点的经度
marker_res = True
marker_res@gsMarkerIndex = 16 ; 圆形标记
marker_res@gsMarkerSizeF = 0.02 ; 设置标记点大小
marker_res@gsMarkerColor = "yellow" ; 设置标记点颜色
; 添加标记点
dum = gsn_add_polymarker(wks, mapplot, marker_lat, marker_lon, marker_res)
draw(mapplot)
frame(wks)
end
|
|