- 积分
- 3324
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-7-29
- 最后登录
- 1970-1-1
|
发表于 2016-12-1 22:35:20
|
显示全部楼层
本帖最后由 837078493 于 2016-12-2 10:03 编辑
楼主 我按照例子画的图为什么只能画出地图没有颜色填充呢 ? 【已解决】已解决 加一句res@gsnAddCyclic =False 就好了 可是我看楼主并没有这句啊 同样都是画中国地图 为什么呀?
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 "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"
begin
pre=addfile("china_160station_to_grid.nc","r")
soil=addfile("soilmoisture.nc","r")
mfc=addfile("mfc.nc","r")
nlat=40
nlon=66
precipitation=pre->prep(:,:,:)
prec=new((/ntime,nlat,nlon/),float)
do i=0,35
prec(i*5:i*5+4,0:39,:)=precipitation(i*12+340:i*12+344,39:0,:)
end do
smsm=soil->swvl1(:,:,:)
sm=smsm*6.723176182765267*10^(-06)+0.2202915908044867
mfcmfc=mfc->$"p84.162"$
mfc1=mfcmfc*1.588008520535256*10^(-08)-0.0003966561290955421
copy_VarCoords(smsm,sm)
copy_VarCoords(mfcmfc,mfc1)
lat=mfc->latitude
lon=mfc->longitude
preca=new((/nlat,nlon/),float)
sma=new((/nlat,nlon/),float)
mfca=new((/nlat,nlon/),float)
preca=dim_avg_n(prec,0)
sma=dim_avg_n(sm,0)
mfca=-dim_avg_n(mfc1,0)*10^5
copy_VarCoords(sm(0,:,:),preca)
copy_VarCoords(sm(0,:,:),sma)
copy_VarCoords(sm(0,:,:),mfca)
wks = gsn_open_wks("pdf","PreandsoilandMFC") ; open a ps plot
gsn_define_colormap(wks,"gui_default") ; choose colormap
res = True
res@gsnDraw = False ; don't draw yet
res@gsnFrame = False ; don't advance frame yet
res@gsnMaximize = True
res@tmXTOn = False
res@tmYROn = False
res@tmXBOn = True
res@tmYLOn = True
res@cnFillOn = True ; turn on color
res@cnLinesOn = False
res@lbLabelAutoStride = True
res@lbBoxMinorExtentF = 0.10
res@lbLabelFontHeightF = 0.012
res@mpMinLatF = 17.
res@mpMaxLatF = 55.
res@mpMinLonF = 72.
res@mpMaxLonF = 136.
res@mpFillOn = True
res@mpOutlineOn = False ; Use outlines from shapefile
res@cnFillDrawOrder = "PreDraw"
res@mpDataBaseVersion = "MediumRes"
res@mpDataSetName = "Earth..4"
res@mpAreaMaskingOn = True
res@mpMaskAreaSpecifiers = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
res@mpLandFillColor = "white"
res@mpInlandWaterFillColor = "white"
res@mpOceanFillColor = "white"
res@mpOutlineBoundarySets = "NoBoundaries"
res1 = res
res1@gsnCenterString = "Precipitation"
res2 = res
res2@gsnCenterString = "Soil moisture"
res3 = res
res3@gsnCenterString = "MFC"
; res3@cnMinLevelValF = -20 ; min level
; res3@cnMaxLevelValF = 20 ; max level
; res3@cnLevelSpacingF = 4 ; contour interval
plot = new(3,graphic)
plot(0) = gsn_csm_contour_map(wks,preca,res1)
plot(1) = gsn_csm_contour_map(wks,sma,res2)
plot(2) = gsn_csm_contour_map(wks,mfca,res3)
cnres = True
cnres@china = True ;draw china map or not
cnres@river = True ;draw changjiang&huanghe or not
cnres@province = True ;draw province boundary or not
cnres@nanhai = True ;draw nanhai or not
cnres@diqu = False ; draw diqujie or not
map1 = add_china_map(wks,plot(0),cnres)
map2 = add_china_map(wks,plot(1),cnres)
map3 = add_china_map(wks,plot(2),cnres)
resP = True ; modify the panel plot
; resP@gsnFrame = False ; don't advance the frame, so we can use gsn_text_ndc
; resP@gsnPanelLabelBar = True ; add common colorbar
resP@lbLabelFontHeightF = 0.015 ; set font height of Label Bar labels
resP@gsnPanelBottom = 0.2 ; shrink panel plot by setting bottom edge of plot
resP@gsnPanelTop = 0.9 ; shrink panel plot by setting top edge of plot
; resP@gsnPanelYWhiteSpacePercent = 5. ; increase spacing along Y-axis between panel plots
gsn_panel(wks,plot,(/3,1/),resP) ; now draw as one plot
; frame(wks)
end
|
-
-
|