ncl 画填色图没有填色,找不到问题
请大家帮我看一看,为啥我的程序画的图填不上色,思考了很久也没找到原因。我的代码如下:
begin
data= asciiread("shuju/average.txt",(/687,12/),"float")
station = data(:,0)
; lat = data(:,1) ; Read the fifth column of data
; lon = data(:,2) ; r20mm Read the fifth column of data
r10mm = data(:,3) ; r10mmRead the second column of data (indexing starts at 0)
r20mm = data(:,4) ; r20mm Read the fifth column of data
r50mm = data(:,5) ; r50mm Read the second column of data (indexing starts at 0)
cwd = data(:,6) ; cwd Read the fifth column of data
cdd = data(:,7) ; cdd Read the second column of data (indexing starts at 0)
prcptot = data(:,8) ; prcptot Read the fifth column of data
SDII = data(:,9) ; SDII Read the second column of data (indexing starts at 0)
R95 = data(:,10) ; R95 Read the fifth column of data
R99 = data(:,11) ; R99 Read the second column of data (indexing starts at 0)
; print(r10mm)
zlon=data(:,1);将文件中第二行赋给zlon
zlat=data(:,2);将文件中第三行赋给zlat
glon=fspan(90,112,221);定义一个浮点型数据,从90-112,分为221个格点
glat=fspan(24,36,121);纬度的设置,注意后面的格点+1
glon!0="lon"
glon@long_name="lon"
glon@units="degrees_east"
glon&lon=glon
glat!0="lat"
glat@long_name="lat"
glat@units="degrees_north"
glat@lat=glat
rscan=(/0.4,0.2,0.1/);经度格点发散0.4,纬度发散0.2,格点0.1
grid = obj_anal_ic(zlon, zlat, r10mm, glon, glat, rscan, False);插值函数,经纬数据转为格点数据 -一月
grid@_FillValue=r10mm@_FillValue
; grid1=smth9(grid, 0.50,0.25, True)
; grid2=smth9(grid1, 0.50,0.25, True)
; grid3=smth9(grid2, 0.50,0.25, True)
; grid3!0="lat"
; grid3!1="lon"
; grid3&lat=glat
; grid3&lon=glon
grid!0="lat"
grid!1="lon"
grid&lat=glat
grid&lon=glon
; printVarSummary(glat)
printVarSummary(grid)
; printVarSummary(glon)
; exit
wks= gsn_open_wks("png","111")
gsn_define_colormap(wks,"rainbow")
res = True
res@cnFillOn = True;打开等值线之间的填充
res@cnLinesOn = False;关闭等值线显示
res@gsnAddCyclic = False;关闭经纬度循环(全球)
res@mpDataSetName = "Earth..4" ; This new database contains 地图设置
;;;;;;;;;divisions for other countries.
res@mpDataBaseVersion = "MediumRes"; Medium resolution database 地图数据库选取
res@mpOutlineOn = True ; Turn on map outlines 打开地图轮廓
res@mpOutlineSpecifiers = (/"China:states","Taiwan"/) ;China:states
res@mpMinLonF =min(glon) ; select a subregion
res@mpMaxLonF =max(glon)
res@mpMinLatF =min(glat)
res@mpMaxLatF =max(glat)
res@lbOrientation = "Vertical"
res@tmXBMode = "Explicit"
;;;; res@cnLevelSelectionMode = "ExplicitLevels"
;;;;;res@cnLevelSpacingF = 6
;;;;;res@cnLevels = ispan(400,1700,100)
plot = gsn_csm_contour_map(wks,grid,res)
end
用的ubuntu下的ncl,没有颜色,目前还不知道解决方法 ubuntu 下自带的ncl,是存在这个问题。
建议重装ncl——使用官网推荐 conda 方法
conda 可以通过 anaconda安装 houtian 发表于 2023-2-7 11:20
ubuntu 下自带的ncl,是存在这个问题。
建议重装ncl——使用官网推荐 conda 方法
conda 可以通过 anacond ...
好的,感谢 遇到了跟你一样的问题,但我记得几年前在机器上也运行过,当时没有这个毛病
页:
[1]