- 积分
- 165
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-9-13
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
代码出图如下,只想提取中国区域数据。
;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/shapefile/shapefile_utils.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"
;************************************************
f = addfile("/test/data/20181204data/c3PftFrac_Lmon_MIROC-ESM_esmControl_r1i1p1_185001-210012.nc","r")
;sname = "/shapefile/gadm36_CHN_0.shp"
var = f->c3PftFrac
var@missing_Value = 1e+20
var@_FillValue = 1e+20
varyear = month_to_annual(var, 0)
vardif = var(250,:,:)-var(0,:,:)
varyear = lonFlip(varyear)
vardif = lonFlip(vardif) ; 重新排列经纬度坐标reorder
;printVarSummary(c3dif)
t=max(vardif)
;print (c3avg)
printVarSummary(varyear)
printVarSummary(vardif)
copy_VarAtts(var, vardif)
;printMinMax(c3dif , opt)
print (t)
;************************************************
; create default plot
;************************************************
wks =gsn_open_wks("png","c3dif0")
lon1 = 72
lon2 = 136
lat1 = 17
lat2 = 55
outline_areas = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
res = True
res@vpXF = 0.15
res@vpYF = 0.8
res@vpHeightF = 0.6
res@vpWidthF = 0.8
res@mpMinLatF = lat1
res@mpMaxLatF = lat2
res@mpMinLonF = lon1
res@mpMaxLonF = lon2
res@cnLinesOn = False
res@gsnDraw = False ; don't draw yet
res@gsnFrame = False ; don't advance frame yet
res@gsnMaximize = True
res@mpOutlineOn = False ;-- outline land (default: False)
res@mpFillOn = True
res@mpOutlineSpecifiers = outline_areas ;-- which country to be outlined
res@mpPerimOn = False ; don't draw box around map
res@mpGridAndLimbOn = False ; Don't draw lat/lon lines.
res@mpLandFillColor = "white"
res@mpInlandWaterFillColor = "white"
res@mpOceanFillColor = "white"
res@mpOutlineBoundarySets = "NoBoundaries"
res@tiMainString = "Total C3 PFT Cover Fraction change of 1850-2100"
res@tiMainFontHeightF = 0.025
res@gsnMajorLatSpacing = 10
res@gsnMinorLatSpacing = 1
res@tmYLLabelStride = 1
res@tmYLLabelFontHeightF = 0.015
res@tmYLMajorLengthF = 0.02
res@tmYLMinorLengthF = 0.01
res@tmYLMajorLineColor = "black"
res@tmYLMinorLineColor = "grey20"
res@tmYLLabelFontColor = "black"
res@gsnMajorLonSpacing = 10
res@gsnMinorLonSpacing = 1
res@tmXBLabelStride = 1
res@tmXBLabelFontHeightF = 0.015
res@tmXBMajorLengthF = 0.015
res@tmXBMinorLengthF = 0.01
res@tmXBMajorLineColor = "black"
res@tmXBMinorLineColor = "grey20"
res@tmXBLabelFontColor = "black"
res@gsnRightString = "%"
String = "MIROC-ESM"
ndcres = True
ndcres@txFontColor = "black"
ndcres@txFontHeightF = 0.015
gsn_text_ndc(wks, String, 0.8, 0.12, ndcres)
res@cnFillOn = True
res@cnFillPalette = "BlRe"
res@lbBoxLinesOn = False
res@lbBoxMinorExtentF = 0.2 ;-- decrease height of labelbar boxes and vp
res@lbBoxLinesOn = False ;-- don't draw lines around labelbar boxes
res@lbLabelFontHeightF = 0.015 ;-- label font height
res@lbLabelFont = "helvetica-bold";-- label font
res@lbLabelOffsetF = 0.07 ;-- move the labelbar labels downwards
res@pmLabelBarWidthF = 0.8 ;-- labelbar width; default is shorter
res@pmLabelBarHeightF = 0.1 ;-- labelbar height; default is taller
res@pmLabelBarOrthogonalPosF = 0.07 ;-- y-position (positive: downward; def: 0.02)
res@pmLabelBarParallelPosF = 0.5 ;-- x-position (CenterCenter); default: 0.5
res@cnLevelSelectionMode = "ManualLevels"
res@cnLevelSpacingF = 5
plot = gsn_csm_contour_map(wks,vardif,res)
;.....................
;add China map
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
chinamap = add_china_map(wks,plot,cnres)
draw(plot)
frame(wks)
|
|