- 积分
- 3144
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-7-14
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我用的是cmorph融合的逐小时降水资料,是grd格式的,想画105-120E,25-40N的降水,结果画出来的图很奇怪,下面是我的ncl脚本,想问是哪里错了?先谢谢了
;===========================================================================
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"
;load "./gsn_csm.ncl"
;============================================================================
; TEMPLATE TO PLOT A MAP OF THE PRECIPITABLE WATER.
begin
;SET RESOURCES:
res = True
res@gsnAddCyclic =False
;res@mpGridAndLimbOn =True
;res@mpGridLineColor ="Black"
;res@mpGridLineDashPattern =4
;res@mpLandFillColor = "white"
;res@mpOceanFillColor = "white"
;res@mpInlandWaterFillColor = "white"
res@cnFillOn =True
res@cnLinesOn ="False"
res@cnLineLabelsOn ="False"
res@cnSmoothingOn =True
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = (/ 6, 12, 25,50,70,100 /)
res@cnExplicitLabelBarLabelsOn = True
res@lbLabelStrings = (/"6","12","25","50","70","100"/)
res@mpLimitMode = "LatLon"
res@mpDataBaseVersion = "MediumRes"
res@mpDataSetName = "Earth..4"
res@mpAreaMaskingOn = True
res@mpMaskAreaSpecifiers = (/"China:Henan"/)
res@mpMinLatF =25
res@mpMaxLatF =40
res@mpMinLonF =105
res@mpMaxLonF =120
res@mpOutlineBoundarySets = "NoBoundaries"
res@mpLimitMode = "LatLon"
res@pmTickMarkDisplayMode = "Always"
;reading files
tim = (/"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070818.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070819.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070820.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070821.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070822.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070823.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070900.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070901.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070902.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070903.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070904.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070905.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070906.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070907.grd",\
"SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2016070908.grd"/)
nlat=80
nlon=70
ntim=15
lon = fspan(105,120,nlon)
lat = fspan(25,40,nlat)
lat!0 = "lat"
lat@long_name = "latitude"
lat@units = "degrees_north"
lon!0 = "lon"
lon@units = "degrees_east"
lon@long_name = "longitude"
olon = fspan(105,120,70)
olat = fspan(25,40,80)
r = new((/ntim,nlat,nlon/),"double")
do t = 0, ntim-1
rain = fbindirread(tim(t),0,-1,"double")
k=0
do i = 0, nlat-1
do j = 0, nlon-1
r(t,i,j)= rain(k)
k = k+1
end do
end do
end do
;r!0 = "time"
;r&time = tim
;r@units = "mm/hour"
;r@_FillValue = -999.0
;n=num(ismissing(r))
;print("n="+n)
;printVarSummary(r)
res@gsnAddCyclic = False
wks = gsn_open_wks("pdf","/home/wangl/pkn/station/sta")
cmap=(/(/1.,1.,1./),(/0.,0.,0./),(/1.,1.,1./),(/.26,.88,.95/),(/.153,.706,.733/),(/.08,.61,.26/),\
(/.28,.90,.49/),(/.89,.88,.18/),(/.77,.75,.10/),(/.65,.45,.16/),(/.612,.125,.137/),\
(/.8392,.2118,.2275/),(/.9059,.0745,.5098/),(/.65,.10,.86/),(/.24,.16,.45/)/)
gsn_define_colormap(wks,cmap)
;gsn_draw_colormap(wks)
res@gsnLeftString = "rain"
res@gsnRightString = "[mm~N~]"
res@tiMainString = "2016-07-08-18:00 - 2016-07-09-08:00"
frain=r(0,:,:)
do t = 1,ntim-1
srain = r(t,:,:)
arain =srain + frain
frain = arain
end do
print(frain)
filo="crain"
fbinrecwrite(filo,-1,frain)
nlat=80
nlon=70
ntim=15
lon = fspan(105,120,nlon)
lat = fspan(25,40,nlat)
frain!0 = "lat"
frain!1 = "lon"
frain&lat = lat
frain&lon = lon
frain@units = "mm/hour"
frain@_FillValue = -999.00
n=num(ismissing(frain))
print("n="+n)
printVarSummary(frain)
plot = gsn_csm_contour_map(wks,frain,res)
draw(plot)
frame(wks)
end
;==================================================
|
-
|