- 积分
- 823
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-4-6
- 最后登录
- 1970-1-1
|
发表于 2021-11-29 09:46:44
|
显示全部楼层
我照着论坛上的写,结果全是缺测值
; These files are loaded by default in NCL V6.2.0 and newer
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
filepath = "/cygdrive/L/DJBY/rain/207010314-0320.TXT"
lines = asciiread(filepath,-1,"string") ;以字符串形式读取参数文件入数组argu
lat = stringtofloat(str_get_field(lines(6:),1," "))
lon = stringtofloat(str_get_field(lines(6:),2," "))
pwv = stringtofloat(str_get_field(lines(6:),3," "))
rain = stringtofloat(str_get_field(lines(6:),4," "))
print(rain)
; This second file is not so tricky. The 2D lat/lon data is sorted with
; lat values first, and then lon values.
olon = new(66,"float");
olat = new(40,"float");
data = new((/40,66/),"float")
do i=0,65
olon(i) =72+i
end do
do l=0,39
olat(l) = 17+l
end do
olon!0 = "lon"
olon@long_name = "lon"
olon@units = "degrees_east"
olon&lon = olon
olat!0 = "lat"
olat@long_name = "lat"
olat@units = "degrees_north"
olat&lat = olat
rain@_FillValue =999999.
rscan = (/10,5,3/) ;连续的有效半径大小,最大为10,依次递减
data = obj_anal_ic_deprecated(lon,lat,rain,olon,olat,rscan, False) ;Creanm插值
print(data)
wks_type = "png"
wks = gsn_open_wks(wks_type,"L:/DJBY/rain/") ; Open a workstation and.
gsn_define_colormap(wks,"WhiteBlueGreenYellowRed") ; define a different colormap.
res=True
;res@gsnDraw=False
;res@gsnFrame=False
;res@gsnMaximize=True
res@gsnAddCyclic = False ;由于我们的数据不是循环地球一周的,因此必须把这个置否
res@gsnLeftString="" ;去掉左上角标记
res@gsnRightString=""
res@tmYLLabelFontHeightF=0.01
res@tmXBLabelFontHeightF=0.01
;res@vpWidthF=0.34
;res@vpHeightF=0.25
res@tmXTOn=False
res@tmYROn=False
res@mpDataSetName = "Earth..4"
res@mpDataBaseVersion = "MediumRes"
res@mpOutlineOn = True
res@mpOutlineSpecifiers = (/"China:states","Taiwan"/)
res@mpMinLatF = 17 ; Asia limits
res@mpMaxLatF = 55
res@mpMinLonF = 72
res@mpMaxLonF = 136
;使用两行代码来加粗边界线。
res@mpGeophysicalLineThicknessF= 2. ; double the thickness of geophysical boundaries
res@mpNationalLineThicknessF= 2. ; double the thickness of national boundaries
;默认的底图投影方式是等经纬度投影,画出来的中国地图比较扁,我们常看到的中国地图,投影方式是兰伯特投影,因此需要对投影方式进行修改
res@mpProjection = "LambertConformal" ;兰伯特投影
res@mpLambertMeridianF = 110.0
res@mpLimitMode = "LatLon"
res@mpLambertParallel1F = .001 ;Default: .001 ;可以自己改一改,看看投影有什么不同,挺有趣的
res@mpLambertParallel2F = 89.999 ;Default: 89.999
;最后将填充区域设定在中国行政区域图之内,如果使用默认效果,等值线会对整个矩形区域填充颜色,因此需要去掉中国边境范围外的填充颜色
res@mpAreaMaskingOn = True ;使能填充覆盖
res@mpMaskAreaSpecifiers = (/"China:states","Taiwan"/) ;China:states
res@mpOceanFillColor = 0 ;用白色填充海洋 0是colormap的索引值
res@mpInlandWaterFillColor = 0 ;用白色填充内陆湖水
;使能等值线填充,不显示各填充颜色之间的黑色等值线,不显示等值线上标示的数值,在绘制其他要素前先绘制等值线,对源的设置如下:
res@cnFillOn = True
res@cnLinesOn = False ;等值线不显示
res@cnLineLabelsOn = False
res@cnFillDrawOrder = "PreDraw" ; draw contours first
;使用特定的Level值和配色方案对等值区间进行设置
res@cnLevelSelectionMode = "ExplicitLevels" ; set explicit contour levels
res@cnLevels = (/0.,10.,25.,50.,100.,250./) ; set levels
res@cnFillColors = (/5,6,7,8,9,10,11/) ; set the colors to be used
;在最后生成图片前,先要对整个view进行调整
res@vpXF = 0 ;左边距
res@vpYF = 0.95 ;上边距
res@vpWidthF = 1.0 ; height and width of plot
res@vpHeightF = 0.8
plot=gsn_csm_contour_map(wks,data,res)
draw(plot)
frame(wks)
end
|
-
|